• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Jump to random unit problem

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
582
Hi there!
I have a 1 target spell that's supposed to teleport the caster to the target and then pick random unit in 500 aoe, jump to it and so on, and so forth. It's happening with 1,5 secs frequency. There is a limited number of jumps (4/6/8/10/12/14). Each jump the caster attacks a target and deals fixed damage.
First trigger works, so the caster jumps on the target. But the second one doesn't. I can't undestand what I'm doing wrong, but he doesn't jump.
Here are my triggers:

  • Thunder Dance init
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Dance new
    • Actions
      • Set Player_Number_Int = (Player number of (Owner of (Triggering unit)))
      • Set Thunder_Dance_Caster[Player_Number_Int] = (Triggering unit)
      • Set Thunder_Dance_Target[Player_Number_Int] = (Target unit of ability being cast)
      • Set Thunder_Dance_Target_Point[Player_Number_Int] = (Position of Thunder_Dance_Target[Player_Number_Int])
      • Set Thunder_Dance_Damage[Player_Number_Int] = (((25.00 x 1.00) + 0.00) + ((Real((Intelligence of Thunder_Dance_Caster[Player_Number_Int] (Include bonuses)))) x 0.20))
      • Unit - Add Thunder Dance effect to Thunder_Dance_Caster[Player_Number_Int]
      • Custom script: call SetUnitX (udg_Thunder_Dance_Caster[udg_Player_Number_Int], GetLocationX (udg_Thunder_Dance_Target_Point[udg_Player_Number_Int]))
      • Custom script: call SetUnitY (udg_Thunder_Dance_Caster[udg_Player_Number_Int], GetLocationY (udg_Thunder_Dance_Target_Point[udg_Player_Number_Int]))
      • Unit - Order Thunder_Dance_Caster[Player_Number_Int] to Attack Thunder_Dance_Target[Player_Number_Int]
      • Unit - Cause Thunder_Dance_Caster[Player_Number_Int] to damage Thunder_Dance_Target[Player_Number_Int], dealing Thunder_Dance_Damage[Player_Number_Int] damage of attack type Spells and damage type Fire
      • Set Thunder_Dance_Jumps[Player_Number_Int] = (((Level of Thunder Dance new for Thunder_Dance_Caster[Player_Number_Int]) x 2) + 1)
      • Game - Display to (All players) the text: (String(Thunder_Dance_Jumps[Player_Number_Int]))
      • Custom script: call RemoveLocation(udg_Thunder_Dance_Target_Point[udg_Player_Number_Int])
      • Trigger - Turn on Thunder Dance loop <gen>

  • Thunder Dance loop
    • Events
      • Time - Every 1.50 seconds of game time
    • Conditions
    • Actions
      • Set Thunder_Dance_Casters = (Units of type Storm Wizard)
      • Unit Group - Pick every unit in Thunder_Dance_Casters and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Thunder Dance new for (Picked unit)) Greater than 0
            • Then - Actions
              • Set Player_Number_Int = (Player number of (Owner of (Picked unit)))
              • Set Thunder_Dance_Caster[Player_Number_Int] = (Picked unit)
              • Game - Display to (All players) the text: I'm here!
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • Thunder_Dance_Jumps[Player_Number_Int] Greater than 0
                      • (Thunder_Dance_Caster[Player_Number_Int] is alive) Equal to True
                • Then - Actions
                  • Game - Display to (All players) the text: GO
                  • Set Thunder_Dance_Caster_Point[Player_Number_Int] = (Position of Thunder_Dance_Caster[Player_Number_Int])
                  • Set Thunder_Dance_Group[Player_Number_Int] = (Units within 500.00 of Thunder_Dance_Caster_Point[Player_Number_Int] matching ((((Matching unit) belongs to an enemy of (Owner of Thunder_Dance_Caster[Player_Number_Int])) Equal to True) and ((((Matching unit) is A structure) Not equal to True) and ((((Match
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Thunder_Dance_Group[Player_Number_Int] is empty) Not equal to True
                    • Then - Actions
                      • Unit Group - Pick every unit in Thunder_Dance_Group[Player_Number_Int] and do (Actions)
                        • Loop - Actions
                          • Set Thunder_Dance_Picked = (Random unit from Thunder_Dance_Group[Player_Number_Int])
                          • Set Thunder_Dance_Picked_Point = (Position of Thunder_Dance_Picked)
                          • Unit - Turn collision for Thunder_Dance_Caster[Player_Number_Int] Off
                          • Unit - Move Thunder_Dance_Caster[Player_Number_Int] instantly to Thunder_Dance_Picked_Point, facing Thunder_Dance_Picked_Point
                          • Unit - Turn collision for Thunder_Dance_Caster[Player_Number_Int] On
                          • Custom script: call RemoveLocation(udg_Thunder_Dance_Picked_Point)
                          • Unit - Order Thunder_Dance_Caster[Player_Number_Int] to Attack Thunder_Dance_Picked
                          • Unit - Cause Thunder_Dance_Caster[Player_Number_Int] to damage Thunder_Dance_Picked, dealing Thunder_Dance_Damage[Player_Number_Int] damage of attack type Spells and damage type Fire
                          • Set Thunder_Dance_Jumps[Player_Number_Int] = (Thunder_Dance_Jumps[Player_Number_Int] - 1)
                          • Game - Display to (All players) the text: (String(Thunder_Dance_Jumps[Player_Number_Int]))
                    • Else - Actions
                      • Unit - Remove Thunder Dance effect from Thunder_Dance_Caster[Player_Number_Int]
                      • Set Thunder_Dance_Jumps[Player_Number_Int] = 0
                  • Custom script: call DestroyGroup(udg_Thunder_Dance_Group[udg_Player_Number_Int])
                  • Custom script: call RemoveLocation(udg_Thunder_Dance_Caster_Point[udg_Player_Number_Int])
                • Else - Actions
                  • Unit - Remove Thunder Dance effect from Thunder_Dance_Caster[Player_Number_Int]
                  • Set Thunder_Dance_Jumps[Player_Number_Int] = 0
                  • Game - Display to (All players) the text: you're dead
            • Else - Actions
      • Custom script: call DestroyGroup(udg_Thunder_Dance_Casters)
 
Last edited:
Level 10
Joined
Mar 17, 2012
Messages
582
did you set Thunder_Dance_Jumps>0 for your loop? it wont fire if this variable is 0.

Do you mean not to leave "0 default" value? or to set it in triggers? Because I did. By the way, I started tracing the mistake. I even changed Integer variable Thunder_Dance_Jumps to Real and here's how it works:
I set variable, show message im game and it shows me pretty weird figures:
Screenshot
Screenshot

Ah, my bad, first value of Thunder_Dance_Jumps is correct, I forgot that I changed it to see what happens :D

Update:
Screenshot
 
Last edited:
Level 10
Joined
Mar 17, 2012
Messages
582
probably other trigger interferes, are you using DDS? or maybe trigger with event "unit takes damage"?, I guess in such trigger your variable is reseted to "1"
actually no, I don't use it anywhere else. What I did is not very perfect solution, but I removed damage from initial trigger and added 1 extra jump :D now it deals damage in the loop trigger only...
 
  • tr1
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Set playerNrInt = 3
      • Game - Display to (All players) the text: (A: + (String(playerNrInt)))
      • Unit - Cause Far Seer 0068 <gen> to damage Far Seer 0068 <gen>, dealing 20.00 damage of attack type Spells and damage type Normal
      • Game - Display to (All players) the text: (B: + (String(playerNrInt)))
  • tr2
    • Events
      • Unit - Far Seer 0068 <gen> Takes damage
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (C: + (String(playerNrInt)))
      • Set playerNrInt = 0
      • Game - Display to (All players) the text: (D: + (String(playerNrInt)))

and.. in game debug messages order is..:
dmg.jpg

see how your dds can mess variable?
 
Level 10
Joined
Mar 17, 2012
Messages
582
  • tr1
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Set playerNrInt = 3
      • Game - Display to (All players) the text: (A: + (String(playerNrInt)))
      • Unit - Cause Far Seer 0068 <gen> to damage Far Seer 0068 <gen>, dealing 20.00 damage of attack type Spells and damage type Normal
      • Game - Display to (All players) the text: (B: + (String(playerNrInt)))
  • tr2
    • Events
      • Unit - Far Seer 0068 <gen> Takes damage
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (C: + (String(playerNrInt)))
      • Set playerNrInt = 0
      • Game - Display to (All players) the text: (D: + (String(playerNrInt)))

and.. in game debug messages order is..:
View attachment 265350
see how your dds can mess variable?


and what happens if you remove these http://prntscr.com/ewrmgy ?

Screenshot
 
and what happens if you remove these Screenshot ?
oh come on, you know it will be fine then....

I'm trying to say how your variable can change right after applying damage:
you are manipulating Thunder_Dance_Jumps or/and Player_Number_Int outside your Thunder Dance trigger. In DDS trigger probably where you overwrite variable. Go to Object Manager (F11) and check where you're using these 2 vars.
 
Level 10
Joined
Mar 17, 2012
Messages
582
oh come on, you know it will be fine then....

I'm trying to say how your variable can change right after applying damage:
you are manipulating Thunder_Dance_Jumps or/and Player_Number_Int outside your Thunder Dance trigger. In DDS trigger probably where you overwrite variable. Go to Object Manager (F11) and check where you're using these 2 vars.

You see, I manipulate Thunder_Dance_Jumps only in these two triggers:
Screenshot
Generally I know how indexing works and all my previous attemts to do similar triggers were successfull. But this situation is really misterious. Anyway, I bypassed this bug, adding one extra jump in Loop and removed "Deal damage" action from the initialisation trigger... It's not a solution, but it suits me...
 
Status
Not open for further replies.
Top