OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Lone-Wolf on 14 Jan 2010, 22:45:21

Title: Changing a unit's side
Post by: Lone-Wolf on 14 Jan 2010, 22:45:21
The title says it all...

I've so far tried [_unit] join otherunit1 and that doen't work at all...

Help?  ???

  - Lone Wolf

(P.S. I'm talking about changing a units side mid-mission.  :dry: )
Title: Re: Changing a unit's side
Post by: RKurtzDmitriyev on 14 Jan 2010, 23:24:55
Yes, that doesn't work for me either. I don't think there's any way to change a unit's side mid-mission in OFP. That changing of sides with join might just be an ArmA thing.

If the unit to be changed is not the player, then you might be able to effect some "smoke and mirrors" using deletevehicle and createunit in quick succession.

To get friendly units to shoot at the player, use addRating with a negative number. To keep enemies from shooting a unit, use setcaptive. Unfortunately those two won't mix.

Sorry I can't be more helpful. :(

EDIT: I just realized that you can create the illusion of the changing the player's side by deleting all enemy units and using createunit to replace them with friendly units with enemy uniforms and weapons, and vice versa with friendlies. Tedious, but I think it would work.

The only problem here is that you may now have black soldiers in USSR uniforms. ;)
Title: Re: Changing a unit's side
Post by: Lone-Wolf on 15 Jan 2010, 17:24:47
OFC, there's always the inferior solution which is to do

_unit addrating (-(rating _unit)-10000)

and then make the player have the line

_player addrating 999999999999

which serves to ensure that allies don't turn against the player for "Friendly Fire"...   :D