Jump to content
Sign in to follow this  
CaptainBravo

Restrict Radio to certain sides?

Recommended Posts

Hey everyone,

I have a mission with 3 oppsite sides and I need to restrict radio Triggers (Alpha, Bravo, Charlie, etc) to different sides. So west can only use Alpha,Bravo, Charlie radio) East has access to Delta, Echo, Foxtrot) and Ind to rest.

Any explanation on how to do this is highly appreciated.

Share this post


Link to post
Share on other sites

This might be a harder question than I thought ..

Anyone knows to hide triggers from specific sides?? Answers are really appreciated.

Share this post


Link to post
Share on other sites

Hi,

Its actually very easy.

if (!isDedicated) then 
{
   if (side player == West) then
   {
         1 setRadioMsg "NULL";  //No radio Alpha for West side
         2 setRadioMsg "Call Reinforcements";  //Radio Bravo is available for West
   }
   else
   {
         1 setRadioMsg "Call Evac";  //Alpha radio is available to East side
         2 setRadioMsg "NULL";  //Bravo radio is not available for east
   };
}; 

That can be/should be put in the init.sqf.

You can use a switch statement instead of a if then.

if (!isDedicated) then 
{
   switch (side player) do
   {      
        case west : 
        { 
             1 setRadioMsg "NULL" };  //No radio Alpha for West side
             2 setRadioMsg "Call Reinforcements";  //Radio Bravo is available for West
        };

        case east : 
        {
            1 setRadioMsg "Call Evac";  //Alpha radio is available to East side
            2 setRadioMsg "NULL";  //Bravo radio is not available for east
        };
   };
}; 

_neo_

Edited by neokika

Share this post


Link to post
Share on other sites

Thanks neokika, it seems easier than I thought.

A noob question but what is the difference/Advantage for using if vs switch ?

Thanks.

Share this post


Link to post
Share on other sites

Switch allows you to use more than two possibilities very easy. You could establish let's say three different ways by using if-then-else:

_x = round(random 2);

if (_x == 0) then {
hint "_x is 0!";
} else {
if (_x == 1) then {
	hint "_x is 1!";
} else {
	hint "_x is 2!";
};
};

But switch allows you to do that much easier:

_x = round(random 2);

switch (_x) do {
case 0: {hint "_x is 0!"};
case 1: {hint "_x is 1!"};
case 2: {hint "_x is 2!"};
};

So just use switch if you have more than two possibilities. ;)

Share this post


Link to post
Share on other sites

Thanks IndeedPete, thhis certainly explains the difference.

It sounds like switch is the way to go.

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  

×