OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: THobson on 21 May 2005, 18:34:50
-
I have a strange problem and need a work around. Disable AI is not a feasible solution in this particular situation.
The problem is this:
I order all my squad to a location (location A). If they reach there then there is no subsequent problem.
If they are still moving when my script kicks in there is a problem. The script gives each of them a setPos to location B, then a doMove to location C, then a doStop and then a setPos to location C. Each member of the squad have their own B and C. After all this one (and only one) of the squad continues to move to location A! All the rest of the squad does what they are told, but there does seem to be some variability in exactly where they end up.
I even put a _x doMove getPos _x after the setpos to location B but that did not help.
I can keep giving the errant unit a setPos to its location C during the scene, but the unit just ignores any doStops and turns round and heads back towards A.
At the end of the scene the errant unit responds correctly to my orders.
The only thing that distinguishes this unit from the others is that is has no weapons.
Without using disableAI is there anyway I can freeze a unit in place for the duration of the scene.
I am now about to try a fast setPos loop, but I would much prefer something else if anyone has any ideas.
-
Give him a weapon.........StrokeFist for example ;D ;D
Planck
-
An m16 doesn't help and I certainly feel like punching her face in.
This is one of the problems of trying to have scene in an unpredicable situation. It is quite unlikely that this unit will be moving when the scene kicks in, but in those rare instances it will look stupid.
-
Ohhhh......it's a woman.
Ahhh well, they have a tendency, even in real life, to do the opposite to what you expect them to do.
They are after all the 'opposite' sex.
Not trying to be sexist or anything, just an observation.
Is it not possible to delay your scene for a little longer to avoid the possibility?
Planck
-
how about a script wich does what you said above but in a loop works for me know and they stay standing when combat kicks in and they start firing in that exact same posistion i think thats what you need i didnt read the whole fist post only first half of it so sorry if its wrong.
-
Delete the unit. Copy and paste one of the working units.
See if it works now.
If it does, edit the unit to give it right attributes.
Whatever command you gave to make her move to A, give the same command but to C.
-
Attach a copy of your script so we can look at it and see what can be modified to get around the problem.
I recently had similar problems with unit movements and I overcame those using playmoves to force them to go exactly where I wanted them to go (within a playmove of the desired postition). Anyway, this experience made me very good at using playmove to get units to do/go where I want, so maybe I could help you by applying this to your script.
Also, I have a general script I made that uses playmoves to move an array of units through a series of positions using playmoves you determine. I am attaching that script. Keep in mind, however, that while a unit is moving via a playmove loop, that unit will be unable to do other things (like defend himself if he is shot at).
-
Delete the unit. Copy and paste one of the working units.
Does not solve the problem I'm afraid.
Whatever command you gave to make her move to A, give the same command but to C
There's the rub. To get the unit to go to C I have a scripted doMove command. But this is a script for a scene that happens in the mission - this unit has been a member of the player's squad for sometime and so could be anywhere doing anything. If it happens to be moving somewhere (by the player telling it to move) then this problem will result. It is pretty unlikely
Planck - you are a sexist :)
456820 & Raptorsaurus: Thanks, but I don't think the answer is in a script, I just wondered if it was a feature of OFP that there was a known way around.
Here is an extract from the script. As you can see all units are given pretty much the same instructions, but Irena seems to be so fixated in going to where I told her before the script started that she ignors the doStops and doMoves - I suspect she would ignore the setPos also if she could.
{if ((alive _x) and (_x == vehicle _x)) then {_x setPos [5584 + random 6,7919 + random 4,0]} else {unassignVehicle _x}} forEach ((units group Alexi) - [Alexi])
Karl doMove [5558.57,7891.74,0]
Ruslan doMove [5571.75,7895.87,0]
Erik doMove [5565.88,7892.44,0]
Irena doMove [5563.39,7891.99,0]Irena ignors the previous instruction if she was previously on her way somewhere else
.
.
.
.
Alexi setPos [5563.27,7888.55,0]
Alexi setDir 180
{_x playMove "EffectStand"} forEach (units group Alexi) + [Yuri]
{doStop _x} forEach (units group Alexi) + [Yuri]
{_x setMimic "Angry"} forEach (units group Alexi) + [Yuri]
if (alive Karl) then {Karl setPos [5558.57,7891.74,0];Karl setDir 140}
if (alive Ruslan) then {Ruslan setPos [5571.75,7895.87,0];Ruslan setDir 180}
if (alive Erik) then {Erik setPos [5567.88,7895.44,0];Erik setDir 206}
if (alive Irena) then {Irena setPos [5562.39,7891.99,0];Irena setDir 170}
After the above instruction all except Irena stay where they are. She runs off to the location I told her to go to prior to the script starting.
-
Hmmm....
I got a tatic I like to use with AI being silly in cutscenes. Simply put a marker (or use the co-ordinates) of somewhere out of site, use the setface command on your unit, so it always looks the same, and then have a LOOKALIKE unit, which you simply setpos into place in exchange for your friend for the cutscene. Guarenteed on its best behaviour. If you like, you can save the positions of your units by a script before you make them all vanish, so you can setpos them back to where you moved them from. Hope it works dude!
-
I got a same kind of problem, when those waypoints were too long distance from the unit. Just ordinary waypoints. But domove kinda creates a wp, right? Then I just placed some closer waypoints. It helped. Maybe some kind of terrainpathfinding stops when too long distance.
-
Gogs: Good idea. What puzzles me is that it is only this unit, and if I delete the init in the editor and make a new one the same thing happens.
Ronin: There are no waypoints involved for these units in the entire mission
-
Must be
a) because shes a woman
b) because shes a woman
or
c) because shes a woman.
Its just the realism inherant in the OFP engine. Women don't do what they are told. ;)
Seriously though, it is pretty odd, I can't think of anything.... Haven't got a public variable called Irena or something like that?
-
Really you guys are so sexist.
I have fixed this in a pretty ugly way. At the appropriate time I run a script that has a fast loop, if she moves the script puts her back.
I will investigate this more when I have more time