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

[Trigger] Energy Fissure Help!

Status
Not open for further replies.
Level 17
Joined
Feb 11, 2011
Messages
1,860
Sup guys,

I am making a spell for a boss that creates a fissure at the targeted location. It then sends out three pulses (each going further than the previous) and they burn mana of anyone they hit. I am having trouble with the trigger:

  • Creates Fissure
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to 4.3 Energy Fissure
    • Actions
      • Set Temp_Point = (Target point of ability being cast)
      • Unit - Create 1 Energy Fissure for (Owner of (Triggering unit)) at Temp_Point facing Default building facing degrees
      • Set Energy_Fissure_Effect = (Last created unit)
      • Wait 1.00 seconds
      • Set Temp_Point = (Position of Energy_Fissure_Effect)
      • Set Temp_Point_2 = (Temp_Point offset by 100.00 towards 0.00 degrees)
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Temp_Point facing Default building facing degrees
      • Unit - Add Energy Pulse [dummy] to (Last created unit)
      • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm Temp_Point_2
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Set Temp_Point_2 = (Temp_Point offset by 100.00 towards 90.00 degrees)
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Temp_Point facing Default building facing degrees
      • Unit - Add Energy Pulse [dummy] to (Last created unit)
      • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm Temp_Point_2
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Set Temp_Point_2 = (Temp_Point offset by 100.00 towards 180.00 degrees)
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Temp_Point facing Default building facing degrees
      • Unit - Add Energy Pulse [dummy] to (Last created unit)
      • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm Temp_Point_2
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Set Temp_Point_2 = (Temp_Point offset by 100.00 towards 270.00 degrees)
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Temp_Point facing Default building facing degrees
      • Unit - Add Energy Pulse [dummy] to (Last created unit)
      • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm Temp_Point_2
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Set Temp_Integer = 1
      • Set Temp_Unit_Group = (Units within 600.00 of Temp_Point matching (((Owner of (Matching unit)) Not equal to Player 12 (Brown)) and ((Owner of (Matching unit)) Not equal to Neutral Passive)))
      • Unit Group - Pick every unit in Temp_Unit_Group and do (Actions)
        • Loop - Actions
          • Set Temp_Unit = (Picked unit)
          • Trigger - Burns Mana <gen> (checking conditions)
      • Custom script: call DestroyGroup(udg_Temp_Unit_Group)
      • Custom script: call RemoveLocation(udg_Temp_Point)
      • Custom script: call RemoveLocation(udg_Temp_Point_2)
      • Custom script: call RemoveLocation(udg_Temp_Point_3)
      • Wait 2 seconds
      • Unit - Kill Energy_Fissure_Effect
  • Burns Mana
    • Events
    • Conditions
    • Actions
      • Set Temp_Point_3 = (Position of Temp_Unit)
      • Wait ((Distance between Temp_Point and Temp_Point_3) / 300.00) seconds
      • Unit - Set mana of Temp_Unit to ((Mana of Temp_Unit) - ((Real(Temp_Integer)) x 100.00))
      • Special Effect - Create a special effect attached to the origin of Temp_Unit using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
      • Special Effect - Destroy (Last created special effect)
What am I doing wrong? Thanks for any help!

Notes:
- Energy_Fissure_Effect is a unit which looks like a purple void (it has the Locust ability).
- Energy Pulse is an ability based on Carrion Swarm (just for effect; changed green wave to purple wave).
- There is just one of the three pulses shown here; when I get the one right I will do the others.

- Mr_Bean
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
This trigger leaks locations a lot since you don't remove those before setting new one. By the way, why don't you use loop for help you with multiple unit creation?

  • For each Integer i from 1 to 4 do Actions
    • Loop - Actions
      • Set Temp_Point_2 = (Temp_Point offset by 100.00 towards (i x 90) degrees)
      • Unit - Create 1 Dummy for (Triggering player) at Temp_Point2 facing Default building facing degrees
      • Unit - Add Energy Pulse [dummy] to (Last created unit)
      • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm Temp_Point_2
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_Temp_Point_2)
Additionaly: if you create unit just for an effect, it's better to replace it with special effect since it takes up much less memory.
Use (Triggering player) instead of (Owner of (Triggering unit)).

EDIT: What are you trying to archieve via Burn Mana trigger? Right now (considering that you pick all units in group) it must be a completely mess :D
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
Thanks Spinnaker! The reason for using a unit for an effect is this: if I create the effect it is half above ground and half below ground (meaning you can only see half of it). I used a unit because I could set its height.

Haha, my triggers for this ability were a mess!

How would I now trigger it to burn each unit's mana once the wave arrives at them? I was using:

  • Wait ((Distance between Temp_Point and Temp_Point_3) / 500.00) seconds


Where:

- Temp_Point is the position of the effect.
- Temp_Point_3 is the position of the unit.
- 500 is the missile speed of the wave.

Thanks,

- Mr_Bean
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Instead of wait use loop with time event (every 0.03-0.05 seconds), and calculate if distance between 'wave' and gives unit is small enought to burn it's mana. Although it requires 'wave' to be dummy unit too (just set it's model to dreallord's carrior swarm. This way forces you to trigger damage caused as well, right next to the mana burn.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Requires Unit Indexer.

Set global variable as missle speed eg: like you said 500.
Use array real to set distance.
After creating dummy unit (as carrior wave) use:
  • Set key = (Custom value of (Last created unit))
  • Set r[key] = <distance here, like 700>
  • Unit - Add (Last created unit) to CarriorGroup
  • loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CarriorGroup and do Actions
        • Loop - Actions
          • Set key = (Custom value of (Picked unit))
          • If (All conditions are true) then do (Then - actions) else do (Else - Actions)
            • If - Conditions
              • r[key] Greater than 0
            • Then - Actions
              • Set p = (Position of (Picked unit))
              • Set p2 = (p offset by CarriorSpeed/200 towards (Facing of (Picked unit)) degrees)
              • Unit - Move (Picked unit) instantly to p2
              • Custom script: set bj_wantDestroyGroup = true
              • <here you pick enemy units around to deal damage/burn mana>
              • <add them to somekind of global prevention group so they won't be damaged many times, remove them quickly afterwards>
              • Set r[key] = r[key] - CarriorSpeed/200
              • Custom script: call RemoveLocation(udg_p)
              • Custom script: call RemoveLocation(udg_p2)
            • Else - Actions
              • Unit - Add 0.1 Generic expiration timer to (Picked unit)
              • Unit Group - Remove (Picked unit) from CarriorGroup
 
Status
Not open for further replies.
Top