OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: GI-YO on 10 Nov 2004, 20:12:14

Title: run away, run away.....
Post by: GI-YO on 10 Nov 2004, 20:12:14
A quick question here should be easy.

If you use the allow fleeing command on a group leader do you need to set all the groups fleeing status or just the leaders, and if he die's doe's it make any difference. Cheers.

GI-YO
Title: Re:run away, run away.....
Post by: Triggerhappy on 10 Nov 2004, 20:59:16
hmm.. good question, never really looked at that, but i would say that the officer would be enough, until he gets killed... from there, ???

its really easy to give it to everyone using the foreach command, so i would just do that
Title: Re:run away, run away.....
Post by: Artak on 10 Nov 2004, 21:54:53
the allowfleeing command can be given to a whole group at once. just use groupname allowfleeing 0 or in the leaders init field (group this) allowfleeing 0
Title: Re:run away, run away.....
Post by: General Barron on 10 Nov 2004, 21:57:36
"Courage" is a GROUP property. You can pass either a group or a unit to the "allowfleeing" command, but either way, you will set the value for the whole group. Just like with the move, formation, or combatmode commands.
Title: Re:run away, run away.....
Post by: stew on 18 Dec 2004, 17:55:34
Talking about retreating:
It seems to me they simply run to the previous waypoint and hide there, but I'd like them to flee far enough so my victory trigger ("not present") is activated.

Is there a way to tell units in which direction to flee?

Or is it better to script it? (like setting courage to 0 and activate a waypoint as soon as only one or two of them are left)
Title: Re:run away, run away.....
Post by: General Barron on 18 Dec 2004, 21:56:35
Talking about retreating:
It seems to me they simply run to the previous waypoint and hide there, but I'd like them to flee far enough so my victory trigger ("not present") is activated.

Is there a way to tell units in which direction to flee?

Or is it better to script it? (like setting courage to 0 and activate a waypoint as soon as only one or two of them are left)


I actually know very little about how the default retreating works, other than it seems to compare how many units are left in the group with how many they are facing. Didn't know where they flee to though, thanks for the info on that. I always assumed they fled in the opposite direction from their enemies, but I could be mistaken. Might be a good thing to do some experimenting on, and post your results here or in the comref :).

In general though, I'd say it is better to script your own retreats. That is far more complicated then using the default ones though, and most units never live to retreat, but it would all depend on whether you think it is worth the effort.
Title: Re:run away, run away.....
Post by: Mud_Spike on 18 Dec 2004, 22:41:14
The hard part is figuring out when to flee, and as OPF already does this for us all you
really have to do is check whether a unit is fleeing and if so, tell him where to go.
(or the entire group (pansies), as in the example bellow)

Code: [Select]
@(fleeing pansies)
pansies allowFleeing false ;; To make them obey your orders
pansies move GetMarkerPos "mrk_outsidemytrigger"
(SNG)
Title: Re:run away, run away.....
Post by: stew on 19 Dec 2004, 13:55:55
In general though, I'd say it is better to script your own retreats. That is far more complicated then using the default ones though, and most units never live to retreat, but it would all depend on whether you think it is worth the effort.

I really don't know.
My problem is the player won't see most of the retreat: He is attacking an enemy fortification near a forest and a steep slope. Sometimes the AI starts fleeing and ends up hidden in the forest or stuck on the slope, where the player won't see them and needs to spend hours searching. I wanted them to keep running until they leave the "is present" trigger. The more I think of it, the better it is to disable fleeing. Maybe I put a single soldier somewhere and let him run away once his buddies are dead. (So I get the effect of fleeing troops without them actually fleeing)
Title: Re:run away, run away.....
Post by: benreeper on 19 Dec 2004, 16:52:23
In my experience they do not run to the last waypoint when fleeing, they seem run run where there is no enemy.  If you were going to script a retreat you would need to use "domove" commands at the every least since when units are retreating they ignore all waypoints and moves.

--Ben
Title: Re:run away, run away.....
Post by: stew on 19 Dec 2004, 17:20:12
I haven't done extensive testing. The situation that lead me to that conclusion was this setting:

Players troops are coming from the South
AI starts NW of village, has one waypoint (GUARD) inside the village
after some firefight AI retreats to their starting point in the NW.
If AI were positioned in the NE, they flee in that direction.


But, as I wrote above, I don't really need an orderly retreat to a certain waypoint. I just need an assurance that fleeing troops will leave the target area quickly so that the player doesn't need to chase them or has to wait hours until they crawled away.
Title: Re:run away, run away.....
Post by: Mud_Spike on 19 Dec 2004, 20:48:12
Stewey;
put
count thislist == "fleeing _x" count thislist
(or something along those lines, you get the idea)

in the condition of the end-trigger (which should be EAST Present, radius X),
that way you dont have to wait for the cowards to flick off.

Title: Re:run away, run away.....
Post by: stew on 19 Dec 2004, 22:15:45
Good idea! Thanks!
Title: Re:run away, run away.....
Post by: macguba on 20 Dec 2004, 12:49:41
Sometimes they flee to the last waypoint.    Sometimes in the direction of where they started the mission.      Sometimes its virtually a random direction.     Sometimes it is towards friendly forces.    

However, it is always away from the enemy.

Sometimes they flee and just keep running.   Sometimes they only go 100m and then rally and start to advance again.

A good idea is to setFleeing 1 the fleeing loons, to make sure they keep fleeing.    Also, check if they can stand and if not either kill them or heal them a bit with setDammage.    That means you don't get the crawling loon slowing up the game.

I have a feeling that fleeing units don't obey doMove commands, though don't quote me.   You might prefer, when they flee, to give them setFleeing 0 and doMove commands.  

Title: Re:run away, run away.....
Post by: DEAD RABBIT on 20 Dec 2004, 22:48:59
Just a side note, don't use high ranks for much-fleeing units. I read somewhere about ranks playing a major key role in fleeing behaviour. Colonels or Majors tend to sacrifice themselves more than the Rookies or Privates.
Title: Re:run away, run away.....
Post by: THobson on 21 Dec 2004, 07:57:42
That is correct.  The courage of an individual is set by his rank and the rank of his group leader.  The higher the rank the higher the courage.

allowFleeing 0 gives the guy very high (but not infinite) courage
allowFleeing 1 takes all his courage away.
Title: Re:run away, run away.....
Post by: TonyRanger on 22 Dec 2004, 09:22:24
why not try a trgger like this?
conditon:fleeing ap(ap is one man of the group)
then [leader ap,0] setwppos pos(pos is the position you want the  group move to)