HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger Help Please

03-26-2007, 05:31 AM#1
MaxwellEliasForbes
I used Ant's tutorial for keyboard movement. I believe I followed the steps well, but it doesn't seem to work. When I press the up arrow key it moves my unit closer to the center of the map. When I press both a right or left arrow and an up arrow it doesn't turn and move. While the left and right arrow do turn the unit it turns it for a short amount and then stops turning it. When the unit finally does reach the center of the map the up arrow stops doing anything. Any ideas on what's going on? I could post screen shots of my triggers if asked to.
03-26-2007, 07:16 AM#2
Jazradel
Right click on your trigger, choose copy as text and paste the triggers in [trigger] tags.
03-26-2007, 11:20 PM#3
MaxwellEliasForbes
K this good?

Detect Arrow key Presses
Hidden information:
Trigger:
Collapse P1DetectUpOn
Collapse Events
Player - Player 1 (Red) Presses the Up Arrow key
Conditions
Collapse Actions
Set P1Up = 1
Trigger - Run MoveForward <gen> (checking conditions)
Trigger - Run MoveLeft <gen> (checking conditions)
Trigger - Run MoveRight <gen> (checking conditions)
Collapse P1DetectUpOff
Collapse Events
Player - Player 1 (Red) Releases the Up Arrow key
Conditions
Collapse Actions
Set P1Up = 0
Unit - Order P1Ship to Stop
Collapse P1DetectLeftOn
Collapse Events
Player - Player 1 (Red) Presses the Left Arrow key
Conditions
Collapse Actions
Set P1Left = 1
Trigger - Run MoveForward <gen> (checking conditions)
Trigger - Run MoveLeft <gen> (checking conditions)
Trigger - Run MoveRight <gen> (checking conditions)
Collapse P1DetectLeftOff
Collapse Events
Player - Player 1 (Red) Releases the Left Arrow key
Conditions
Collapse Actions
Set P1Left = 0
Collapse P1DetectRightOn
Collapse Events
Player - Player 1 (Red) Presses the Right Arrow key
Conditions
Collapse Actions
Set P1Right = 1
Trigger - Run MoveForward <gen> (checking conditions)
Trigger - Run MoveLeft <gen> (checking conditions)
Trigger - Run MoveRight <gen> (checking conditions)
Collapse P1DetectRightOff
Collapse Events
Player - Player 1 (Red) Releases the Right Arrow key
Conditions
Collapse Actions
Set P1Right = 0
Collapse P1DetectDownOn
Collapse Events
Player - Player 1 (Red) Presses the Down Arrow key
Conditions
Collapse Actions
Set P1Down = 1
Trigger - Run MoveForward <gen> (checking conditions)
Trigger - Run MoveLeft <gen> (checking conditions)
Trigger - Run MoveRight <gen> (checking conditions)
Collapse P1DetectDownOff
Collapse Events
Player - Player 1 (Red) Releases the Down Arrow key
Conditions
Collapse Actions
Set P1Down = 0


Moving
Hidden information:
Trigger:
Collapse MoveForward
Collapse Events
Time - Every 0.20 seconds of game time
Collapse Conditions
P1Up Equal to 1
P1Down Equal to 0
P1Left Equal to 0
P1Right Equal to 0
Collapse Actions
Unit - Order P1Ship to Move To ((Center of (Playable map area)) offset by 200.00 towards (Facing of P1Ship) degrees)
Collapse MoveLeft
Collapse Events
Time - Every 0.20 seconds of game time
Collapse Conditions
P1Up Equal to 0
P1Down Equal to 0
P1Left Equal to 1
P1Right Equal to 0
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
P1Up Equal to 1
Collapse Then - Actions
Unit - Order P1Ship to Move To ((Center of (Playable map area)) offset by 200.00 towards ((Facing of P1Ship) + 15.00) degrees)
Collapse Else - Actions
Unit - Make P1Ship face ((Position of P1Ship) offset by 100.00 towards 15.00 degrees) over 0.10 seconds
Collapse MoveRight
Collapse Events
Time - Every 0.20 seconds of game time
Collapse Conditions
P1Up Equal to 0
P1Down Equal to 0
P1Left Equal to 0
P1Right Equal to 1
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
P1Up Equal to 1
Collapse Then - Actions
Unit - Order P1Ship to Move To ((Center of (Playable map area)) offset by 200.00 towards ((Facing of P1Ship) - 15.00) degrees)
Collapse Else - Actions
Unit - Make P1Ship face ((Position of P1Ship) offset by 100.00 towards -15.00 degrees) over 0.10 seconds
03-27-2007, 04:01 AM#4
Dil999
Trigger:
Unit - Order P1Ship to Move To ((Center of (Playable map area)) offset by 200.00 towards ((Facing of P1Ship)) + 15.00) degrees)

If you didnt want it to move to center of playable map area, why does it say Move to Center of playable map area.

You want this:
Trigger:
Unit - Order P1Ship to Move To ((Position of (P1Ship))) offset by 200.00 towards ((Facing of P1Ship)) + 15.00) degrees)

And doing +15 degrees whill make it move to an angle of whee its facing.
Hope that solves your problem.
03-27-2007, 06:26 AM#5
MaxwellEliasForbes
k thanks... srry for the stupid question i should have paid more attention to my triggers
03-27-2007, 07:10 PM#6
Dil999
No problem, i do it all the time :O
08-27-2007, 04:21 PM#7
djat
Sorry to bumb a dead thread, but since I have a question about the same tutorial, I see no reason to create a new one :P
Anyway, I've solved the problem with the laggy movement when you use low values to make it smooth, by adding a "play animation" action to the Press forward key. Unfortunaly, it seems that it just works the first time you walk forward, next time it goes back to the lag-style. Maybe I need to remove the normal animations in some way? I've tried, but without succes. This is the triggers:

Trigger:
Press Up
Collapse Events
Player - Player 1 (Red) Presses the Up Arrow key
Conditions
Collapse Actions
Set Up = 1
Animation - Play Archmage 0000 <gen>'s walk animation
Trigger - Run Move Forward <gen> (checking conditions)
Trigger - Run Turn Left <gen> (checking conditions)
Trigger - Run Turn Right <gen> (checking conditions)

and the release one:

Trigger:
Release Up
Collapse Events
Player - Player 1 (Red) Releases the Up Arrow key
Conditions
Collapse Actions
Set Up = 0
Animation - Play Archmage 0000 <gen>'s stand animation
Help? :P
EDIT: I've also tried with reset units animations instead of play stand animation, but it doesnt seem to work either way.
08-29-2007, 01:49 PM#8
Vexorian
I think you have to queue the animation.

I prefer SetUnitAnimationById , it is much easier to predict its behaviour than the normal animation function