Jump to content
Sign in to follow this  
fatty86

Rescue/Capture: Same Script Yields Different Results

Recommended Posts

Hello, I have two missions I am working on for MP play - one a hostage rescue, the other a VIP capture. I have built one script to work for both missions, as the principle is the same: use an addaction command to rescue or capture the character, and then add the character to the player's group.

To get around locality issues, I use a two-step process. The first step is where the addaction executes a script that detects the group of the player, and sets a generic variable to true to activate a trigger. The trigger then executes a script that runs on all machines, adding the character to the player's group. Here are the scripts, first the hostage script and then the capture script:

//rescuer.sqf, executed by the addaction command

rescuer = _this select 1;
rescuegroup = group rescuer;
varrescued = true;
publicvariable "varrescued";
publicvariable "rescuegroup";

//rescued.sqf, executed by a trigger with condition "varrescued"

vip removeaction 0;
if (isServer) then
{
[vip] join rescuegroup;
{vip addmagazine "30Rnd_545x39_AK"} foreach [1,2,3,4,5];
vip addweapon "AK_74";
vip selectweapon primaryweapon vip;
};
vip setCaptive true;
vip switchmove "CtsDoktor_Doktor_idleni2";
hint parsetext (""Let's get the hell out of here!"");
nul=[] execVM "scripts\1_task_complete.sqf";

//arrester.sqf, executed by the addaction command

arrester = _this select 1;
arrestgroup = group arrester;
vararrested = true;
publicvariable "vararrested";
publicvariable "arrestgroup";

//arrested.sqf, executed by a trigger with condition "vararrested"

hint parsetext (""I surrender!"");
if (isServer) then
{
[vip] join arrestgroup;
};
vip setCaptive true;
vip removeaction 0;
nul=[] execVM "scripts\1_task_complete.sqf";

When doing the arrest, the VIP joins the group fine. No problems there. When doing the rescue (particularly when a player who is NOT the leader rescues, not sure about when the leader does it), the objective complete script fires, and the "5, follow 1" verbal command is given, but the VIP doesn't actually join the group.

Why wouldn't the character join the group? There is some extra stuff in the rescued.sqf to simulate the hostage rescue (e.g. changing positions so that hands are unbound, picking up a gun, etc.) but I don't think that would stop the join command from working.

Any thoughts?

---------- Post added at 11:00 PM ---------- Previous post was at 10:43 PM ----------

BTW, I should explain the logic of the isServer check. I have found when using join in a dedicated setting, unless isServer is true then the command will be run on every machine, causing the capturer to say "5, follow 1!" for every player in the game. Very annoying.

I have used similar scripts with isServer checks in ArmA2 with no problems, but this is my first swing at it with OA.

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  

×