OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: ual002 on 24 Jul 2007, 00:56:47

Title: unit switch to bluefor side AFTER game has already commenced
Post by: ual002 on 24 Jul 2007, 00:56:47
Is there anyway to make a civilian unit switch to bluefor side AFTER game has already commenced using the join command.  As far as I can tell its just allowing me to command a civilian unit (bad guys wont shoot at him but will shoot at me).  And yes I know about seting a civilian as a follower to a bluefor with probability of 0 presence, thats how my character is being seen as bluefor.  I just want to be able to arrive at a small trigger area with a civilian dude in the middle and have him join my team AS a bluefor.  

Then comes the hard part.  If i could get the first part to work I would like our whole team to be setcaptive using group variable name not object variable name.  Aparently setcaptive needs an object name not a whole group.  Because then I wanted to have a trigger set up so that if any member of the team is unarmed, he is "setcaptive true" and if armed, then "setcaptive false"

Anyone follow me?  
If you havent figured out Im making a red dawn style mission.  WOLVERENES!!!!!!!!!!
Title: Re: unit switch to bluefor side AFTER game has already commenced
Post by: myke13021 on 24 Jul 2007, 01:00:44
First part i don't know, someone else might have an answer.

But for the second thing, this should work:
Code: [Select]
{_x setcaptive true} foreach units group player
if it's meant for players group, else replace "group player" with the groupname.
Title: Re: unit switch to bluefor side AFTER game has already commenced
Post by: ual002 on 24 Jul 2007, 01:05:31
Nice.  thanks, still need answer to the first part.

Cheers
Title: Re: unit switch to bluefor side AFTER game has already commenced
Post by: SniperUK on 24 Jul 2007, 01:07:15
side1 setFriend [side2, value]

Sets how friendly side1 is with side2. For a value smaller than 0.6 it results in being enemy, otherwise it's friendly. Not sure if thats what you're afterbut i dont think you can get him to witch sides other than this.
Title: Re: unit switch to bluefor side AFTER game has already commenced
Post by: ual002 on 24 Jul 2007, 01:56:49
see, that will keep him on civilian side, but just make civilians friendly to another given side. 
Title: Re: unit switch to bluefor side AFTER game has already commenced
Post by: SniperUK on 24 Jul 2007, 02:00:13
that is the closest you will get i think. But look in http://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA for different solutions.
Title: Re: unit switch to bluefor side AFTER game has already commenced
Post by: Tyger on 27 Jul 2007, 03:15:01
try making him bluefor by the "set probability to 0" method also. If you need him to not be shot, then setCaptive him until the trigger.
It's a shot in the dark, but see if it works.
Title: Re: unit switch to bluefor side AFTER game has already commenced
Post by: LeeHunt on 28 Jul 2007, 17:47:00
My suggestion is to do a quick setpos switch:

1) Have your civilian unit that joins the group in its location

2) on an island way off to the side of the map, put the same civilian type commanded by a BLUEFOR with zero probability (you know this way)

3) then when the player has the civilian join, you can instantly switch them out and delete the original civilian and setpos the bluefor civilian to that location.  You could put a gamelogic there to make it easier; BLUECIVILIAN SETPOS GETPOS GAMELOGICOLDCIVVY.  If done instantly i don't think its gamey at all and allows you to make this happen!!!  The code can be included in the trigger too.


Also I've heard that setunit captive false (and true) works only once for the unit- so you can't go back and forth just in case that was a consideration.

Title: Re: unit switch to bluefor side AFTER game has already commenced
Post by: ual002 on 28 Jul 2007, 18:32:47
Very useful info guys, i think ill make it bluefor from the get go but make him "captive" suggested by tyger.  Although the set unit pos idea from lee is very sneaky too.

Can anyone think of a way to make and units in my group set captive false forever once they have picked up a gun?  If we can figure this out Ill be able to proceed with the mission.

And its a useful thread for other newbies like me.
Title: Re: unit switch to bluefor side AFTER game has already commenced
Post by: Tyger on 28 Jul 2007, 21:51:09
(count weapons myCaptive) > 1

Put that in a trigger condition line and in the activation line:

myCaptive setCaptive false

Note: One for each unit!

@Lee
As far as OFP goes, then that is not true. You can do it and undo it multiple times. I don't know ArmA wise since I haven't gotten ArmA yet, but i'd assume the same is true.
Title: Re: unit switch to bluefor side AFTER game has already commenced
Post by: LeeHunt on 29 Jul 2007, 05:30:25
Thanks Tyger, good to know!! And the count weapons mycaptive >1 line helps me out in a mission i'm working on as well  :)
Title: Re: unit switch to bluefor side AFTER game has already commenced
Post by: Tyger on 29 Jul 2007, 05:47:15
Quote
And the count weapons mycaptive >1 line helps me out in a mission i'm working on as well
Not a problem mate! Here to help! :)

And just itching for ArmA to come in! :P
Title: Re: unit switch to bluefor side AFTER game has already commenced
Post by: firecontrol on 29 Jul 2007, 06:24:44
I'm a nitpicky bastard here... but I think it's important. :)

Should be:
(count weapons myCaptive) >= 1
or
(count weapons myCaptive) > 0

Greater than or equal to. Otherwise he'd have to have two 'weapons' to trigger it.
Also, if the unit picks up anything "thrown", i.e. grenades, this will not add to the weapons count. Keep in mind. :) A combination of 'hasWeapon' and 'magazines' can be added to check for grenades. Or simpler, an 'In' command... e.g.
"HandGrenadeTimed" in (magazines myCaptive)   <---- note, 'in' is case sensitive! HandGrenadeTimed is different than handgrenadetimed

http://community.bistudio.com/wiki/weapons (http://community.bistudio.com/wiki/weapons)