Home   Help Search Login Register  

Author Topic: Assignment of Radio Trigger to specific Slots  (Read 1765 times)

0 Members and 1 Guest are viewing this topic.

Offline Knight Trane

  • Members
  • *
Assignment of Radio Trigger to specific Slots
« 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?

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Assignment of Radio Trigger to specific Slots
« Reply #1 on: 08 Oct 2008, 02:58:38 »
hmmmm, possibly:

this and (player == ws) || (player == ws1)|| (player == ws2)|| (player == al)|| (player == al1)|| (player == al2)


Planck
I know a little about a lot, and a lot about a little.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Assignment of Radio Trigger to specific Slots
« Reply #2 on: 08 Oct 2008, 03:49:03 »
@Planck:
Remember that AND has a greater operator precedence than OR, so what you wrote was actually this:
Code: [Select]
(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:
Code: (trigger condition will fire for ws, ws1 and ws2 if any one of them press the button) [Select]
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:
Code: (createTrigger.sqf) [Select]
// 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'", ""];
« Last Edit: 08 Oct 2008, 03:52:36 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Assignment of Radio Trigger to specific Slots
« Reply #3 on: 08 Oct 2008, 14:34:35 »
ummm, interesting, not how one would expect it to work, as written.

Or maybe a few more brackets ...... :P


Planck
I know a little about a lot, and a lot about a little.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Assignment of Radio Trigger to specific Slots
« Reply #4 on: 08 Oct 2008, 14:54:32 »
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.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Knight Trane

  • Members
  • *
Re: Assignment of Radio Trigger to specific Slots
« Reply #5 on: 08 Oct 2008, 18:25:43 »
Thanks guys,

I'll try this tonight, and reply with its effect.