[Trigger] Ability Trigger Doesnt Work

Status
Not open for further replies.
Level 6
Joined
Aug 19, 2007
Messages
109
In my castle map i have an ability where when learned, every 40 sec. some units will be created at the keep of the castle and will be ordered to move. At start of map i learned lvl 1 of this ability and w8ed 40 seconds... nothing happened lol. Whats wrong with it?:eekani::cry:
  • Learns 3rd Ability
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Call to Arms (Dummy bash)
    • Actions
      • Trigger - Turn on Periodic Men <gen>
      • Trigger - Turn off (This trigger)
^^^=This activates the 2nd trigger only when ability is learned(ability is passive)
  • Periodic Men
    • Events
      • Time - Every 40.00 seconds of game time
    • Conditions
      • (COTG is alive) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Call to Arms (Dummy bash) for COTG) Equal to 1
        • Then - Actions
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • Set Temp_Point = (Random point in Ability Summon Guards <gen>)
              • Unit - Create 1 Armed Peasent (Captain of the Guard) for Player 9 (Gray) at Temp_Point facing Default building facing degrees
              • Unit - Change color of (Last created unit) to (Color of (Owner of (Ordered unit)))
              • Unit - Order (Last created unit) to Attack-Move To (Random point in Step1 <gen>)
              • Custom script: call RemoveLocation (udg_Temp_Point)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Call to Arms (Dummy bash) for COTG) Equal to 2
            • Then - Actions
              • For each (Integer A) from 1 to 8, do (Actions)
                • Loop - Actions
                  • Set Temp_Point = (Random point in Ability Summon Guards <gen>)
                  • Unit - Create 1 Axeman (Captain of the Guard) for Player 9 (Gray) at Temp_Point facing Default building facing degrees
                  • Unit - Change color of (Last created unit) to (Color of (Owner of (Ordered unit)))
                  • Unit - Order (Last created unit) to Attack-Move To (Random point in Step1 <gen>)
                  • Custom script: call RemoveLocation (udg_Temp_Point)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Call to Arms (Dummy bash) for COTG) Equal to 3
                • Then - Actions
                  • For each (Integer A) from 1 to 6, do (Actions)
                    • Loop - Actions
                      • Set Temp_Point = (Random point in Ability Summon Guards <gen>)
                      • Unit - Create 1 Swordsman (Captain of the Guard) for Player 9 (Gray) at Temp_Point facing Default building facing degrees
                      • Unit - Change color of (Last created unit) to (Color of (Owner of (Ordered unit)))
                      • Unit - Order (Last created unit) to Attack-Move To (Random point in Step1 <gen>)
                      • Custom script: call RemoveLocation (udg_Temp_Point)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Call to Arms (Dummy bash) for COTG) Equal to 4
                    • Then - Actions
                      • For each (Integer A) from 1 to 4, do (Actions)
                        • Loop - Actions
                          • Set Temp_Point = (Random point in Ability Summon Guards <gen>)
                          • Unit - Create 1 Royal Guard (Captain of the Guard) for Player 9 (Gray) at Temp_Point facing Default building facing degrees
                          • Unit - Change color of (Last created unit) to (Color of (Owner of (Ordered unit)))
                          • Unit - Order (Last created unit) to Attack-Move To (Random point in Step1 <gen>)
                          • Custom script: call RemoveLocation (udg_Temp_Point)
                    • Else - Actions
                      • Do nothing
^^^=This is initially off until 1st trigger turns it on.
Note:I tried to make it so only when hero is alive will the units spawn(the first condition) COTG=The unit variable of the hero.
Help plz.:eekani::cry:
 
Level 6
Joined
Aug 19, 2007
Messages
109
Eh what do you mean 'command that sets' COTG is alive=true? Every 40 sec. it checks if COTG is alive and if not then the condition isnt fulfilled and the trigger wont run. Please specify lol im kinda in the dark.:thumbs_up:I have a feeling this is leading to the answer :D.
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
'COTG is alive' is a Variable. You need to have created the variable in a
  • Set COTG is alive = True/False
trigger in order to change the value of 'COTG is alive'. If you don't attach info (in this case True or False) to the variable, your first trigger also can't check if it's set to true or not.

So the solution is to place that Set Variable command in a trigger where it activates before the 'Periodic Man' trigger (where the info is required in the Conditions). This can be the Map Initialization, or (in this case) the 'Learns 3rd Ability' trigger.
 
Level 6
Joined
Aug 19, 2007
Messages
109
Erm how do you do "set COTG is alive = true/false"? when i do "set variable" it just says "set COTG = (last created unit...etc..)" cant have a boolean to set it to. How do I "Attach info" lol?:eekani:


Unimportant:
lol once this seemingly stupid Q of mine is answered by this last reply i know what to do ^^ thx for all ur help! (Answer this reply lol):thumbs_up:
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
Set Variable is attaching info to a variable, so that's what you're doing now.

'COTG' is a different variable then 'COTG is alive'. You need to select the exact same variable as you used in the condition in the 'Periodic Man' trigger. Appearantly, 'COTG' is a Unit variable, and 'COTG is alive' is a boolean, so you get different available info to attach to it. As said: You need to set 'COTG is alive' = True/False. It is there, because it was available in the Conditions in the 'Periodic Man' trigger (Unless you just wrote that trigger instead of Copy as Text, but I doubt that).
 
Level 6
Joined
Aug 19, 2007
Messages
109
Erm i may be mistaken because of that huge chunk of complex complexity of words, but i only have used 1 variable in the whole 2 triggers(excluding Temp_Point) i have only used COTG(The unit variable). The "COTG is alive" condition in 'Periodic Men' trigger, is a boolean comparison, something like
"(If (COTG) is alive) = true" then do...

Note:This may mean nothing to you as your last reply could not be decifered by me XD :eekani:

Erm
Set Variable is attaching info to a variable, so that's what you're doing now.
Ok if that's what im doing then:

'COTG' is a different variable then 'COTG is alive
^^^-It is?:eekani: but their both the Exact same Unit variable?

'COTG is alive' is a boolean
Can you please wrap "Trigger" tags around an example of what ur trying to say plz? about the
'COTG is alive' = True/False

That example wold be a great help in my understanding lol:eek:
If ths Q is answered i give + rep :D
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
Oh wait, I just got it. COTG is a unit and 'COTG is alive' is not a variable (because of the spaces), but it's a Unit Comparison, so (COTG is alive) queal to True is a Boolean Comparison. Sorry, that's a stupid mistake of mine, so forget every post I've made so far.

Is this trigger to give a unit only to Player 9 (Gray)?
Also, you have to change the color changing. There no Ordered Unit, so you can't change the level to the owner of a unit that doesn't exist. Change '(Color of (Owner of (Ordered unit)))' to '(Color of (Owner of (Last created unit)))'

As for the trigger: Do you have access to see what's going on in the Ability Summon Guards region? You'll have to check if the unit is created there at all. If not, then I think the problem can onl be in the COTG unit, so I'll need to know what contains COTG. It might be that the COTG unit is marked dead.
 
Level 6
Joined
Aug 19, 2007
Messages
109
Lol it still dosnt work D: here is updates ver.:
  • Periodic Men
    • Events
      • Time - Every 40.00 seconds of game time
    • Conditions
      • (COTG is alive) Equal to True
    • Actions
      • Game - Display to (All players) the text: 2nd part?
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Call to Arms (Dummy bash) for COTG) Equal to 1
        • Then - Actions
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • Set Temp_Point = (Random point in Ability Summon Guards <gen>)
              • Unit - Create 1 Armed Peasent (Captain of the Guard) for Player 9 (Gray) at Temp_Point facing Default building facing degrees
              • Unit - Change color of (Last created unit) to (Color of (Owner of COTG))
              • Unit - Order (Last created unit) to Attack-Move To (Random point in Step1 <gen>)
              • Custom script: call RemoveLocation (udg_Temp_Point)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Call to Arms (Dummy bash) for COTG) Equal to 2
            • Then - Actions
              • For each (Integer A) from 1 to 8, do (Actions)
                • Loop - Actions
                  • Set Temp_Point = (Random point in Ability Summon Guards <gen>)
                  • Unit - Create 1 Axeman (Captain of the Guard) for Player 9 (Gray) at Temp_Point facing Default building facing degrees
                  • Unit - Change color of (Last created unit) to (Color of (Owner of COTG))
                  • Unit - Order (Last created unit) to Attack-Move To (Random point in Step1 <gen>)
                  • Custom script: call RemoveLocation (udg_Temp_Point)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Call to Arms (Dummy bash) for COTG) Equal to 3
                • Then - Actions
                  • For each (Integer A) from 1 to 6, do (Actions)
                    • Loop - Actions
                      • Set Temp_Point = (Random point in Ability Summon Guards <gen>)
                      • Unit - Create 1 Swordsman (Captain of the Guard) for Player 9 (Gray) at Temp_Point facing Default building facing degrees
                      • Unit - Change color of (Last created unit) to (Color of (Owner of COTG))
                      • Unit - Order (Last created unit) to Attack-Move To (Random point in Step1 <gen>)
                      • Custom script: call RemoveLocation (udg_Temp_Point)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Call to Arms (Dummy bash) for COTG) Equal to 4
                    • Then - Actions
                      • For each (Integer A) from 1 to 4, do (Actions)
                        • Loop - Actions
                          • Set Temp_Point = (Random point in Ability Summon Guards <gen>)
                          • Unit - Create 1 Royal Guard (Captain of the Guard) for Player 9 (Gray) at Temp_Point facing Default building facing degrees
                          • Unit - Change color of (Last created unit) to (Color of (Owner of COTG))
                          • Unit - Order (Last created unit) to Attack-Move To (Random point in Step1 <gen>)
                          • Custom script: call RemoveLocation (udg_Temp_Point)
                    • Else - Actions
                      • Do nothing
Note:COTG owner is same throughout the entire game, yes it only gives units to player 9 grey. Lol, i know that COTG is alive as its the only unit i get to control lol. and yes you have access to see where the units spawn:p.

this updated ver. doesnt seem to work either D: coz i added chat msg to show if it did or not.

Edit: Hmm i think the problem lies in the first part as i didnt see the first part's chat msg either...
  • Learns 3rd Ability
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Call to Arms (Dummy bash)
      • (Learning Hero) Equal to COTG
    • Actions
      • Game - Display to (All players) the text: FIRST PART WORKS
      • Trigger - Turn on Periodic Men <gen>
      • Trigger - Turn off (This trigger)
If i didnt see first part then of course 2nd part wont work D:.
 
Level 6
Joined
Aug 19, 2007
Messages
109
LOLOLOL SORRY ROFL. I found out what was wrong! the variable COTG was never set properly, i put "Set COTG = (Selling Unit)" not (Sold Unit) lol at the start... so that why it never worked:sad:. Soz for all the trouble lol. Just goes to show 1 little itty bitty mistake can cause a whole fuss and trigger to fail D:. +rep anyway for helping me :D
 
Status
Not open for further replies.
Top