OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: Knight Trane on 07 Oct 2008, 19:14:09
-
Ok,
I know this is going to be a total noob question.
I have MP mission w/ the following Playable slots: ws, ws1, ws2, al, al1, al2. I have a Radio Trigger: Alpha, that I only want available to slots ws, ws1, ws2.
I have this in the condition field:this and player == ws
The trigger works for ws, which is good, but how to get it to work for ws1 and ws2 as well?
Also the radio trigger shows up on all the players Radio list. How do I hide this from players al, al1, and al2?
-
hmmmm, possibly:
this and (player == ws) || (player == ws1)|| (player == ws2)|| (player == al)|| (player == al1)|| (player == al2)
Planck
-
@Planck:
Remember that AND has a greater operator precedence than OR, so what you wrote was actually this:
(this and (player == ws)) || (player == ws1)|| (player == ws2)|| (player == al)|| (player == al1)|| (player == al2)
Which definitely wasn't what you meant (it will trigger whether it is clicked or not, for everyone except ws)!
@Knight Trane:
The problem with doing this with an editor-based trigger is that it will not exactly do what you expect. It works great when you are limiting it to just one person, but once you have more than one (or an radio trigger available to everyone, for that matter), then it probably doesn't work as you'd like, or expect, it to. In ArmA, whenever anyone uses a radio trigger, everyone who could have used it will have their triggers triggered (condition will be true and onAct will be run). You don't even know which one of those players actually used the radio!
The simple answer would be to just limit the trigger to the three people who should have it:
this and (player in [ws, ws1, ws2])
and delete the radio text for the people that should have it using setRadioText (of course, first waiting until they create their player object). But as I explained, the problem of the trigger running on everyone's machine is probably a problem, such as, for example, creating multiple artillery firings when you just wanted one, so best to do something else...
This issue means it is much better to use script-based triggers for the majority of MP missions:
// Run from init.sqf (or init.sqs) with:
// [] execVM "createTrigger.sqf";
// Exit on a dedicated server only.
if (isServer and (isNull player)) exitWith {};
// Wait until the player spawns in, but don't do anything if it is the wrong player.
waitUntil { alive player };
if (not (player in [ws, ws1, ws2])) exitWith {};
_trigger = createTrigger ["EmptyDetector", [0, 0, 0]];
_trigger setTriggerActivation ["ALPHA", "PRESENT", true];
// Er, just run whatever code, script or function you want from the second parameter, of course...
_trigger setTriggerStatements ["this", "nul = [] execVM 'triggerActivated.sqf'", ""];
-
ummm, interesting, not how one would expect it to work, as written.
Or maybe a few more brackets ...... :P
Planck
-
Apparently, radio triggers worked more intuitively in OFP. I can see what BIS were trying to do when they made radio triggers global (saves you broadcasting the effect manually), so, for example, you can give server-side units orders from a radio trigger without worrying about locality. The problem is that there are as many other uses of the radio that you really need to know who used the radio for and/or you need to perform the action only in one locality.
Yes, a couple more brackets would get your line working fine, Planck.
-
Thanks guys,
I'll try this tonight, and reply with its effect.