• 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] What did I do wrong about this trigger?

Status
Not open for further replies.
Level 18
Joined
Aug 23, 2008
Messages
2,319
I've made a trigger
  • Sighted
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set Unit1 = Unit 0000 <gen>
      • Set Unit2 = Unit 0012 <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Facing of Unit2) Greater than or equal to 200.00
          • (Facing of Unit2) Less than or equal to 280.00
          • (Current movement speed of Unit1) Greater than or equal to 2.00
        • Then - Actions
          • Animation - Play Unit2's attack animation
          • Floating Text - Create floating text that reads Grrrrr... above Hedgehog1 with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Unit - Unpause Unit1
          • Unit - Set Unit1 movement speed to (Default movement speed of Frog1)
          • Animation - Change Unit1's animation speed to 100.00% of its original speed
          • Unit - Order Unit1 to Move To (Center of Unit1 start Player 1 <gen>)
          • Wait 1.00 seconds
          • Floating Text - Destroy (Last created floating text)
        • Else - Actions
          • Do nothing

Unit1 is a unit that when this trigger activates, he has:
0% animation speed
Movement speed = 1
Paused

Unit2 is a unit that when this trigger activation, he has:
Facing angle between 200 and 280 (as mentioned in the conditions)

Gameplay Constants were set to give units a minimum movement speed of 1.

When Player 1 presses the Up Arrow key (another trigger), Unit1 has for 0.10 seconds:
100% animation speed
Movement speed = default (50)
Unpaused

After that, the unit goes back to the stats he had when this trigger got activated.


So I think this trigger should cause the actions to be executed when the unit faces 200-280 degrees and the player presses the Up Arrow key.
But for some reason this trigger always activates when Unit2 faces between 200 and 280 degrees, even when Player 1 didn't press the Up Arrow key, and thus the movement speed of Unit1 is 1. There are no other triggers that change the movement speed of Unit1.
What did I do wrong about this trigger? Everything works except these conditions.
 
Level 10
Joined
Aug 15, 2008
Messages
448
Well, if I understood right your trigger I have a pair of suggestions for you:
1-Add TRIGGER - (turn off (this trigger)) at the beginning of your THEN actions and then a TRIGGER - (turn on (this trigger)) in the end of the THEN actions: since you set the event to start every 0.01 you don't leave time to your units to execute their actions.
2-Try adding these triggers - UP is an integer variable
  • Check player movement
    • Events
      • Player 1 presses ARROW UP
    • Conditions
    • Actions
      • Set UP = 1
  • Check player movement 2
    • Events
      • Player 1 releases ARROW UP
    • Conditions
    • Actions
      • Set UP = 0
Then add in your trigger's conditions (the IF-THEN-ELSE one) this one
  • Conditions
    • UP is equal to 1
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
That would cause the trigger to activate when the button is pushed. There's a small time of movement of Unit1 when I press the Up Arrow key. I want the trigger to also activate when the unit is moving.

That turn off part is a pretty good idea. Thanks :)
 
Level 10
Joined
Aug 15, 2008
Messages
448
I didn't mean to put only the condition I told you. Try to add my condition to the already existing yours:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Facing of Unit2) Greater than or equal to 200.00
      • (Facing of Unit2) Less than or equal to 280.00
      • (Current movement speed of Unit1) Greater than or equal to 2.00
      • (UP) is equal to 1
My condition should prevent the trigger to happen even if you don't press the UP ARROW.
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
That's the point. When I release the button, UP is equal to 0, so the trigger won't activate, but the unit is still moving. So UP should not change to 0 until the movement speed and animation speed are at 0 again and is paused (which is all done automatically 0.10 seconds after pushing the Up Arrow key)
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
This is strange. My new trigger is
  • Sighted
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set Unit1 = Unit 0000 <gen>
      • Set Unit2 = Unit 0012 <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Facing of Unit2) Greater than or equal to 200.00
          • (Facing of Unit2) Less than or equal to 280.00
          • UP Equal to 1
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Animation - Play Unit2's attack animation
          • Floating Text - Create floating text that reads Grrrrr... above Unit2 with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Unit - Unpause Unit1
          • Unit - Set Unit1 movement speed to 400.00
          • Animation - Change Unit1's animation speed to 100.00% of its original speed
          • Unit - Order Unit1 to Move To (Center of Unit1 start Player 1 <gen>)
          • Wait 1.50 seconds
          • Floating Text - Destroy (Last created floating text)
          • Unit - Make Unit1 face 60.00 over 0.50 seconds
          • Unit - Order Unit1 to Move To (Center of Frog destination Player 1 <gen>)
          • Animation - Change Unit1's animation speed to 0.00% of its original speed
          • Unit - Set Unit1 movement speed to 1.00
          • Unit - Pause Unit1
          • Unit - Make Unit2 face 60.00 over 0.50 seconds
          • Game - Display to Player Group - Player 1 (Red) the text: Let's try again
          • Trigger - Turn on (This trigger)
        • Else - Actions
          • Do nothing
It goes all well, until it comes at
  • Unit - Unpause Unit1
  • Unit - Set Unit1 movement speed to 400.00
  • Animation - Change Unit1's animation speed to 100.00% of its original speed
This is a part he doesn't execute. The UP trigger (not variable) is effecting here. At this point, Unit1 should run back with a movement speed of 400. But for some reason, I need to press the Up Arrow key to make him move 0.10 seconds towards that point. Why does that trigger effect this one?
 
Level 10
Joined
Aug 15, 2008
Messages
448
First of all, you should set the two variables (UNIT1 and UNIT2) in another trigger with a MAP INITIALIZATION/ELAPSED GAME TIME IS 0.01 SECONDS: setting the two variables every 0.01 seconds is not necessary.
Second: try to deactivate all of your previous movement trigger (movement with the UP key / No movement (pause/animationspeed=0) and then reactivate them in the end of the trigger (like the trigger itself, with its TURN OFF/ON THIS TRIGGER); maybe they start again and then "reset" the unit movement...
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
Ok, done the variable thing. I think I've done that second thing already:
  • Move
    • Events
      • Player - Player 1 (Red) Presses the Up Arrow key
    • Conditions
    • Actions
      • Set MOVE = 1
      • Set Queue[1] = (Queue[1] + 1)
      • Unit - Unpause Unit1
      • Unit - Set Unit1 movement speed to (Default movement speed of Frog1)
      • Animation - Change Unit1's animation speed to 100.00% of its original speed
      • Wait 0.10 seconds
      • Set Queue[1] = (Queue[1] - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Queue[1] Equal to 0
        • Then - Actions
          • Animation - Change Unit1's animation speed to 0.00% of its original speed
          • Unit - Set Unit1 movement speed to 1.00
          • Unit - Pause Unit1
          • Set MOVE = 0
        • Else - Actions
Unless this is not what you meant.
 
Level 10
Joined
Aug 15, 2008
Messages
448
[sorry, I didn't see your post because I was using Warcraft III for testing my map =)]

No, what I mean is that you should modify the Sighted trigger, adding some TRIGGER - TURN OFF at the beginning and some TRIGGER - TURN ON in the end, deactivating and reactivating (in the end) triggers like the MOVE one, so you don't get bothered while your unit returns to the starting position.
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
  • Sighted
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set Unit1 = Unit 0000 <gen>
      • Set Unit2 = Unit 0012 <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Facing of Unit2) Greater than or equal to 200.00
          • (Facing of Unit2) Less than or equal to 280.00
          • UP Equal to 1
        • Then - Actions
          • Trigger - Turn off Move <gen>
          • Trigger - Turn off (This trigger)
          • Animation - Play Unit2's attack animation
          • Floating Text - Create floating text that reads Grrrrr... above Unit2 with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Unit - Unpause Unit1
          • Unit - Set Unit1 movement speed to 400.00
          • Animation - Change Unit1's animation speed to 100.00% of its original speed
          • Unit - Order Unit1 to Move To (Center of Unit1 start Player 1 <gen>)
          • Wait 1.50 seconds
          • Floating Text - Destroy (Last created floating text)
          • Unit - Make Unit1 face 60.00 over 0.50 seconds
          • Unit - Order Unit1 to Move To (Center of Frog destination Player 1 <gen>)
          • Animation - Change Unit1's animation speed to 0.00% of its original speed
          • Unit - Set Unit1 movement speed to 1.00
          • Unit - Pause Unit1
          • Unit - Make Unit2 face 60.00 over 0.50 seconds
          • Game - Display to Player Group - Player 1 (Red) the text: Let's try again
          • Trigger - Turn on (This trigger)
          • Trigger - Turn on Move <gen>
        • Else - Actions
          • Do nothing
That's what you mean, right? I've turned off the trigger that causes the unit to move when I press the Up Arrow key (Move <gen>), but when he's supposed to go back, he only turns around, and after 1.50 seconds he's moving to the destination region again.
Also during those 1.50 seconds, I cannot move the unit with the Up Arrow key, so that part worked.
 
Level 10
Joined
Aug 15, 2008
Messages
448
Ok, you need to explain me the trigger a little better. If I understood well, you move UNIT1 (a frog) with the UP arrow and try not to be spotted by UNIT2 (some kind of enemy). If you get spotted the frog run away to its first location (UNIT1STARTPLAYER1) and then, after 1.5 seconds, it turns to the right angle so it can restart. I don't understand what is the FROG DESTINATION PLAYER 1 (what makes it different from the previous region?); also, you should tell me about ANY other trigger you've made (a short description is enough - for now I know the SIGHTED, MOVE AND TURN - should be the first one you asked help for - triggers) so I can have a better overall view of what you want to do and so what are you doing wrong.
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
I'll send you the complete map that's probably easier. I don't think there are any copyrights attached to it, because it is based on a very common game (I believe the name of that game in english is 'green light, red light')

FROG DESTINATION PLAYER 1 is the region where Unit1 is supposed to be headed. Once Unit1 entered there, the game is won.
 

Attachments

  • The sneaky Frog and the Scoundrel.w3x
    2.8 MB · Views: 38
Level 10
Joined
Aug 15, 2008
Messages
448
Ok. Anyway, here's my work. I've used the movement system I told you before and it actually seems to be good, I've encountered just a pair of little problems. Check it out, I put the EDITED tag so you can compare it with your version; I'll try to do a better one with your movement system.

P.S.: if I understood well I know the game you're talking about, but I don't think that you can move only for short distances; actually, you move for short distances because the "enemy" turns around frequently, but you can move as long as you want: you just don't have to be seen...

[EDIT]
I've uploaded a new version. There are both step by step and continuous movement, you can switch them by pressing enter and typing: "-CHANGEMOVEMENT"; I've also included some instructions in the world editor when you decide which movement type to use. Tell me if you find bugs, errors, etc...
 

Attachments

  • The sneaky Frog and the ScoundrelEDITED2.w3x
    2.8 MB · Views: 28
Last edited:
Level 18
Joined
Aug 23, 2008
Messages
2,319
Yes, there are just 2 things.
1) I do need the movement to be 0.10 seconds of movement when you press the Up Arrow key.
2) When you press the Up Arrow key while the unit is facing you, your don't start over. You just stay faced towards the screen and pressing the Up Arrow key doesn't cause anything to happen. It means you have to start the whole thing over.

Why wouldn't it be possible to make the 0.10 second trigger work in the Sighted trigger? I guess that if there really is no possibility, I'll just keep with the press and hold trigger and use your map.
 
Level 10
Joined
Aug 15, 2008
Messages
448
Did you try the EDITED2 version? I need to know if the second problem (which I encountered too) is still there.
And, about the movement type, I'm not saying that the step by step movement type can't be done; I'm just saying that a continuous movement would be better. Anyway, like I said in the previous post, you can select the movement type by yourself.
 
Status
Not open for further replies.
Top