• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Triggers that aren't working properly

Status
Not open for further replies.
Level 18
Joined
May 11, 2012
Messages
2,103
Here I have triggers for spells I made.

Storm Hammer: Recently, I noticed that this spell doesn't works at first cast, but on second and after it does it's job. I need to know wht causes it to malfunction for first time.

  • Storm Hammer Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Storm Hammer
    • Actions
      • -------- --------------- Set Variables --------------- --------
      • Set MaxIndexStormHammer = (MaxIndexStormHammer + 1)
      • Set StormHammer_TrigUnit[MaxIndexStormHammer] = (Triggering unit)
      • Set StormHammer_TargetUnit[MaxIndexStormHammer] = (Target unit of ability being cast)
      • Set TempPoint = (Position of StormHammer_TrigUnit[MaxIndexStormHammer])
      • Set TempPoint2 = (Position of StormHammer_TargetUnit[MaxIndexStormHammer])
      • -------- --------------- Actions --------------- --------
      • Unit - Create 1 Dummy Storm Hammer for (Owner of StormHammer_TrigUnit[MaxIndexStormHammer]) at TempPoint facing TempPoint2
      • Set StormHammer_Dummy[MaxIndexStormHammer] = (Last created unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MaxIndexStormHammer Equal to 1
        • Then - Actions
          • Trigger - Turn on Storm Hammer Loop <gen>
        • Else - Actions
      • -------- --------------- Clear Leaks --------------- --------
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: set udg_TempPoint = null
      • Custom script: set udg_TempPoint2 = null
  • Storm Hammer Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- --------------- Actions --------------- --------
      • For each (Integer TempInt) from 1 to MaxIndexStormHammer, do (Actions)
        • Loop - Actions
          • -------- --------------- Set Variables --------------- --------
          • Set TempPoint = (Position of StormHammer_Dummy[TempInt])
          • Set TempPoint2 = (Position of StormHammer_TargetUnit[TempInt])
          • -------- --------------- Actions --------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between TempPoint and TempPoint2) Less than or equal to 75.00
            • Then - Actions
              • -------- --------------- Actions --------------- --------
              • Unit - Kill StormHammer_Dummy[TempInt]
              • -------- --------------- Set Variables --------------- --------
              • Set TempUnitGroup = (Units within 350.00 of TempPoint2 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of StormHammer_TrigUnit[TempInt])) Equal to True))))
              • -------- --------------- Actions --------------- --------
              • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
                • Loop - Actions
                  • Unit - Create 1 Dummy Caster for (Owner of StormHammer_TrigUnit[TempInt]) at TempPoint2 facing (Facing of (Picked unit)) degrees
                  • Set TempDummyUnit[1] = (Last created unit)
                  • Unit - Add a 0.50 second Generic expiration timer to TempDummyUnit[1]
                  • Unit - Add Dummy Storm Hammer to TempDummyUnit[1]
                  • Unit - Set level of Dummy Storm Hammer for TempDummyUnit[1] to (Level of Storm Hammer for StormHammer_TrigUnit[TempInt])
                  • Unit - Order TempDummyUnit[1] to Human Mountain King - Storm Bolt (Picked unit)
              • -------- --------------- Clear Leaks --------------- --------
              • Custom script: call DestroyGroup(udg_TempUnitGroup)
              • Custom script: set udg_TempUnitGroup = null
              • -------- --------------- Set Variables --------------- --------
              • Set StormHammer_TrigUnit[TempInt] = StormHammer_TrigUnit[MaxIndexStormHammer]
              • Set StormHammer_TargetUnit[TempInt] = StormHammer_TargetUnit[MaxIndexStormHammer]
              • Set StormHammer_Dummy[TempInt] = StormHammer_Dummy[MaxIndexStormHammer]
              • Set StormHammer_TrigUnit[MaxIndexStormHammer] = No unit
              • Set StormHammer_TargetUnit[MaxIndexStormHammer] = No unit
              • Set StormHammer_Dummy[MaxIndexStormHammer] = No unit
              • Set MaxIndexStormHammer = (MaxIndexStormHammer - 1)
              • Set TempInt = (TempInt - 1)
            • Else - Actions
              • -------- --------------- Set Variables --------------- --------
              • Set TempPoint3 = (TempPoint offset by 25.00 towards (Angle from TempPoint to TempPoint2) degrees)
              • -------- --------------- Actions --------------- --------
              • Unit - Move StormHammer_Dummy[TempInt] instantly to TempPoint3, facing TempPoint2
              • -------- --------------- Clear Leaks --------------- --------
              • Custom script: call RemoveLocation(udg_TempPoint3)
              • Custom script: set udg_TempPoint3 = null
          • -------- --------------- Clear Leaks --------------- --------
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint2)
          • Custom script: set udg_TempPoint = null
          • Custom script: set udg_TempPoint2 = null
      • -------- --------------- Actions --------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MaxIndexStormHammer Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
Fissure: This spell works correctly, but as long as there are no unit in between the line. If there is any unit between the line, that part stays empty, the dummy fissure (Model) is not created. This one I really can't figure out

  • Fissure
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fissure
    • Actions
      • -------- --------------- Set Variables --------------- --------
      • Set TrigUnit = (Triggering unit)
      • Set TempPoint = (Position of TrigUnit)
      • Set TempPoint2 = (Target point of ability being cast)
      • Set TempReal = (Angle from TempPoint to TempPoint2)
      • Set TempDamage[1] = 300.00
      • Set TempDamage[2] = 600.00
      • Set TempDamage[3] = 1200.00
      • Set TempDamage[4] = 2400.00
      • Set TempDamage[5] = 4800.00
      • Set TempInt = (Level of Fissure for TrigUnit)
      • -------- --------------- Actions --------------- --------
      • For each (Integer TempInt) from 1 to 12, do (Actions)
        • Loop - Actions
          • -------- --------------- Set Variables --------------- --------
          • Set TempPoint3 = (TempPoint offset by (100.00 x (Real(TempInt))) towards TempReal degrees)
          • Set TempUnitGroup = (Units within 200.00 of TempPoint3 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of TrigUnit)) Equal to True))))
          • -------- --------------- Actions --------------- --------
          • Special Effect - Create a special effect at TempPoint3 using Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Create 1 Dummy Fissure for (Owner of TrigUnit) at TempPoint3 facing TempReal degrees
          • Unit - Turn collision for (Last created unit) Off
          • Unit - Add a 8.00 second Generic expiration timer to (Last created unit)
          • Unit - Create 1 Dummy Fissure Collision for (Owner of TrigUnit) at TempPoint3 facing TempReal degrees
          • Unit - Add a 8.00 second Generic expiration timer to (Last created unit)
          • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
            • Loop - Actions
              • Unit - Cause TrigUnit to damage (Picked unit), dealing TempDamage[TempInt] damage of attack type Spells and damage type Universal
              • Unit - Create 1 Dummy Caster for (Owner of TrigUnit) at TempPoint3 facing 0.00 degrees
              • Set TempDummyUnit[1] = (Last created unit)
              • Unit - Add a 1.00 second Generic expiration timer to TempDummyUnit[1]
              • Unit - Add Dummy Fissure Stun to TempDummyUnit[1]
              • Unit - Set level of Dummy Fissure Stun for TempDummyUnit[1] to (Level of Fissure for TrigUnit)
              • Unit - Order TempDummyUnit[1] to Neutral - Firebolt (Picked unit)
          • -------- --------------- Clear Leaks --------------- --------
          • Custom script: call RemoveLocation (udg_TempPoint3)
          • Custom script: call DestroyGroup (udg_TempUnitGroup)
          • Custom script: set udg_TempPoint3 = null
          • Custom script: set udg_TempUnitGroup = null
      • -------- --------------- Clear Leaks --------------- --------
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call RemoveLocation (udg_TempPoint2)
      • Custom script: set udg_TempPoint = null
      • Custom script: set udg_TempPoint2 = null
Please respond fast and thank you for taking time to help me :)
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
y r u killing the dummy unit here ?
  • Unit - Kill StormHammer_Dummy[TempInt]
y not just order that unit to cast the storm bolt rather than making countless units. and having them cast it ? spells are better if they only use one dummy unit rather than keep creating them.

u should store this in ur fissure spell.
(Owner of TrigUnit)
remember anything used twice or more should be stored

these variables should be set in an init trigger not in the spell itself.
Set TempDamage[1] = 300.00
Set TempDamage[2] = 600.00
Set TempDamage[3] = 1200.00
Set TempDamage[4] = 2400.00
Set TempDamage[5] = 4800.00

ur problem is most likely the distance. check the numbers with game messages to see if everything is correct.
 
Level 18
Joined
May 11, 2012
Messages
2,103
y r u killing the dummy unit here ?
  • Unit - Kill StormHammer_Dummy[TempInt]
y not just order that unit to cast the storm bolt rather than making countless units. and having them cast it ? spells are better if they only use one dummy unit rather than keep creating them.

u should store this in ur fissure spell.
(Owner of TrigUnit)
remember anything used twice or more should be stored

these variables should be set in an init trigger not in the spell itself.
Set TempDamage[1] = 300.00
Set TempDamage[2] = 600.00
Set TempDamage[3] = 1200.00
Set TempDamage[4] = 2400.00
Set TempDamage[5] = 4800.00

ur problem is most likely the distance. check the numbers with game messages to see if everything is correct.

why create another init trigger when I can set it there cuz it's instant spell...
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,906
why create another init trigger when I can set it there cuz it's instant spell...
You have just said it by yourself. you should take a look at your spell and see that when the caster and target are near, after 0-0.03 seconds it will deal damage...and we don't even know what your dummies and the spell text looks like.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
You have just said it by yourself. you should take a look at your spell and see that when the caster and target are near, after 0-0.03 seconds it will deal damage...and we don't even know what your dummies and the spell text looks like.

that makes no sense wrda. he has posted 2 spells here. he was tlking aobut the second spell which is an instant spell not about the first spell. which is not an instant spell.
 
Level 18
Joined
May 11, 2012
Messages
2,103
u shouldnt keep rewriting data in every spell. its inefficient. make a damage array for each spell then put that in an init trigger.

how inefficient? Very inefficient? possible cause of a crash in multiplayer or game slowdown?
The above is important to me. If so, I'll create more variables, but I try to keep the amount of variables very small because my map is getting bigger and bigger and after few created variables, the size goes up by 3-5 kb and that's much dude for me now :D
 
Level 15
Joined
Oct 18, 2008
Messages
1,588
huh ?
units always leak whether u remove or kill them. thats y its better to use one dummy unit rather than to keep creating them.

removing a unit is less resource-intense, since there is no animation to be played, no model left so show, and many variables can be dumped. As far as I know, killed units remain in the game, leaving a chunk of data, whereas removed units only leave parts of their data, not the entire chunk.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
removing a unit is less resource-intense, since there is no animation to be played, no model left so show, and many variables can be dumped. As far as I know, killed units remain in the game, leaving a chunk of data, whereas removed units only leave parts of their data, not the entire chunk.

yes this is true. but if the spell is made right then u only need to make one dummy unit throughout the entire spell.
its not gonna lag with just that spell running. the more things u have running the more noticeable inefficient triggers will be.
 
Level 15
Joined
Oct 18, 2008
Messages
1,588
Btw to be honest I never liked spells that need a dummy unit to cast things, I prefer avoiding this as long as possible. If no longer possible... Then I just remake the spell to work without it :D I only used dummies for permanent stationary effects but I think I used doodads for that, not sure...
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,906
that makes no sense wrda. he has posted 2 spells here. he was tlking aobut the second spell which is an instant spell not about the first spell. which is not an instant spell.
I'm not talking about the 2nd spell, I'm talking about the FIRST, i don't care about which one he is talking about. He had just a problem with the first spell:
On first cast the AoE stun doesn't occurs, and on second and after, it does.
I don't even get that spell.
 
Level 18
Joined
May 11, 2012
Messages
2,103
yes, in fissure, the distance was problem. When there are unit inbetween, the (100.00 x (Real(TempInt))) doesn't even counts. It goes like this: 100, 200, 300, 1000, 1100, 1200 when there are units...
So, how do I fix it? lol

EDIT: Ok, now I got the dummies to be created, but this time they are not created in a line like they should, instead if a enemy unit is standing there where the dummy should be created, the dummy is moved to the side, instead of the enemy.
 
Last edited:
Status
Not open for further replies.
Top