Comrades in Arms Discussion Board

Full Version: setCaptive trigger not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So, to solve the issue of Ai shooting you when you're underwater, I used a trigger for each named playable unit to set it captive when its 2 meters below sea level in my latest mission Canidae Cull.

[Image: bnbLrPq.jpg?1]

However it didn't work (no one was captive while we were underwater), so I tried it again on a dedicated game on my own computer and it worked there. I don't get it :-\

I checked again on the server, and some units are captive while some aren't.

I checked in editor now and I was the only unit captive.
Hm, I think Phantom had a similar issue with this in his Shapur mission.

The rules for setCaptive are local argument, global effect, so the only reason why this doesn't work I could imagine is that the call isn't made on the machine that the unit is on, or that the execution on another machine resets the captivity.

You might want to try this:
make a function SetCaptive that does

-- snip --
(_this select 0) setCaptive (_this select 1);
-- snip --

In the trigger, replace the OnAct with
[[a1, true], "SetCaptive", a1,] call BIS_fnc_MP;

replace OnDeAct with

[[a1, false], "SetCaptive", a1] call BIS_fnc_MP;

Rationale:
BIS_fnc_MP, used in this form, will execute only on the machine where the given object (at the end of the list, a1 in this case) is local, since setCaptive REQUIRES a local argument.

Also you might want to try and bracket your condition, like
((getposASL a1) select 2) < -2

Operator precedence might get a bit mushy otherwise.

Hope this helps.
Still the same issue as with triggers, on my test mission it works perfectly, but on Canidae it worked for three units, but not the other nine.
Yeah, I had a similar issue so I just said fuck it and switched to side resistance friendly to all then join group or something to an invisible hostile group. It works for what I was trying to approach.