Jump to content
Sign in to follow this  
Smokki

Retreat

Recommended Posts

Making mission where friendly forces including player must retreat to marker "retreatpos" after trigger "a1". Even if they still have waypoints left.

Any ideas?

I tried...

{_x move getMarkerPos "retreatpos", 0} foreach units group com1

...for the trigger but doesn't work.

For the group leader init I have: com1 = group this

EDIT: I get error message type group, expected object

Share this post


Link to post
Share on other sites

{_x domove getMarkerPos "retreatpos", 0} foreach units com1

That works.

But I need a waypoint that is added to group "com1":

wp1 = com1 addwaypoint [getmarkerpos "retreatpos", 0]

Now i need "com1" to move to that waypoint after trigger "a1"

That's the part I don't know.

Share this post


Link to post
Share on other sites
Guest

heres an example of what I use to force units in a group to flee while in the midst of combat along with usage of move command which does use the waypoint plan, you may not need to go as far as setting them to "BLUE" status, cause its never fire, but even "GREEN" they still wouldnt move enough for me

{_x setCombatMode "BLUE"} forEach (units com1)

;gives a lil time to let new mode set in

~3

;this is to update units positions whom may be "funked" due to heavy fire

{_x doMove (getPos _x)} forEach (units com1)

;gives a lil time to allow units to update positions

~2

com1 lockwp true

leader com1 move getMarkerPos "retreatpos"

;just a safe backup, ensure all units are following the leader

{if((alive _x) and (_x != leader com1)) then {_x doFollow leader com1}} forEach (units com1)

If you look in the wiki, move command actually does add a move waypoint right in the waypoint plan at the current area active in that waypoint plan - ALTHOUGH

its been a while since ive used this, but from my previous test, basically whats really happening most of the time, is that the command takes the current waypoint that has not yet been reached (the active one) and simply moves it to the move position, this may or may not be problematic for you, it caused me to stop using it because of this.

The waypoint plan is locked so when they get to the new move position, they will stop there, if you dont want this, just get rid of that.

Of course, at whatever point, to reset combatmode/allow wp plan again:

;whatever combatmode setting u want returned

{_x setCombatMode "YELLOW"} forEach (units com1)

com1 lockwp false

Actually adding in a waypoint anywhere within a plan (thru Armas new waypoint creation commands) dont think can be done, they are added incrimentally in order, so each waypoint added is put at the end of the waypoint plan index.

I do use the Domove command btw, not move, but maybe move is what your looking for in this case - I had spent a good few hours testing what works to get units to run out of a combat scenario while under fire, this stuff should work good -

Also, if you want control over your units in a group in possible heavy combat where they may take heavy losses, you might have to set their fleeing to 0, or you may find them dashing off to their first waypoint position after a few casualties before you get a chance to make them retreat the way u want.

Either way, Gl to you! smile_o.gif

Share this post


Link to post
Share on other sites

The <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> , 0 in the {} brackets is wrong

so it would be just:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

{_x move getMarkerPos "retreatpos"} foreach units group com1

One possible way of doing this is:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

wp1 = com1 addwaypoint [getmarkerpos "retreatpos", 1]

Index 0 is the very first waypoint, so it's recommendable to use index 1.

And work with lockwp.

Lock the waypoint until a1 is true (or false whatever you want)

and then "lockwp false" the group.

So :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

group com1 lockwp true

Share this post


Link to post
Share on other sites
Guest
Quote[/b] ]

One possible way of doing this is:

wp1 = com1 addwaypoint [getmarkerpos "retreatpos", 1]

Index 0 is the very first waypoint, so it's recommendable to use index 1.

Im a little confused myself here, according to the wiki the second element in the array for addwaypoint is described as being the radius of the waypoint placed, not index - ive never seen anything that allows a waypoint added to be set to an index position within the waypoint plan, if im wrong id sure like to know this can indeed be done smile_o.gif

Share this post


Link to post
Share on other sites

Thank you for your help  yay.gif

That script works great:

Quote[/b] ]{_x setCombatMode "BLUE"} forEach (units com1)

;gives a lil time to let new mode set in

~3

;this is to update units positions whom may be "funked" due to heavy fire

{_x doMove (getPos _x)} forEach (units com1)

;gives a lil time to allow units to update positions

~2

com1 lockwp true

leader com1 move getMarkerPos "retreatpos"

;just a safe backup, ensure all units are following the leader

{if((alive _x) and (_x != leader com1)) then {_x doFollow leader com1}} forEach (units com1)

How could I run it for multiple squads at same time? Yes I'm a bit noob with scripts  biggrin_o.gif

Only problem for me is not seeing "retreatpos" as a waypoint. The old waypoint is still there, but that is just minor problem.

Thank you.  smile_o.gif

Share this post


Link to post
Share on other sites
Guest

Curious, what happened once the group got to the move position?

Did they stop, until you unlocked their wp plan again?

And then, im assuming from what you said they returned to the last waypoint they were on?

Im not sure what it is you might want to do after theyve reached their retreat position, if u later want them to still carry on their waypoint plan, or do you not want to use the waypoint plan anymore after retreating.

If your going to just run that script on multiple groups all at once, then easiest way would be just to replicate those lines for each group.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

{_x setCombatMode "BLUE"} forEach (units com1)

{_x setCombatMode "BLUE"} forEach (units com2)

{_x setCombatMode "BLUE"} forEach (units com3)

;gives a lil time to let new mode set in

~3

;this is to update units positions whom may be "funked" due to heavy fire

{_x doMove (getPos _x)} forEach (units com1)

{_x doMove (getPos _x)} forEach (units com2)

{_x doMove (getPos _x)} forEach (units com3)

;gives a lil time to allow units to update positions

~2

com1 lockwp true

com2 lockwp true

com3 lockwp true

leader com1 move getMarkerPos "retreatpos"

leader com2 move getMarkerPos "retreatpos"

leader com3 move getMarkerPos "retreatpos"

;just a safe backup, ensure all units are following the leader

{if((alive _x) and (_x != leader com1)) then {_x doFollow leader com1}} forEach (units com1)

{if((alive _x) and (_x != leader com2)) then {_x doFollow leader com2}} forEach (units com2)

{if((alive _x) and (_x != leader com3)) then {_x doFollow leader com3}} forEach (units com3)

If you wanted to make the script universal, so you can execute it once per group whenever, it would be a different format, and a little more complicated(would have to pass group name to script), but I can post that if thats desired.

Dont forget, you have to reset that combatMode at some point, or they will never be able to fire.

Share this post


Link to post
Share on other sites

Thanks again smile_o.gif

Everythin worked as you said it would.

They stop at the "retreatpos" and thats the way I like it (mission ends there). The waypoint sign (on your screen showing where next waypoint is) just won't show the retreat position (it stay back at the last "real" waypoint).

Share this post


Link to post
Share on other sites
Guest

Edit/deleted

The script method of changing waypoint positions/ or deleting and adding new ones doesent help, if group is enroute to a current waypoint that is moved/deleted, it does not cancel the move command, nor change it -

try this command in place of move, maybe see what happens:

just replace move with commandMove, maybe the target for the current move order will be changed to new pos?

commandMove

Share this post


Link to post
Share on other sites
Guest

Tried to get the target to move to thingy to move by changing waypoint positions, and adding one more too, and it *appears* as tho once a move order is made to a waypoint position, even if that waypoint is moved, they still keep moving towards it unless they are diverted directly thru doMove,move, moveTo, etc - they are not turning around until they reach current waypoint this way... bummer

This is as far as im going with this, maybe some one else knows a way to get that target thing to shift to new move position.

Gl m8 smile_o.gif

Share this post


Link to post
Share on other sites

If you add {_x disableai "target"} foreach units com1

to your sqs fileyour troops will tend not to engage targets when their supposed to give the impression of a flee retreat.

I havn't tested it fully yet but early signs seem to be promising smile_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×