• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Multi shoot spell

Status
Not open for further replies.
Level 25
Joined
Jul 10, 2006
Messages
3,315
Loop integer_a from 1 to 4
Loop actions:
set loc1 = position of caster
set loc2 = loc1 offset by 100 towards (90 * real(integer_a))
unit - create dummy caster at loc1
unit - add carrion swarm to last created unit
unit - order last created unit to carrion swarm loc2
custom script: call RemoveLocation(udg_loc1) (do the same for loc2)
 
Level 4
Joined
Jan 2, 2015
Messages
41
  • asdfr
    • Events
      • Unit - Paladin 0001 <gen> Begins casting an ability
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set loc1 = (Position of (Casting unit))
          • Set loc2 = (loc1 offset by 100.00 towards (Real((Integer A))) degrees)
          • Unit - Create 1 dummy caster for Player 1 (Red) at loc1 facing Default building facing degrees
          • Unit - Add Carrion Swarm to (Last created unit)
          • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm loc2
          • Custom script: call RemoveLocation(udg_loc1)
          • Custom script: call RemoveLocation(udg_loc2)

It wont work. What have I done wrong?
 
Level 9
Joined
Apr 23, 2011
Messages
527
  • asdfr
    • Events
      • Unit - Paladin 0001 <gen> Begins casting an ability
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set loc1 = (Position of (Casting unit))
          • Set loc2 = (loc1 offset by 100.00 towards (Real((Integer A))) degrees)
          • Unit - Create 1 dummy caster for Player 1 (Red) at loc1 facing Default building facing degrees
          • Unit - Add Carrion Swarm to (Last created unit)
          • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm loc2
          • Custom script: call RemoveLocation(udg_loc1)
          • Custom script: call RemoveLocation(udg_loc2)

It wont work. What have I done wrong?

i think you forgot to multiply (Real((Integer A))) by 90.
 
Level 4
Joined
Jan 2, 2015
Messages
41
  • Actions
    • For each (Integer A) from 1 to 4, do (Actions)
      • Loop - Actions
        • Set loc1 = (Position of (Casting unit))
        • Set loc2 = (loc1 offset by 100.00 towards (90.00 x (Real((Integer A)))) degrees)
        • Unit - Create 1 dummy caster for Player 1 (Red) at loc1 facing Default building facing degrees
        • Unit - Add Carrion Swarm to (Last created unit)
        • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm loc2
        • Custom script: call RemoveLocation(udg_loc1)
        • Custom script: call RemoveLocation(udg_loc2)
Still nothing (If I did it like it should be done)...
 
Level 4
Joined
Jan 2, 2015
Messages
41
It creates 4 units around paladin and nothing else happens. I tried this:

  • asdfr
    • Events
      • Unit - Paladin 0001 <gen> Begins casting an ability
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set loc1 = (Position of (Casting unit))
          • Set loc2 = (loc1 offset by 100.00 towards (90.00 x (Real((Integer A)))) degrees)
          • Unit - Add Carrion Swarm to Paladin 0001 <gen>
          • Unit - Order Paladin 0001 <gen> to Undead Dreadlord - Carrion Swarm loc2
      • Custom script: call RemoveLocation(udg_loc2)
      • Custom script: call RemoveLocation(udg_loc1)
And it cast one carrion swarm at 0/360 degrees
 
Level 18
Joined
May 11, 2012
Messages
2,103
Change the event into A unit Start the effect of an ability.
Move loc1 outside loop and put it in the beggining of the trigger and change casting unit to triggering unit.
Create 1 dummy unit at that loc1 for (Triggering Player).
Create new TempDummyUnit variable and set last created unit to that variable.
Add that ability to TempDummyUnit.
Change Integer A into udg_variable (create new TempInt variable of type integer and use that).
Change loc2 to (Real(TempInt)*90 degrees).
Remove that line where you add ability to paladin.
Order temp dummy unit to cast carrion swarm at loc2.
Move cleaning location (loc2) inside loop at the end.
Done.

Why this does not work is because paladin has cast point (.300 i believe) and ot takes him some time to cast the spell. When you order him to cast this 4 times, he starts casting, but immediately he is ordered to cast it again.
The dummy unit has 0 casting point, so he has time to cast spell all 4 times.
 
Level 4
Joined
Jan 2, 2015
Messages
41
Im starting to feel really dump... Doesnt work again:

  • asdfr
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set loc1 = (Position of (Triggering unit))
      • For each (Integer Tempint) from 1 to 4, do (Actions)
        • Loop - Actions
          • Unit - Create 1 dummycaster (Custom Campaign) for (Triggering player) at loc1 facing Default building facing degrees
          • Set Tempdummyunit = (Last created unit)
          • Unit - Add Carrion Swarm to Tempdummyunit
          • Set loc2 = (loc1 offset by 100.00 towards ((Real(Tempint)) x 90.00) degrees)
          • Unit - Order Tempdummyunit to Undead Dreadlord - Carrion Swarm loc2
          • Custom script: call RemoveLocation(udg_loc2)
      • Custom script: call RemoveLocation(udg_loc1)
Game just shuts down right before the ability should create the effect.
 
Level 18
Joined
May 11, 2012
Messages
2,103
Add condition ((Ability Being Cast) Equal to (Your Ability)).
Move the first three lines in loop right before the loop, between loc1 var and loop action.
Add 0.50 seconds expiration timer to TempDummyUnit (right after TempDummyUnit variable).

Your game freezes due to the event recursion. This condition that you will add will prevent event from reoccuring infinitely many times.
 
Level 9
Joined
Apr 23, 2011
Messages
527
having the same issue as pravda here, so i decided to post this here.
i remade the trigger with GUI using your suggestions, but it doesn't work too.

  • Ravage
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to spell
    • Actions
      • Set temp_point[1] = (Position of (Triggering unit))
      • Unit - Create 1 dummy for (Triggering player) at temp_point[1] facing Default building facing degrees
      • Set temp_unit = (Last created unit)
      • Unit - Add a 0.50 second Generic expiration timer to temp_unit
      • Unit - Add dummyspell to temp_unit
      • Unit - Set level of dummyspell for temp_unit to (Level of spell for (Casting unit))
      • For each (Integer loop) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set temp_point[2] = (temp_point[1] offset by 100.00 towards (45.00 x (Real(loop))) degrees)
          • Unit - Order temp_unit to Orc Tauren Chieftain - Shockwave temp_point[2]
      • Custom script: call RemoveLocation( udg_temp_point[1] )
      • Custom script: call RemoveLocation( udg_temp_point[2] )
also, how do you make a loop that makes the spell fire in a cone?
 
Level 18
Joined
May 11, 2012
Messages
2,103
What exactly isn't working? Describe the problem when you encounter one.

If your dummy unit has exactly 0 casting point, try setting it to 0.001.
Make sure your "dummyspell" has 0 manacost and 0 cooldown.

If you want to make that, then I suggest making this trigger without the loop.
I will try to describe it because I can't give you trigger because I'm on phone and in school.
So, new trigger should look something like this:

  • Set TempTrigUnit = (TriggeringUnit)
  • Set TempPoint = (Position of (TempTrigUnit))
  • Set TempPoint2 = (TempPoint offset by 100.00 towards (Facing of (TempTrigUnit + 180) degrees)
  • Unit - Create 1 (Dummy Unit) at TempPoint for (Triggering Player) facing (Facing of (TempTrigUnit + 180) degrees)
  • Set TempDummyUnit = (Last Created Unit)
  • Unit - add (0.50) seconds expiration timer to TempDummyUnit
  • Unit - Add (dummyspell) to TempDummyUnit
  • Unit - Set Level of (dummyspell) for TempDummyUnit to (Level of spell for (TempTrigUnit))
  • Unit - Order TempDummyUnit to Orc Tauren Chieftain - Shockwave TempPoint2
  • call RemoveLocation(udg_TempPoint2)
  • Set TempTrigUnit = (TriggeringUnit)
  • Set TempPoint = (Position of (TempTrigUnit))
  • Set TempPoint2 = (TempPoint offset by 100.00 towards (Facing of (TempTrigUnit + 225) degrees)
  • Unit - Create 1 (Dummy Unit) at TempPoint for (Triggering Player) facing (Facing of (TempTrigUnit + 225) degrees)
  • Set TempDummyUnit = (Last Created Unit)
  • Unit - add (0.50) seconds expiration timer to TempDummyUnit
  • Unit - Add (dummyspell) to TempDummyUnit
  • Unit - Set Level of (dummyspell) for TempDummyUnit to (Level of spell for (TempTrigUnit))
  • Unit - Order TempDummyUnit to Orc Tauren Chieftain - Shockwave TempPoint2
  • call RemoveLocation(udg_TempPoint2)
  • Set TempTrigUnit = (TriggeringUnit)
  • Set TempPoint = (Position of (TempTrigUnit))
  • Set TempPoint2 = (TempPoint offset by 100.00 towards (Facing of (TempTrigUnit + 135) degrees)
  • Unit - Create 1 (Dummy Unit) at TempPoint for (Triggering Player) facing (Facing of (TempTrigUnit + 135) degrees)
  • Set TempDummyUnit = (Last Created Unit)
  • Unit - add (0.50) seconds expiration timer to TempDummyUnit
  • Unit - Add (dummyspell) to TempDummyUnit
  • Unit - Set Level of (dummyspell) for TempDummyUnit to (Level of spell for (TempTrigUnit))
  • Unit - Order TempDummyUnit to Orc Tauren Chieftain - Shockwave TempPoint2
  • call RemoveLocation(udg_TempPoint2)
  • call RemoveLocation(udg_TempPoint)
  • set udg_TempPoint = null
  • set udg_TempPoint2 = null
  • set udg_TempDummyUnit = null
  • set udg_TempTrigUnit = null
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Since there seem to be problems setting things up, I made the spell on my own.

Here is the trigger I used:
  • Carrion Wave
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Carrion Wave (Hero version)
    • Actions
      • Set p1 = (Position of (Triggering unit))
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at p1 facing Default building facing degrees
      • Set dummy = (Last created unit)
      • Unit - Add Carrion Wave (Dummy version) to dummy
      • For each (Integer loop_var) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set p2 = (p1 offset by 100.00 towards (90.00 x (Real(loop_var))) degrees)
          • Unit - Order dummy to Undead Dreadlord - Carrion Swarm p2
          • Custom script: call RemoveLocation(udg_p2)
      • Unit - Remove dummy from the game
      • Custom script: call RemoveLocation(udg_p1)
To prevent any confusion, let me say that this does work.

There is more to it than the trigger tho. For anyone interested, I advise that you take a good look at how I set up the unit "Dummy" (the only custom unit-type in the map) - all the fields I edited are important (more or less) for smooth game run and for correct execution of the trigger above.
Also take a look at the only two custom abilities. Dummy version is standard Carrion Swarm, but look at how I set it up. Also look at how I set up the hero version which is based off "channel" ability.
I attached the map with the spell below.

Also notice: The first time you use the spell a small lag occurs (hardly noticeable) - that is not due to how the spell is set up, but due to units and abilities loading for the first time.


Attached map:
 

Attachments

  • CarrionWaveSpell.w3x
    18.4 KB · Views: 43
Level 4
Joined
Jan 2, 2015
Messages
41
I tried this and it finally works.

  • asdfr
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • Set loc1 = (Position of (Triggering unit))
      • Unit - Create 1 dummycaster (Custom Campaign) for (Triggering player) at loc1 facing Default building facing degrees
      • Set Tempdummyunit = (Last created unit)
      • Unit - Add a 0.50 second Generic expiration timer to Tempdummyunit
      • Unit - Add Carrion Swarm to Tempdummyunit
      • For each (Integer Tempint) from 1 to 4, do (Actions)
        • Loop - Actions
          • Unit - Create 1 dummycaster (Custom Campaign) for (Triggering player) at loc1 facing Default building facing degrees
          • Set Tempdummyunit = (Last created unit)
          • Unit - Add a 0.50 second Generic expiration timer to Tempdummyunit
          • Unit - Add Carrion Swarm to Tempdummyunit
          • Set loc2 = (loc1 offset by 100.00 towards (90.00 x (Real(Tempint))) degrees)
          • Unit - Order Tempdummyunit to Undead Dreadlord - Carrion Swarm loc2
          • Custom script: call RemoveLocation(udg_loc2)
      • Custom script: call RemoveLocation(udg_loc1)
Thank you all for help.
 
Level 18
Joined
May 11, 2012
Messages
2,103
I tried this and it finally works.

  • asdfr
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • Set loc1 = (Position of (Triggering unit))
      • Unit - Create 1 dummycaster (Custom Campaign) for (Triggering player) at loc1 facing Default building facing degrees
      • Set Tempdummyunit = (Last created unit)
      • Unit - Add a 0.50 second Generic expiration timer to Tempdummyunit
      • Unit - Add Carrion Swarm to Tempdummyunit
      • For each (Integer Tempint) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set loc2 = (loc1 offset by 100.00 towards (90.00 x (Real(Tempint))) degrees)
          • Unit - Order Tempdummyunit to Undead Dreadlord - Carrion Swarm loc2
          • Custom script: call RemoveLocation(udg_loc2)
      • Custom script: call RemoveLocation(udg_loc1)
This trigger is just okay.
No need to create 4 dummy units inside loop when you already created 1 outside that can cast all 4 carrion swarms.
 
Status
Not open for further replies.
Top