Forum Jump :

Author Message


Posts: 3
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2011-01-27 04:19        
     
Multiplayer

There are 36 players and all are named (p1 to p36)

I want to give p36 the ability to control certain elements of the mission via the Radio commands. Actually, truth be told, I'd like for p34 and p35 to be able to use the commands as well, but I'd settle for just limiting it to p36.

I create the trigger with 0 radius and Radio Alpha selected (and a text line, of course). In the 'On Act' field I have it executing a vehicle spawn script which has been tested and is working properly. The question is: How can I make this radio trigger usable only to this particular player slot?. I have tried all of the following condition lines and they have failed when tested. (either because everyone gets the ability or because no one gets the ability)


player == p36;

p36 in thislist;

player == p36 || player == p35 || player == p34;


I have also tried making the trigger itself available to all but with an if/then/else statement in the 'On Act'. It failed miserably.

Also, when I grouped the trigger to the unit in question, no one could even see the radio options anymore (it was as though they did not exist).

Any ideas?


Author Message


Posts: 20277
Rank:


Level: Super Admin

Country: nl
Location: The Netherlands
Occupation:
Age: 41
In-game name: Foxhound

 
#2 Posted at 2011-01-27 11:39        
     
A script with this maybe?
{
	 _x removeweapon "itemradio",;
}
forEach [unitname1,unitname2,etc];

};


Or, maybe group the leader with the radio trigger(s)?

Visit my family webshop desteigerhoutshop.nl.

Advertisement


Author Message


Posts: 3
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2011-01-27 18:09        
     
# Foxhound : A script with this maybe?
{
	 _x removeweapon "itemradio",;
}
forEach [unitname1,unitname2,etc];

};


Or, maybe group the leader with the radio trigger(s)?

grouping the unit in question to the radio trigger renders the trigger unusable

The script you gave was an idea I hadn't looked into yet. I tried it out but got script errors (never could figure out what it didn't like), but then I tried removing the "itemradio" in the init field of each of the units that was not supposed to be able to use the triggers. At first, I thought it had worked! But then a multiplayer test showed that whether they had the radio in their inventory or not, the 0-0 list AND the map radio were both still available to them.

Long story short = nice try, but it didn't work :(


Author Message


Posts: 1484
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#4 Posted at 2011-01-29 16:03        
     
If you removed the last }; from the script that would have worked, I don't think it fixes the radio problem though.

With radio triggers The Condition is ignored along with thislist. It makes sense as it would be odd to have Radio Alpha present.

As you've already worked out you need to allow anyone to try and use the radio but limit it to the actual unit by using the On Act box.

if (player == p36) then { hint "Roger That"};


If you want several player to use the radio then in a game logic place all the names into an array
array1= [ p34,p35,p36]

and in the On Act of the trigger
if (player in array1) then { hint "Roger That"};


This will only work in SP.

This post was edited by F2kSel (2011-01-31 17:53, ago)


Author Message

b1944  



Posts: 76
Rank:


Level: Member

Country: hu
Location:
Occupation:
Age:
In-game name:

 
#5 Posted at 2011-09-27 07:57        
     
# Marbakka : Multiplayer

There are 36 players and all are named (p1 to p36)

I want to give p36 the ability to control certain elements of the mission via the Radio commands. Actually, truth be told, I'd like for p34 and p35 to be able to use the commands as well, but I'd settle for just limiting it to p36.

I create the trigger with 0 radius and Radio Alpha selected (and a text line, of course). In the 'On Act' field I have it executing a vehicle spawn script which has been tested and is working properly. The question is: How can I make this radio trigger usable only to this particular player slot?. I have tried all of the following condition lines and they have failed when tested. (either because everyone gets the ability or because no one gets the ability)


player == p36;

p36 in thislist;

player == p36 || player == p35 || player == p34;


I have also tried making the trigger itself available to all but with an if/then/else statement in the 'On Act'. It failed miserably.

Also, when I grouped the trigger to the unit in question, no one could even see the radio options anymore (it was as though they did not exist).

Any ideas?

The easiest way to make a radio trigger usable by only certain players is this:

1, You have a radio trigger but put NULL in its text field. (This way it will be "hidden" for all the players). It is activated by e.g. radio alpha.
2, You make a script (or a trigger) which starts with

if (player == X) then
{
1 setRadioMsg "The text you need";
You put the rest of the script or the trigger activation commands here if there are other things you need.
};

where X is the name of the player you want to be able to use the radio trigger.

This way the radio option becomes "unhidden" for a particular player only and you can have different radio commands available for different players.

If you use the if command as decribed above you can also make sure that a particular script runs on one computer only. It's useful in multiplayer games. For example, I made a mortar support script which is usable by one player only.

If you have any question just ask as I have just spent several hours trying to figure out how to do that.

This post was edited by b1944 (2011-09-29 07:24, ago)


Author Message

Dead3yez  

I am evil


Posts: 3113
Rank:


Level: Member

Country: en
Location: North Yorkshire
Occupation: dead3yez
Age: 28
In-game name: dead3yez

 
#6 Posted at 2011-09-27 19:19        
     
#method 1
In the condition of the trigger that you already have.

If you just want the player to get the radio option added to their screen from mission start then use this code.
(player == p36)

This for the 3 players players.
({player} count [p34, p35, p36] > 1)

If you wanna use trigger parameters too then (radius and other conditions). If you have certain parameters / custom condition set for the trigger. "this" is the parameters you already have set on the trigger itself.
this && (player == p36)
this && whateverconditionyouset && (player != p36)



#method 2
Removing the radio message.

Create a new trigger with a countdown or synchronisation to the radio trigger you have set up, activates on or after the condition is met. A countdown of one second (so it is removed one second after joining the mission) would be enough if you have synchronise problems.

if (player != p36) then {1 setRadioMsg "NULL"};

this should work too, i think:

if ({player} count [p34, p35, p36] < 1) then {1 setRadioMsg "NULL";


NOTE: Method 1 will still show the radio message, but will not allow it to be used by any players other than specified. Using both methods together will work best.
-------------

Hopefully you understand.
Also, stuff like this would be far less messy if using script files rather than triggers ingame. Though, both still work. :)

This post was edited by Dead3yez (2011-09-27 19:52, ago)