Jump to content
Sign in to follow this  
rekrul

Limiting radio triggers

Recommended Posts

I have 3 teams and three radio triggers - Forseti-team, Alpha-team, Bravo-team, Airstrike radio-trigger, chopper1 radio-trigger and chopper2 radio-trigger. Only Forseti should be able to use the airstrike-trigger but all teams should be able to use the chopper-triggers.

How do I do that?

Also, is there a way to limit this, if Forseti-team is using chopper1, I don't want any of the other teams to access it until it's made available. Is this possible? (I don't need an example for this, just want to know if it's possible.) I was thinking of deleting and adding triggers, but I can't since the Forseti-team might need to access it, if they change their destination f.ex.

And I can't/won't take the easy route with SOM either.

Share this post


Link to post
Share on other sites

You're best off using addAction rather than Radio for this really. Radio triggers are available to anyone that has a radio. You could limit it after it's been triggered inside the script, but you can't put conditions on the trigger itself if it's Radio.

Share this post


Link to post
Share on other sites

Hmmm ok. How can I put limitations in the script? Is there a way to find out who triggered the uh... trigger?

Edit: Hmm, checked this http://community.bistudio.com/wiki/ArmA:_Mission_Editor#Activation and here it says:

Radio <letter> - The trigger will be activated by a radio command available to all players leader of a group or possess a radio. Activation of radio triggers can be limited to specific players using the setRadioMsg command.
but I see no explanation of how. Edited by Rekrul

Share this post


Link to post
Share on other sites

Ahh, yeah, you could do that.

Basically you'd run this on all clients execpt the one you wanted to have access to it:

1 setRadioMsg "NULL";

To disable Radio Alpha on whatever client run that script.

Share this post


Link to post
Share on other sites

How do I do that when I have it in init.sqs? Do I place those messages anywhere else?

I'm testing this in the editor so I guess it works as a SP mission so far, but the idea is to have it as MP mission. According to the biki, this seems like a bad idea?

Share this post


Link to post
Share on other sites

*blush* I just had to remove it from init.sqs and add the correct lines in the init field of the units.

---------- Post added at 11:46 PM ---------- Previous post was at 11:32 PM ----------

Arf, I just realized that I have another problem. When one chopper is "busy" I want to remove the radio-option, like the well-known bug from Manhattan, only intentional. I know this is possible, but how do I change the setRadioMsg for unit by using a script? Afaik, there's no way to set what unit this should be visible for so the command should be "run" by the unit. How do I do that?

Share this post


Link to post
Share on other sites

You can do by keeping track of a variable and using that to add or delete the radio message.

It's a lot easier to simply keep the radio message there and display a 'busy' message rather than constantly removing and readding the radio ability though. Or just use SOM for helo transport rather than trying to hand code the entire thing from scratch.

If it's a MP mission, just have players fly the helos. :) AI + player in multiplayer isn't easy to coordinate at all really.

Share this post


Link to post
Share on other sites

Ah yes, that's true. I already had planned a busy variable. I guess I was stuck in a dead end here, thanks. :)

My primary goal with the mission is to learn scripting, that's why I do everything the hard way. And since I don't have any one to test the various functions with, I'm using the AI. It's also a better way to learn as it's way more comprehensive and most of the time I'm stuck, it's because I don't know about the possibilities or don't take other "paths" into consideration.

It's like 10+ years since I did any programming so it takes some time to get into it again. :)

Share this post


Link to post
Share on other sites

The main problem is telling when the helo is busy. It's probably easier to just dynamically spawn a chopper when it's needed, so you don't have to keep track of altitude or fuel or whatever. If the chopper exists, it's busy. :) Otherwise you could probably check if it's engine is on maybe?

AI chopper movement has always been such a pain in the ass I've never really tried to do it properly since it's so iffy. Half the time they'll crash into a tree or just generally not do what you want them to.

As far as dynamically displaying a radio, you can even just use triggers. 4 in this case.

Trigger 1: Radio Alpha, Repeatable, onAct = hint "Cheese!";

Trigger 2: BLUFOR PRESENT, Repeatable, OnAct = radioOn = true; onDea: radioOn = false;

Trigger 3: None, Repeatedly, Condtion = radioOn, onAct = if (player == s1) then {1 setRadioMsg "Say Cheese"};

Trigger 4: None, Repeatedly, Condtion = !radioOn, onAct = 1 setRadioMsg "NULL"

When playing as S1 (with radioOn = false in it's init) if you step in the Trigger 2, you can use the Radio. When playing as S2 you can't use the radio throughout.

Edited by kylania

Share this post


Link to post
Share on other sites

Well, I haven't looked at it yet, but basically it's an air-taxi, so when team calls it in, it will be set to busy. It will run and pick up the team, and offload them. As soon as they're out the door, it's available again.

I'm also thinking of checking if the team is alive (so it's not permanently busy if it happens) and will also add a "cancel/rtb" radio trigger, but I really don't think the last one is necessary.

My main problem (I think) would be to know who the triggered the radio call so I can check if all is aboard and everybody is out.

Edited by Rekrul

Share this post


Link to post
Share on other sites

Yes, but the age old question. WHO triggered the radio?

Man, with that information, I could rule the world... well ok, my map.. anyway. :)

Share this post


Link to post
Share on other sites

Or in my script, if I can find out who clicked the map with onMapSingleClick, I'd be saved.

Edited by Rekrul
Tons of typos in a single sentence

Share this post


Link to post
Share on other sites

thislist does not work with a radio trigger.

The best thing I pulled off was to not even place the trigger in the editor, but rather create it locally for the units I want to be able to use it. If that then needed to activate a server-side (or global) script, then you can just make the trigger publicVariable something and the server (or everyone) have a addPublicVariableEventHandlerfor it and run the script. Keep in mind, though, that the event handler will not activate on the machine that ran the publicVariable command.

addPublicVariableEventHandler

createTrigger (works locally in Arma 2)

_trg=createTrigger["EmptyDetector",getPos player]; _trg setTriggerArea[5,5,0,false];
_trg setTriggerActivation["ALPHA","",true];
_trg setTriggerStatements["this", "alphaEvent=true; publicVariable 'alphaEvent';"];

You can also have a condition check in there if you wish.

Edited by galzohar

Share this post


Link to post
Share on other sites

After doing some quick thinking I ended up with 6 different radio-triggers (2 choppers x 3 teams) as the quickest and easiest solution. Not smooth, but atleast it will hopefully work.

Share this post


Link to post
Share on other sites

The biggest problem with radio triggers is that they trigger on all machines when only 1 person presses them, but you can't tell who pressed it. Creating a trigger locally will make it only activate on the machine that clicked it.

Share this post


Link to post
Share on other sites
The biggest problem with radio triggers is that they trigger on all machines when only 1 person presses them, but you can't tell who pressed it. Creating a trigger locally will make it only activate on the machine that clicked it.

Triggers are pretty handy for broadcasting things to MP players though. :)

Share this post


Link to post
Share on other sites

Yeah, but you can't broadcast anything other than "someone clicked it" as you can't tell who clicked it. If you just wanted to broadcast something you could use publicVariable with addPublicVariableEventHandler, and then you can also make it do something different for the one who clicked it and the rest of the machines, assuming you created the trigger locally.

Sure if the trigger just does something that needs to run on everyone and it doesn't matter who clicked it, you can use the normal radio trigger placed in the editor. But as soon as you want to make something a tad more complex, you need to create the trigger locally so you can tell who clicked it.

Share this post


Link to post
Share on other sites
After doing some quick thinking I ended up with 6 different radio-triggers (2 choppers x 3 teams) as the quickest and easiest solution. Not smooth, but atleast it will hopefully work.

Well, this didn't work very well. In the init-field of each unit I had it like this

team1:

1 setRadioMsg "chopper1"

2 setRadioMsg "chopper2"

3 setRadioMsg "NULL"

4 setRadioMsg "NULL"

5 setRadioMsg "NULL"

6 setRadioMsg "NULL"

team2:

1 setRadioMsg "NULL"

2 setRadioMsg "NULL"

3 setRadioMsg "chopper1"

4 setRadioMsg "chopper2"

5 setRadioMsg "NULL"

6 setRadioMsg "NULL"

team3:

1 setRadioMsg "NULL"

2 setRadioMsg "NULL"

3 setRadioMsg "NULL"

4 setRadioMsg "NULL"

5 setRadioMsg "chopper1"

6 setRadioMsg "chopper2"

But this isn't "local" for the unit so everybody (with a radio) ends up with team3's radio-menu and I'm back to square one.

I have made 6 triggers so I was hoping that each team could only access 2 of them, that way I'd know what team triggered the radio. If all 3 teams can access all 6 triggers, I'm boned again. So how can I differentiate this?

Share this post


Link to post
Share on other sites

I don't know what setRadioMsg does exactly (never used it and the wiki description is unclear), but I know that if you create the trigger with the script rather than in the editor it should work fine - only ones that had the trigger created will be able to activate it, and the triggers will not be linked (1 person activating his radio alpha trigger will not activate other people's radio alpha triggers, which would've happen if the trigger would be created once in the editor).

Share this post


Link to post
Share on other sites

Hmmm, but how would that work in MP?

Share this post


Link to post
Share on other sites

In SP you don't even need it, as only 1 machine will execute the trigger at a given time anyway, but things that are done properly obviously work in SP as well ;)

If you want it to be team-switch compatible, then you will have to create the triggers for all players and then in the trigger activation have a condition that will make it only work if the player is allowed to use it (or have a script delete/create the trigger(s) on team switches...).

Share this post


Link to post
Share on other sites

That really didn't make any sense to me as I'm very new to this, but this is what I want to achieve:

3 teams, 2 choppers

When a team calls in a chopper, I check if the chopper is already busy with another team, if not, I check if that team is already on the chopper (so I know if the chopper should pick up or drop off). At pick-up, it will wait until all alive team-members in proximity are in, and on drop off it should kick all players out but I understand this can be a challenge. Alternatively, it will take off after everybody is out or 5 seconds has passed. After drop off, it's available again and will rtb.

This mission is supposed to be a 1-24 Coop, and I want AI to be able to be pilots even though they suck.

The reason why I wanted this fancy radio-trigger thing was to avoid teams hijacking each others AI chopper and check that all team-members where aboard. To do that, I need to know who called it in. Alternatively, I could just forget about teams and then check when whoever is close to the LZ is aboard, but I want to avoid teams hijacking each others chopper.

If I createTrigger (Radio) locally for squad leaders, will they be able to give waypoints and such to both AI and human pilots? All of this is made in a script that works partially in Preview mode, except that you can pretend to be another team since you have access to all 6 triggers.

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  

×