• 🏆 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] Copying A Trigger

Status
Not open for further replies.
Level 9
Joined
Apr 4, 2004
Messages
519
I'm currently trying to copy over a spell from a spellpack into my map, but for some reason I get an error when copying the last trigger. If it is of any help I'll post the whole trigger here and link to the spellpack I'm trying to get it from.

  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • Set Group[1] = (Units of type Capacitor Dummy)
    • Unit Group - Pick every unit in Group[1] and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Capacitor_Move[(Custom value of (Picked unit))] Equal to True
          • Then - Actions
            • Set Unit[1] = (Picked unit)
            • Set Point[1] = (Position of (Picked unit))
            • Set Point[2] = (Point[1] offset by 24.00 towards (Facing of (Picked unit)) degrees)
            • Unit - Move (Picked unit) instantly to Point[2]
            • Set Capacitor_Range[(Custom value of (Picked unit))] = (Capacitor_Range[(Custom value of (Picked unit))] + 24.00)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • Then - Actions
            • Unit - Remove (Picked unit) from the game
            • Special Effect - Create a special effect at Point[2] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
            • Special Effect - Destroy (Last created special effect)
            • Set Group[3] = (Units within 350.00 of Point[2] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A ground unit) Equal to True) and (((Triggering unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True
            • Unit Group - Pick every unit in Group[3] and do (Actions)
              • Loop - Actions
                • Set Point[3] = (Position of (Picked unit))
                • Unit - Cause Capacitor_Unit[(Custom value of Unit[1])] to damage (Picked unit), dealing (100.00 x Capacitor_Time_2[(Custom value of Unit[1])]) damage of attack Spells and damage type Lightning
                • Special Effect - Create a special effect at Point[3] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
                • Special Effect - Destroy (Last created special effect)
                • Custom script: call RemoveLocation (udg_Point[3])
              • Custom script: call DestroyGroup (udg_Group[3])
            • Else - Actions
          • Set Group[2] = (Units within 100.00 of Point[2] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A ground unit) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True
          • Unit Group - Pick every unit in Group[2] and do (Actions)
            • Loop - Actions
              • Set Group[3] = (Units within 350.00 of Point[2] matching ((((Matching unit) is A structure Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A ground unit) Equal to True) and (((Matching unit) belongs to an ally of (Owner of (Picked unit))) Equal to True
              • Unit Grop - Pick every unit in Group[3] and do (Actions)
                • Loop - Actions
                  • Special Effect - Create a special effect at Point[2] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Set Point[3] = (Position of (Picked unit))
                  • Unit - Remove Unit[1] from the game
                  • Unit - Cause Capacitor_Unit[(Custom value of Unit[1])] to damage (Picked unit), dealing (100.00 x Capacitor_Time_2[(Custom value of Unit[1])]) damage of attack type Spells and damage type Lightning
                  • Special Effect - Crate a special effect at Point[3] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation (udg_Point[3])
              • Custom script: call DetroyGroup (udg_Group[3])
          • Custom script: call DestroyGroup (udg_Group[2])
          • Custom script: call RemoveLocation (udg_Point[1])
          • Custom script: call RemoveLocation (udg_Point[2])
          • Set Unit[1] = No unit
        • Else - Actions
    • Custom script: call DestroyGroup (udg_Group[1])
Now, that's how the trigger that won't work looks like, and here's the error message I get when trying to save the map/start it while it's enabled.

Code:
    call UnitDamageTargetBJ( udg_Capacitor_Unit[GetUnitUserData(udg_Unit[1])], GetEnumUnit(), ( 100.00 * udg_Capacitor_Time_2[GetUnitUserData(udg_Unit[1])] ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING )

If there's something I've forgotten to show that you need to know let me know and I'll put it up asap. Also, here is the spellpack I'm trying to copy it from.

Thanks in advance.
 
Level 9
Joined
Apr 4, 2004
Messages
519
Tried making the variables myself and putting them in, no luck there. =/ Any other suggestions?
 
Level 2
Joined
Feb 22, 2009
Messages
24
  • Set Capacitor_Range[(Custom value of (Picked unit))] = (Capacitor_Range[(Custom value of (Picked unit))] + 24.00)
Every Unit has ONE Custom Value that can be used for various purposes...

Looks like your Spell uses it. Problem is: When another trigger also uses this attribute of the unit then one of those triggers get the wrong values and dont work properly.
The problem can also be that you have to set the Custom Value to an specific value b4 using the spell. You have to find out that by yourself ;)
 
Status
Not open for further replies.
Top