Never Works

Chaos_Knight

New Member
Reaction score
39
I was creating a Dummy Creating spell. TOOO Hard. I just can some codes and it messed up. My spell does nothing. I can test it but it does nothing, no errors or nothing.

JASS:
function Trig_Spell_Actions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function SpellAct takes nothing returns nothing
    local unit u1 = GetTriggerUnit()
    local player uo = GetOwningPlayer(u1)
    local real r = 0
    local player ou = GetOwningPlayer(u1)
    local location loc = OffsetLocation(GetUnitLoc(u1), 300, 250)
loop
exitwhen r > 360
    call CreateUnit(uo,'u000',25,26,r)
    call UnitApplyTimedLife(GetLastCreatedUnit(), 'BTLF', 0.20)
    call IssuePointOrderLoc(GetLastCreatedUnit(), "shockwave", loc )
    set r = r + 36
endloop
endfunction
//===========================================================================
function InitTrig_Spell takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction( trig, function Trig_Spell_Actions )
endfunction

^
Just take a look. After taking a look. Dont wipe. This is awful now, but i justed started with JASS and I'M very proud. There.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, does that even compile ?!
Do you have Newgen ? Then there should be at least (After my first quick look) one error in that...

JASS:
function Trig_Spell_Actions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function SpellAct takes nothing returns nothing
    local unit u1 = GetTriggerUnit()
    local player uo = GetOwningPlayer(u1)
    local real r = 0
    local player ou = GetOwningPlayer(u1)
    local location loc = OffsetLocation(GetUnitLoc(u1), 300, 250)
loop
exitwhen r > 360
    call CreateUnit(uo,'u000',25,26,r)
    call UnitApplyTimedLife(GetLastCreatedUnit(), 'BTLF', 0.20)
    call IssuePointOrderLoc(GetLastCreatedUnit(), "shockwave", loc )
    set r = r + 36
endloop
endfunction
//===========================================================================
function InitTrig_Spell takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    //call TriggerAddAction( trig, function Trig_Spell_Actions ) // You're adding the condition as an action...
    call TriggerAddCondition( trig, Condition( function Trig_Spell_Actions ) )
    // And you're not even adding an action...
    call TriggerAddAction( trig, function SpellAct )
endfunction


And also, the native [ljass]CreateUnit[/ljass] doesn't automatically set thevariable [ljass]bj_lastCreatedUnit[/ljass] or [ljass]GetLastCreatedUnit[/ljass] so you need to do this:
JASS:
function SpellAct takes nothing returns nothing
    local unit u1 = GetTriggerUnit()
    local player uo = GetOwningPlayer(u1)
    local real r = 0
    local player ou = GetOwningPlayer(u1)
    local location loc = OffsetLocation(GetUnitLoc(u1), 300, 250)
    local unit u
loop
exitwhen r > 360
    set u = CreateUnit(uo,'u000',25,26,r)
    call UnitApplyTimedLife(u, 'BTLF', 0.20)
    call IssuePointOrderLoc(u, "shockwave", loc )
    set r = r + 36
endloop
endfunction
 

Chaos_Knight

New Member
Reaction score
39
Well, does that even compile ?!
Do you have Newgen ? Then there should be at least (After my first quick look) one error in that...

JASS:
function Trig_Spell_Actions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function SpellAct takes nothing returns nothing
    local unit u1 = GetTriggerUnit()
    local player uo = GetOwningPlayer(u1)
    local real r = 0
    local player ou = GetOwningPlayer(u1)
    local location loc = OffsetLocation(GetUnitLoc(u1), 300, 250)
loop
exitwhen r > 360
    call CreateUnit(uo,'u000',25,26,r)
    call UnitApplyTimedLife(GetLastCreatedUnit(), 'BTLF', 0.20)
    call IssuePointOrderLoc(GetLastCreatedUnit(), "shockwave", loc )
    set r = r + 36
endloop
endfunction
//===========================================================================
function InitTrig_Spell takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    //call TriggerAddAction( trig, function Trig_Spell_Actions ) // You're adding the condition as an action...
    call TriggerAddCondition( trig, Condition( function Trig_Spell_Actions ) )
    // And you're not even adding an action...
    call TriggerAddAction( trig, function SpellAct )
endfunction


And also, the native [ljass]CreateUnit[/ljass] doesn't automatically set thevariable [ljass]bj_lastCreatedUnit[/ljass] or [ljass]GetLastCreatedUnit[/ljass] so you need to do this:
JASS:
function SpellAct takes nothing returns nothing
    local unit u1 = GetTriggerUnit()
    local player uo = GetOwningPlayer(u1)
    local real r = 0
    local player ou = GetOwningPlayer(u1)
    local location loc = OffsetLocation(GetUnitLoc(u1), 300, 250)
    local unit u
loop
exitwhen r > 360
    set u = CreateUnit(uo,'u000',25,26,r)
    call UnitApplyTimedLife(u, 'BTLF', 0.20)
    call IssuePointOrderLoc(u, "shockwave", loc )
    set r = r + 36
endloop
endfunction

Blame Blame.. Yes it does compile and gives no errors
 

Komaqtion

You can change this now in User CP.
Reaction score
469
What is your trigger called ?
And also, you know that you're createing the units at a fixed place... x = 25 y = 26
So it'll always be near the center of the map ;)
 

Chaos_Knight

New Member
Reaction score
39
JASS:
function Trig_Spell_Actions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function SpellAct takes nothing returns nothing
    local unit u1 = GetTriggerUnit()
    local player uo = GetOwningPlayer(u1)
    local real r = 0
    local player ou = GetOwningPlayer(u1)
    local location loc = OffsetLocation(GetUnitLoc(u1), 300, 250)
    local unit u
loop
    exitwhen r > 360
    set u = CreateUnit(uo,'u000',loc,20,r)
    call UnitApplyTimedLife(u, 'BTLF', 0.20)
    call IssuePointOrderLoc(u, "shockwave", loc )
    set r = r + 36
    endloop
endfunction
//===========================================================================
function InitTrig_Spell takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition(trig, Condition( function SpellAct )   )
    call TriggerAddAction( trig, function Trig_Spell_Actions )
endfunction


"Intended" it. Maybe.

Nevermind. It doesnt do anyhing. Nothing.
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Jesus Christ, you sound like a raving mad man with your repeated chantings of "Nothing".

call TriggerAddCondition(trig, Condition( function SpellAct ) ) <-- your SpellAct function and Trig_SpellActions are topsy turvy, switch the 2 functions' names.

Get rid of either ou or uo, you don't need both
Try giving your variables names that people can understand.

I don't know what kind of spell you're trying but you're using your variables in a REALLY funny way..
If you're trying to get some kind of Circle around the hero and ordering the dummies to shockwave outwards..

Then your code is going to need a lot more work.
A lot.

Why don't you start by telling us what you intended to do?
 

Chaos_Knight

New Member
Reaction score
39
Jesus Christ, you sound like a raving mad man with your repeated chantings of "Nothing".

call TriggerAddCondition(trig, Condition( function SpellAct ) ) <-- your SpellAct function and Trig_SpellActions are topsy turvy, switch the 2 functions' names.

Get rid of either ou or uo, you don't need both
Try giving your variables names that people can understand.

I don't know what kind of spell you're trying but you're using your variables ina REALLY funny way..
If you're trying to get some kind of Circle around the hero and ordering the dummies to shockwave outwards..

Then your code is going to need a lot more work.
A lot.

Why don't you start by telling us what you intended to do?

Read first post.
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
I DID Read the first post.
You only mentioned "Dummy Spell"

Am I supposed to develop special powers to decipher what Dummy Spell really means?

I know you want to make a dummy spell.
But please go into the specifics.

What is the trigger supposed to achieve?

We know the following:
01) Trigger fires when a player's unit casts a spell ('A000')
02) The trigger has something to do with circles
03) The trigger has something to do with shockwaves
04) The trigger has something to do with more than one dummy unit ('u000')
05) The trigger has something to do with the caster's relative position

I may sound like I am trolling but, really, we need more info. from you.
"Help us, help you" as someone would say
 

Chaos_Knight

New Member
Reaction score
39
I DID Read the first post.
You only mentioned "Dummy Spell"

Am I supposed to develop special powers to decipher what Dummy Spell really means?

I know you want to make a dummy spell.
But please go into the specifics.

What is the trigger supposed to achieve?

We know the following:
01) Trigger fires when a player's unit casts a spell ('A000')
02) The trigger has something to do with circles
03) The trigger has something to do with shockwaves
04) The trigger has something to do with more than one dummy unit
05) The trigger has something to do with the caster's relative position

I may sound like I am trolling, but really, we need more info. from you.
"Help us, help you" as someone would say

Okay, im explaining. Just dont blame me like that. Please

The Water Elemental pushes his power out of him and creating dummies, as they casts Shockwaves( with crushing wave model ) at location in front of him, and dealing damage. The dummies is created in a ring around him and they casts the spell in a straight line.

Did you understand?

Creates dummies in a ring ( 36 of them ), and they are orderd to casts shockwaves in a straight line, dealing damage.
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
C = caster
D = dummy
. = Empty space
T = Target point

So, it'll look like this?

D D D
D C D <--- Around the caster
D D D

And they all target here:

D D D.........T
D C D.........T
D D D.........T

Straight-line in front of caster, yea?
Or do you want

T........T........T
.....................
......D D D......
T....D C D......T
......D D D.......
......................
T........T.........T

First or second option?
 

Chaos_Knight

New Member
Reaction score
39
C = caster
D = dummy
. = Empty space
T = Target point

So, it'll look like this?

D D D
D C D <--- Around the caster
D D D

And they all target here:

D D D.........T
D C D.........T
D D D.........T

Straight-line in front of caster, yea?
Or do you want

T........T........T
.....................
......D D D......
T....D C D......T
......D D D.......
......................
T........T.........T

First or second option?

I want them to target the second option
T........T........T
.....................
......D D D......
T....D C D......T
......D D D.......
......................
T........T.........T
That one :D
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Free-handing this, but I do hope you have NewGen to correct any mistakes I may make.

JASS:
scope AwesomeTsunamiOfFreakinDeath initializer CrushWaveInit
   
   globals
      private constant integer SpellID = &#039;A000&#039;
      private constant integer SHOCKWAVEID = &#039;A001&#039;
      private constant integer DummyID = &#039;u001&#039;
      private constant integer DUMMYAMOUNT = 30
      private constant real DISTANCEFROMCASTER = 100.00
   endglobals


   
   private function CrushWaveAct takes nothing returns nothing
      local integer i = 0
      local unit caster = GetTriggerUnit()
      local real rad = GetUnitFacing(caster) * bj_DEGTORAD
      local player playcast = GetTriggerPlayer()
      local unit dummy
      local real radIncrease = ((3.14159265)*2) / DUMMYAMOUNT

      local real DummyX = GetUnitX(caster) + (DISTANCEFROMCASTER) * Cos(rad)
      local real DummyY = GetUnitY(caster) + (DISTANCEFROMCASTER) * Sin(rad)

      loop
      exitwhen i == DUMMYAMOUNT + 1
         set dummy = CreateUnit(playcast, DummyID, DummyX, DummyY, (rad) * bj_RADTODEG)
         call UnitAddAbility(dummy, SHOCKWAVEID)
         call IssuePointOrder(dummy, &quot;shockwave&quot;, GetUnitX(caster) + (DISTANCEFROMCASTER+100) * Cos(rad), GetUnitY(caster) + (DISTANCEFROMCASTER+100) * Sin(rad))
         call UnitApplyTimedLife(dummy, &#039;BTLF&#039;, 0.20)
         set dummy = null
      
         set rad = rad + radIncrease
         set DummyX = GetUnitX(caster) + (DISTANCEFROMCASTER) * Cos(rad)
         set DummyY = GetUnitY(caster) + (DISTANCEFROMCASTER) * Sin(rad)
      set i = i+1
      endloop
   endfunction




   private function CrushWaveCond takes nothing returns boolean
      return GetSpellAbilityId() == SpellID
   endfunction

   private function CrushWaveInit takes nothing returns nothing
      local trigger t = CreateTrigger()
      local integer i = 0

      loop
      exitwhen i == 12
         call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
      set i = i+1
      endloop

      call TriggerAddCondition(t, Condition(function CrushWaveCond))
      call TriggerAddAction(t, CrushWaveAct)
   endfunction

endscope


I think that should do it, I haven't tested it, but, if you want to know why sth is the way it is in this trigger, just ask.

Oh, and you need an extra trigger that removes the killed dummies, I think
 

Chaos_Knight

New Member
Reaction score
39
Free-handing this, but I do hope you have NewGen to correct any mistakes I may make.

JASS:

scope AwesomeTsunamiOfFreakinDeath initializer CrushWaveInit
   
   globals
      private constant integer SpellID = &#039;A000&#039;
      private constant integer SHOCKWAVEID = &#039;A001&#039;
      private constant integer DummyID = &#039;u001&#039;
      private constant integer DUMMYAMOUNT = 30
      private constant real DISTANCEFROMCASTER = 100.00
   endglobals


   
   private function CrushWaveAct takes nothing returns nothing
      local integer i = 0
      local unit caster = GetTriggerUnit()
      local real rad = GetUnitFacing(caster) * bj_DEGTORAD
      local player playcast = GetTriggerPlayer()
      local unit dummy
      local real radIncrease = ((3.14159265)*2) / DUMMYAMOUNT

      local real DummyX = GetUnitX(caster) + (DISTANCEFROMCASTER) * Cos(rad)
      local real DummyY = GetUnitY(caster) + (DISTANCEFROMCASTER) * Sin(rad)

      loop
      exitwhen i == DUMMYAMOUNT + 1
         set dummy = CreateUnit(playcast, DummyID, DummyX, DummyY, (rad) * bj_RADTODEG)
         call UnitAddAbility(dummy, SHOCKWAVEID)
         call IssuePointOrder(dummy, &quot;shockwave&quot;, GetUnitX(caster) + (DISTANCEFROMCASTER+100) * Cos(rad), GetUnitY(caster) + (DISTANCEFROMCASTER+100) * Sin(rad))
         call UnitApplyTimedLife(dummy, &#039;BTLF&#039;, 0.20)
         set dummy = null
      
         set rad = rad + radIncrease
         set DummyX = GetUnitX(caster) + (DISTANCEFROMCASTER) * Cos(rad)
         set DummyY = GetUnitY(caster) + (DISTANCEFROMCASTER) * Sin(rad)
      set i = i+1
      endloop
   endfunction




   private function CrushWaveCond takes nothing returns boolean
      return GetSpellAbilityId() == SpellID
   endfunction

   private function CrushWaveInit takes nothing returns nothing
      local trigger t = CreateTrigger()
      local integer i = 0

      loop
      exitwhen i == 12
         call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
      set i = i+1
      endloop

      call TriggerAddCondition(t, Condition(function CrushWaveCond))
      call TriggerAddAction(t, CrushWaveAct)
   endfunction

endscope


I think that should do it, I haven't tested it, but, if you want to know why sth is the way it is in this trigger, just ask.

Oh, and you need an extra trigger that removes the killed dummies, I think
¨
Can you just fast tell me how to implent it?

+rep btw :D
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
I have created a monster =/

I typed all that so that you would look through and ask what certain things did, not ask for a way to implement them without learning =(

Just create a new trigger and convert it to custom text.
Delete everything in the trigger and copy + paste this whole code in.

Then, modify the "private constant" values you see over there.
Do make the effort to look at the code and see if anything is wrong =/
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top