• 🏆 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 not functioning properly

Status
Not open for further replies.
Level 3
Joined
Apr 5, 2010
Messages
31
This spell is meant to create a flow of water to a target point where an illusion of the hero shall spawn at the time when water arrives. The illusion's strength is based on hero's watery illusion ability.

However, the wave damages multiple times to the same unit and the illusion is not forming. Can some one tell me how to fix these triggers? Help very much appreciated.


  • GiganticBillow Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Gigantic Billow Test
    • Actions
      • Set GB_Caster = (Triggering unit)
      • Set GB_Level = (Level of Gigantic Billow Test for (Triggering unit))
      • Set GB_WILevel = (Level of Watery Illusion for (Triggering unit))
      • Set GB_SpellDMG = (100.00 + (125.00 x (Real(GB_Level))))
      • Set GB_CasterLoc = (Position of (Triggering unit))
      • Set GB_TargetLoc = (Target point of ability being cast)
      • Set GB_Angle = (Angle from GB_CasterLoc to GB_TargetLoc)
      • Unit - Create 1 Nagadummy for (Owner of (Triggering unit)) at GB_CasterLoc facing GB_Angle degrees
      • Animation - Change (Last created unit)'s vertex coloring to (0.00%, 50.00%, 100.00%) with 50.00% transparency
      • Set GB_Dummy = (Last created unit)
      • Trigger - Turn on GiganticBillow Passing <gen>
  • GiganticBillow Passing
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set GB_DummyLoc = (Position of GB_Dummy)
      • Set GB_EffectLoc = (GB_DummyLoc offset by 40.00 towards GB_Angle degrees)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between GB_DummyLoc and GB_TargetLoc) Greater than or equal to 100.00
        • Then - Actions
          • Special Effect - Create a special effect at GB_EffectLoc using Objects\Spawnmodels\Naga\NagaDeath\NagaDeath.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Move GB_Dummy instantly to GB_EffectLoc
          • Unit Group - Pick every unit in (Units within 150.00 of GB_EffectLoc matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is in GB_DamageAlready) Equal to False)) and ((((Matching unit) belongs to an enemy of (Owner of GB_Caster)) Equal to True) and (((Matching and do (Actions)
            • Loop - Actions
              • Unit Group - Add (Picked unit) to GB_DamageAlready
              • Unit - Cause GB_Caster to damage (Picked unit), dealing GB_SpellDMG damage of attack type Spells and damage type Normal
          • Custom script: call DestroyGroup(bj_lastCreatedGroup)
        • Else - Actions
          • Special Effect - Create a special effect at GB_EffectLoc using Objects\Spawnmodels\Naga\NagaDeath\NagaDeath.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Remove GB_Dummy from the game
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GB_WILevel Greater than 0
            • Then - Actions
              • Unit - Create 1 Dummy for (Owner of GB_Caster) at GB_CasterLoc facing Default building facing degrees
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GB_WILevel Equal to 1
                • Then - Actions
                  • Hero - Create Watery Illuson level 1 and give it to (Last created unit)
                  • Hero - Order (Last created unit) to use (Item carried by (Last created unit) of type Watery Illuson level 1) on GB_Caster
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • GB_WILevel Equal to 2
                    • Then - Actions
                      • Hero - Create Watery Illuson level 2 and give it to (Last created unit)
                      • Hero - Order (Last created unit) to use (Item carried by (Last created unit) of type Watery Illuson level 2) on GB_Caster
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • GB_WILevel Equal to 3
                        • Then - Actions
                          • Hero - Create Watery Illuson level 3 and give it to (Last created unit)
                          • Hero - Order (Last created unit) to use (Item carried by (Last created unit) of type Watery Illuson level 3) on GB_Caster
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • GB_WILevel Equal to 4
                            • Then - Actions
                              • Hero - Create Watery Illuson level 4 and give it to (Last created unit)
                              • Hero - Order (Last created unit) to use (Item carried by (Last created unit) of type Watery Illuson level 4) on GB_Caster
                            • Else - Actions
            • Else - Actions
          • Custom script: call DestroyGroup(udg_GB_DamageAlready)
          • Custom script: call RemoveLocation(udg_GB_CasterLoc)
          • Trigger - Turn off (This trigger)
      • Custom script: call RemoveLocation(udg_GB_DummyLoc)
      • Custom script: call RemoveLocation(udg_GB_EffectLoc)
  • GiganticBillow Move
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • ((Summoned unit) has buff Watery Illusion (Ultimate)) Equal to True
    • Actions
      • Unit - Move (Summoned unit) instantly to GB_TargetLoc, facing GB_Angle degrees
      • Custom script: call RemoveLocation (udg_GB_TargetLoc)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
First of all: "bj_lastCreatedGroup" is NOT set with the ForGroup-action, so you do NOT remove the group-leak. either use "set bj_wantDestroyGroup = true" before the group or use a variable.
Your values are also rather high (move 40 / 0.03 sec might be all right, but it stops 60-100 range before actually reaching the target).

Also, CLEAR the group GB_DamagedAlready... (not destroy, clear).
This is very important, as the second time you try to run the spell, it's adding units to a unit group that doesn't exist. So all units will just get hit multiple times (your first bug maybe?)

I can't see the entire group-statement as it is cut short at the end ("and (((Matching and-").
And I don't really know what "the illusion" is, as you create multiple units and an item.

I suggest you just debug the trigger, that will help you a lot more than you think it will (remember this in the future).
How to debug? Just add game messages everywhere something can go wrong: inside the unit group, show the unit name of the picked unit, in the "else"-section, show GB_Level and GB_WILEVEL, when the dummy should be created, show "Dummy created" etc...
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
call DestroyGroup(bj_lastCreatedGroup)

Having this line in the code will break a lot of GUI functions that depend on it. bj_lastCreatedGroup is always expected to exist, never ever destroyed. If you look in all the blizzard.j functions, you will notice bj_lastCreatedGroup is only ever referenced, never re-created or destroyed.

Most people don't realize that and senselessly create their own global groups or use GroupUtils ENUM_GROUP, all of which is over-the-top and could be done with bj_lastCreatedGroup.

As ap0calypse said, you need to use "set bj_wantDestroyGroup = true" as that actually does something useful.
 
Level 3
Joined
Apr 5, 2010
Messages
31
Everything works perfectly now!:grin: I added call DestroyGroup(bj_lastCreatedGroup) before the pick every unit function, and cleared the group instead of destroying. Also I add the following script when abiltiy starts.
  • Custom script: if udg_GB_DamageAlready == null then
  • Custom script: set udg_GB_DamageAlready = CreateGroup()
  • Custom script: endif
Well the illusion is nothing to worry about... I set the target of the item ability to be enemy only and forgot to change it back.

Thank you for the help. +rep:thumbs_up:
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Apparently, illusion doesn't have an order ID (if you use a simple trigger to show the order of the unit when casting a spell, it remains blank) and I did not find anything amongst the order ID's in the channel-spell either.
Still, it works with items - as long as the dummy as an inventory he can use (hero-like).
 
Status
Not open for further replies.
Top