• 🏆 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] Why dosen't this work ?

Status
Not open for further replies.
Level 2
Joined
Jun 10, 2010
Messages
11
  • Rain of Infernals second
    • Events
      • Time - Elapsed game time is 173.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Usual Dummy for Player 12 (Brown) at (Center of Infernal Invaders Postition <gen>) facing Default building facing degrees
      • Unit - Add Inferno (Infernal Invader) to (Last created unit)
      • Unit - Order (Last created unit) to Undead Dreadlord - Inferno (Center of Infernal Invader Infernals Target <gen>)
      • Wait 1.30 seconds
      • Unit - Order (Last created unit) to Undead Dreadlord - Inferno (Random point in Infernal Invader Infernals Target <gen>)
      • Wait 1.30 seconds
      • Unit - Order (Last created unit) to Undead Dreadlord - Inferno (Random point in Infernal Invader Infernals Target <gen>)
      • Wait 1.30 seconds
      • Unit - Order (Last created unit) to Undead Dreadlord - Inferno (Random point in Infernal Invader Infernals Target <gen>)
      • Wait 1.30 seconds
      • Unit - Order (Last created unit) to Undead Dreadlord - Inferno (Random point in Infernal Invader Infernals Target <gen>)
      • Wait 1.30 seconds
      • Unit - Order (Last created unit) to Undead Dreadlord - Inferno (Random point in Infernal Invader Infernals Target <gen>)
      • Wait 1.30 seconds
      • Unit - Order (Last created unit) to Undead Dreadlord - Inferno (Random point in Infernal Invader Infernals Target <gen>)
      • Wait 1.30 seconds
      • Unit - Order (Last created unit) to Undead Dreadlord - Inferno (Random point in Infernal Invader Infernals Target <gen>)
      • Wait 1.30 seconds
      • Unit - Order (Last created unit) to Undead Dreadlord - Inferno (Random point in Infernal Invader Infernals Target <gen>)
      • Wait 1.30 seconds
      • Unit - Order (Last created unit) to Undead Dreadlord - Inferno (Random point in Infernal Invader Infernals Target <gen>)
      • Wait 1.30 seconds
      • Unit - Order (Last created unit) to Undead Dreadlord - Inferno (Random point in Infernal Invader Infernals Target <gen>)
      • Unit - Remove (Last created unit) from the game
can't understand why, but the dummy only casts the spell the first 2 times then stops. the spell's cooldown is 0.7 seconds and the dummy has its attack disabled and the locust ability so i don't think something can interferee with it.
am i missing something ?
 
Ok, here is how you are going to do it:
  • Hash
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
  • One
    • Events
      • Time - Elapsed game time is 173.00 seconds
    • Conditions
    • Actions
      • Custom script: local unit u
      • Custom script: set udg_Unit = CreateUnit (Player(12), 'hfoo', 0, 0 , 0)
      • Unit - Add Inferno to Unit
      • Unit Group - Add Unit to UnitGroup
      • Custom script: set u = udg_Unit
      • Custom script: call SaveInteger (udg_Hash, GetHandleId(u), StringHash("times"), 11)
      • Trigger - Turn on Two <gen>
      • Custom script: set u = null
  • Two
    • Events
      • Time - Every 1.30 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (UnitGroup is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in UnitGroup and do (Actions)
            • Loop - Actions
              • Set Times = (Load (Key times) of (Key (Picked unit)) from Hash)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Times Greater than 0
                • Then - Actions
                  • Set Point1 = (Random point in (Playable map area))
                  • Unit - Order (Picked unit) to Undead Dreadlord - Inferno Point1
                  • Custom script: call RemoveLocation (udg_Point1)
                  • Hashtable - Save (Times - 1) as (Key times) of (Key (Picked unit)) in Hash
                • Else - Actions
                  • Unit Group - Remove (Picked unit) from UnitGroup
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hash
Test Map:
View attachment Inferno Multiple Casts.w3x
 
Level 2
Joined
Jun 10, 2010
Messages
11
works excelent thx man ur my hero :thumbs_up:

im new to this stuff and wanted to ask what was wrong with the first trigger? i mean why didn't it work as i ordered it to do in the trigger, because in the same map i have another trigger like this one i showed and it works perfectly.

it takes kinda long to make a simple thing like this in this way i can't understand why it dosen't work with "waits".


anyway many thanks man, +rep it's all i can do in exchange :(
 
Level 2
Joined
Jun 10, 2010
Messages
11
so... if another unit(footman for ex) is created trough a different trigger after the dummy was created, the "last created unit" in the dummy trigger will refer to the footman ?
an action in a trigger can interfeer with ones in other triggers?

God.... now i have to learn to use variables :cry:
 
That is a possible scenario, not a reason, so, yes, it can be.
You can redirect yourself here: http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/variables-5896/

You also need to know what MUI is: Multi Unit Instanceability, meaning many units to perform same actions/spell casting/events without other units to interfere with their specific functionality, in case the latter ones cast anything after the first one.
 
Level 2
Joined
Jun 10, 2010
Messages
11
well.... there comes a time in a man's life when i has to learn GUI and MUI...

one last question... i don't feel like starting to learn those today cause im kinda' tierd, but until i learn... can u please show me how to clear a variable ?

for example if i set (last created unit) to the variable "unit" , afther i finish doing my job with it how do i clear it so i can use it again in the future ?

just the simple "clear" no other fancy stuff needed :D

(Last created unit) is supposed to work as its a local variable. Your dummy ran out of mana (my guess).
Hope that helps a bit.

nope... the spell uses 0 mana
 
In local variables (Jass, most likely) or indexing systems (e.g. Unit[Integer]), you have to null a unit as
JASS:
local unit u = GetTriggerUnit()
set u = null
and
  • Custom script: set udg_Unit[udg_Integer] = null
or
  • Set Unit[Integer] = No unit
respectively.
It can also be done in GUI via Custom script:
  • Custom script: local unit u = GetTriggerUnit()
  • Custom script: set u = null
In global variables, you don't have to null it; it will replace the new unit with the unit stored in the previous event.
 
Status
Not open for further replies.
Top