PDA

View Full Version : Waypoint condition scripting



nutbar
Nov 16 2001, 09:15
Ok, slightly annoying and hard to figure out since I'm new to this... but when do the waypoint condition tests kick in?

To me so far, it seems they kick in once the unit arrives at the waypoint, rather than a more logical "IF the condition passes, THEN go to the waypoint".  So far it's not a really big deal since I just place a waypoint with my condition tests right near the units... but for tanks and such, they waste fuel because they start their engines once the map loads.  This isn't a good thing for a long mission - the tanks run out of fuel http://www.flashpoint1985.com/ikonboard3/non-cgi/emoticons/sad.gif

Is there any way to have a unit not move at all from the beginning until my waypoint conditions are met?

Eg: M1A1 unit, 1st waypoint is to MOVE to a town (if my_alarm == true), then SAD as a 2nd waypoint.  Normally the tank will go to the 1st waypoint, and then stop - only to SAD once my_alarm == true.  I want it to not move at all, and then go to it's 1st waypoint if my_alarm == true.

I sort of have this accomplished elsewhere, by placing an empty truck, and having a group of troops get in the truck only when my_alarm == true, so the truck basically can't go anywhere until the guys get in the truck... but then, that means they AREN'T acting the same as my tanks (the troops go nowhere until their 1st waypoint condition is met).  I know this is true because I went in-game and watched them.

Space Cadet
Nov 16 2001, 10:30
Groups will move to a waypoint, and then not move to the next until the expression in the condition field of the first waypoint is true.

eg two waypoints
waypoint 1
condition Not(Alive EastOfficer)

waypoint 2
condition TRUE

the group will move to waypoint 1 and stay until a unit called EastOfficer is dead, they will then move to waypoint2.

A chain of waypoint can only have one "active" waypoint and the next waypoint in the chain can't be "active" until.

1) the group are within the radius of the waypoint

AND

2) the expression in the condition field of the waypoint results in TRUE.

If you dont want a unit to move at the start of a mission, the first waypoint should be placed directly over the starting position of the group leader, and change the Condition field to a variable eg "Phase2"

then when you want the group to move just add the line
Phase2 = true in the trigger, script waypoint or whatever you use to call in the group.

With vehicles you could try starting the unit off with no fuel, and then set its fuel to 1 when you want the vehicle to start moving.  This is useful for helicoptors as they will take off at the start of the mission and hover over the first waypoint untill it is no longer active

(Edited by Space Cadet at 1:32 pm on Nov. 16, 2001)

Space Cadet
Nov 16 2001, 10:36
Oh,

you can also use the LOCKWP command to prevent movement until its needed.

Unit1 LockWP True - will stop the unit moving to its next waypoint
Unit1 LockWP False - will tell the unit to continue with its waypoints

nutbar
Nov 16 2001, 20:36
I'm pretty sure that even if I place the waypoint directly over the unit, it will still turn it's engine on... so I guess I have no option but to start it off with no fuel, and then give it fuel when it needs to start going... but then, what if it gets attacked before the condition is met?

See I was hoping that I could just start it off with it's engine off and the AI not trying to drive to it's first waypoint.  I will try the lockwp thing in their init field so they don't move at first, but I guess I will have to make a trigger to unlock their movement?

Thanks, I will give it a go and see what happens.

(Edited by nutbar at 11:39 pm on Nov. 16, 2001)

nutbar
Nov 17 2001, 02:46
Ok, I got it working http://www.flashpoint1985.com/ikonboard3/non-cgi/emoticons/smile.gif

It was a combination of lockwp AND placing a waypoint ON the main unit (like as if you're creating a waypoint loop). I just init'd the unit to lockwp true, which by the way locks all waypoints AFTER the first one. Made the very first waypoint a move waypoint on the first unit, and did my condition, and on activation, it lockwp false on the group and presto.

Thanks for the tips/ideas http://www.flashpoint1985.com/ikonboard3/non-cgi/emoticons/biggrin.gif