• 🏆 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!

Please help with this triggered spell

Status
Not open for further replies.
Level 8
Joined
Apr 30, 2009
Messages
338
Hi I am making a spell that looks like it calls lightning bolts down from the sky at random points around the caster, with each bolt damaging an AoE around where it strikes. Here is my trigger in GUI so far:

  • Events
  • Unit - A unit starts the effect of an ability
  • Conditions
  • (Ability being cast) Equal to Writhing Hate
  • Actions
  • Set WrithingHatePos = (Position of (Triggering unit))
  • For each (Integer A) from 1 to 25, do (Actions)
    • Loop - Actions
      • Unit - Create 1 Dummy_WH_Ground for (Triggering Player) at (WrithingHatePos offset by (Random real number between 0.00 and 500.00) towards (Random real number between 0.00 and 360.00) facing Default building facing degrees
      • Unit - Add a 1.00 Generic expiration timer to (Last created unit)
      • Set WrithingHateBolt = (Last Created Unit)
      • Unit - Create 1 Dummy_WH_Air for (Triggering player) at (Position of WrithingHateBolt) facing Default building facing degrees
      • Unit - Hide (Last created unit)
      • Unit - Add a 1.00 Generic expiration timer to (Last created unit)
      • Unit - Set level of Writhing Hate Bolt (Dummy) for (Last created unit) to 1
      • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning WrithingHateBolt
      • Unit - Create 1 Dummy_WH_AOE for (Triggering player) at (Position of WrithingHateBolt) facing Default building facing degrees
      • Unit - Hide (Last created unit)
      • Unit - Add 1.00 a second Generic expiration timer to (Last created unit)
      • Unit - Set level of Writhing Hate AOE (Dummy) for (Last created unit) to (Level of (Ability being cast) for (Triggering unit))
      • Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
      • Wait 0.01 seconds
Notes:
Unit "Dummy_WH_Ground" is a dummy unit with 0 movement height that serves as a marker of where the bolt will hit
Unit "Dummy_WH_Air" is a dummy unit with 1000 movement height that casts a chain lightning spell that bounces 0 times and does 0 damage on the Dummy_WH_Ground, it just is a visiaul effect of a lightning bolt coming from above because I don't like how the "Monsoon" bolt looks
Ability "Writhing Hate Bolt (Dummy)" is the bolt mentioned above
Unit "Dummy_WH_AOE" is a dummy unit that has a thunderclap spell which does the actual AoE damage of the bolt
Ability "Writhing Hate AOE" is the AoE mentioned above

Questions:
I have a lighting effect and a target effect for the bolt, but only the lighting effect (finger of death - a red bolt of lightning connecting caster and target) is shown. There is also no sound when the bolt fires (even though there is sound and a target effect for normal chain lightning). Is this because the dummy unit has no model?
Although the "Wait" between executions is 0.01 seconds, this does not happen. I know there is a problem with triggered waits, can you direct me to a tutorial on making exact waits?
The thunderclap spell also has its visual effect but no sound playing, how do I fix this?
IMPORTANT: If the triggering unit gains a level during the spell, the bolts all stop! What's causing this?
 
Level 13
Joined
Sep 14, 2008
Messages
1,407
1. Min wait time is 0.27! Everything below that is changed to 0.27
Use a periodic trigger instead!

3. Trigger the damage with: Unit - make triggering unit to deal damage to area.
4. WAAAA LEAKS! Remove them!
5. The stop could resolve from the "set level to (level for ability being cast) of triggering unit.. I dunno what happens if that changes during the trigger.
 
Level 8
Joined
Apr 30, 2009
Messages
338
Yes but with a periodic trigger could I still eventually convert it to local variables? How could I save the position of the caster without it being global then?

So to fix leaks, I basically have to set every location and unit used to a variable and then set to null?

If I use triggered damage, then all the spells would just be used for visual effects - is this efficient?
 
Level 8
Joined
Apr 30, 2009
Messages
338
Well when it's global I can only have one instance of the spell going at a time.
 
Level 8
Joined
Apr 30, 2009
Messages
338
Ok, so in order to have less than 0.27 seconds between each bolt, I must use 1 trigger when the spell is cast in order to run another periodic trigger that will actually fire the bolts.

The problem is that there may be multiple instances of the spell cast at a given time, so I would have to use local variables. Since there are 2 triggers, I can't. Is there a way around this?
 
Level 3
Joined
Sep 11, 2004
Messages
63
Ok, so in order to have less than 0.27 seconds between each bolt, I must use 1 trigger when the spell is cast in order to run another periodic trigger that will actually fire the bolts.

The problem is that there may be multiple instances of the spell cast at a given time, so I would have to use local variables. Since there are 2 triggers, I can't. Is there a way around this?
Maybe having global array[number of players] of temporary position/caster unit variables will work,assuming you can only have one unit of that type per player..
 
Level 8
Joined
Apr 30, 2009
Messages
338
Is there a function to take the Array index and use it as an integer... like if I have a unit type array that's like

Unit Type[1] = Crypt Lord
Unit Type[2] = Firelord
Unit Type[3] = Pandaren Brewmaster

And the triggering unit is a Crypt Lord, can I somehow get the integer 1 from a function on (Triggering Unit) like

get_arrayindex(Unit Type(Triggering Unit)) or something?
 
Level 3
Joined
May 3, 2009
Messages
41
  • Melee Initialization
    • Events
    • Conditions
    • Actions
      • Set get_arrayindex[(Integer((String((Number of units in (Units owned by (Owner of (Triggering unit)) of type (Unit-type of (Triggering unit))))))))] = (Triggering unit)
Do you mean like that?
 
Level 3
Joined
Sep 11, 2004
Messages
63
Is there a function to take the Array index and use it as an integer... like if I have a unit type array that's like

Unit Type[1] = Crypt Lord
Unit Type[2] = Firelord
Unit Type[3] = Pandaren Brewmaster

And the triggering unit is a Crypt Lord, can I somehow get the integer 1 from a function on (Triggering Unit) like

get_arrayindex(Unit Type(Triggering Unit)) or something?
Make a UnitType index look-up array and make a function to get index by looping through look-up array comparing Unit Type.
 
Level 12
Joined
Aug 22, 2008
Messages
911
Click me, you must
This is a spell pack I submitted, what you need is Rain of Doom - the same thing just with infernos falling near the caster. The lightning AOE can be a unit ability Thunder Clap with different models and everything, just like you did here. As for the lightning effects - you can create one from the caster to each dummy casting the spells, I just can't think of a way of how to remove them after an amount of time.
EDIT: On second thought, you can also make a dummy at the position of the caster that will chain lightning an unlocusted unit at the random point.
 
Status
Not open for further replies.
Top