Forum Jump :

Author Message


Posts: 18
Rank:


Level: Member

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

 
#1 Posted at 2017-08-18 11:28        
     
Hi good sirs

Appologies if I'm posting this in the wrong section.

I'm creating a MP PvP mission where if the blufor shoot too many civilians, the resistance players are able to get the current radio channel that blufor are using.

I've tried:
_allWEST = group H1;
_leader = leader _allWEST;
_channel = (group _leader) getVariable ["tf_sw_frequency"];
Hint format ["Channel is %1", _channel];


but I get:
Error 1 elements provided, 2 expected

Also, if nobody is playing the "H1" slot I get:
Error Undefined variable in expression: H1

Any help or comments appreciated.


Author Message


Posts: 1522
Rank:


Level: Member

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

 
#2 Posted at 2017-08-18 12:23        
     
Try removing the square brackets around "tf_sw_frequency", it's not wrong but may not be needed here.

as for H1 issue you may need to check if it exists

if (isNull group H1) exitWith {};

I'm not sure about that one i5t should work for a unit not sure about groups.


Advertisement


Author Message


Posts: 18
Rank:


Level: Member

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

 
#3 Posted at 2017-08-19 01:21        
     
It's great when one of the Master Scripters comes to the rescue. Thanks F2kSel!
Yes - removing the square brackets helped in this case, and I got a whole bunch of stuff returned in the variable (more than a bargined for). Now I just need to try and decipher it and attempt to extract just the channel. Hmmm . . .

In regards to getting the required info from blufor, what I really need to know is how can I get the _leader variable if unit "H1" isn't being played. Say for example 2 people are playing the blufor side, and they have chosen slots "H3" and "H6"?

Thoughts?

I've also just found that the channel info returned through "tf_sw_frequency" seems to be the default settings at the beginning of the mission only. Any changes of frequencies are not reflected in the variable further through the mission.

This post was edited by Vapour (2017-08-19 01:43, 921 days ago)






Tags: Tfr, Channel, Variable