Jump to content
Sign in to follow this  
Dorian Gray

So, is it possible to make more than one unit "radioman" (in MP) or not?

Recommended Posts

I've come across a few threads asking a similar question, but they died off. I wanted to be able to call a script using radio alpha, without being team leader, since I can't get the following to work correctly:

I have been having trouble with addaction - on top of that, keeping the action in my unit's menu after being revived/respawning with Norrin's revive script, without a bot triggering the script for me.

I make 4 player squad missions with my friend in which he plays team leader (we call him the traditional s1, just to keep it simple), and I am always s2, a FAC. We use the air support script by Draper in my unit. The reason this is relevant is, I am trying to give myself an action using an alternative method (other than in my unit's init field) - by studying the air support script. I call the action "New Weapon" because I am using ffur2007slx2_5's dynamic weapon generating script. At first I was spawning with a random weapon as desired by calling the script in my unit's init by doing as he instructed:

DW=[this] execVM "WCRffsx_fnc_DW.sqf";

and right after that adding the "New Weapon" action with:

this addAction ["New Weapon"", "WCRffsx_fnc_DW.sqf", 0 , 0, false];

That worked at mission start of course, but it took me quite a while to figure out the right (I thought it was right at the time) syntax to use in the NORRNCustomExec1= and NORRNCustomExec1=3 (call a script after being revived, and respawning at base, respectively, in case some of you aren't familiar with revive):

"nul=[s2] execVM 'WCRffsx_fnc_DW.sqf'; [s2] exec 'restore_menu.sqs';";

In restore_menu.sqs, I simply have:

s2 addAction ["New Weapon", "WCRffsx_fnc_DW.sqf", 0, 0 , false];

Another problem I have been having is multiple copies of the action in my menu; I think the most so far has been 5 "New Weapon"s in my menu.

To get to what I have been studying in the air support script, I have found what I think is how he adds the index of the menu in the "exitMenu.sqf", actually:

_man = _this select 1;

_man removeAction as1;
_man removeAction as2;
_man removeAction as3;
_man removeAction as4;
_man removeAction as5;

if(true)exitwith{as0 = _man addAction ["Air Support","airSup\addMenu.sqf",[], 10, false, false, "", "_target == s2"];};

Then there's what is called the "addMenu.sqf", which is called by "exitMenu.sqf":

_man = _this select 1;
_id = _this select 2;

_man removeAction _id;

if(jadam or lgb or cbuap or cbuat or cas or cbumine) then {as1 = _man addAction [localize "STR_MENUFXD","airSup\callFixed.sqf",[], 40, false, false, "", "_target == s2"];};
if(helo or trans) then {as2 = _man addAction [localize "STR_MENUHEL","airSup\callHelo.sqf",[], 30, false, false, "", "_target == s2"];};
as4 = _man addAction [localize "STR_MENUEXT","airSup\exitMenu.sqf",[], 10, false, false, "", "_target == s2"];

if(true)exitWith{};

Then "airSupInit" which has a ton of lines, but the important line I need from it I think is:

[_man] execVM "airSup\MPrespwn.sqf";

"MPrespwn.sqf" finally being:

_man = _this select 0;
if(alive _man) then {
as0 = s2 addAction [localize "STR_MENUASM","airSup\addMenu.sqf",[], 5, false, false, "", "_target == s2"];
};
waitUntil{!alive s2};
waitUntil{alive s2};
if(true)exitWith{[s2] execVM "airSup\MPrespwn.sqf"};

I realize that what I will need to do will involve 3 percent of this code, if I can just figure out the syntax, or if someone can help me. I am pretty new at scripting, but I am trying.

Share this post


Link to post
Share on other sites

without looking at all, try having a waituntil and then assign the action again.

Afaik when you die with norrin revive, your dead char is deleted and then its a null object wich basically means it does not exists, revive script creates a new one and assigns same name and initline to the new unit and you come to life again, this time without a action assigned if that was not in the init line.

create the action in a seperate script, after action is assigned to unit have a waituntil

//get the name (same as in editor) for later use.
_name = format["%1",_unit];
//wait until unit is no longer present.
waituntil {isNull _unit};
//wait until unit is present again.
waitUntil {!isNull _name};
//then run the addaction script again on the name.
[_name] execVM "addActionScript.sqf";

untested, maybe it will work better with alive and !alive instead of isNull.

Share this post


Link to post
Share on other sites

Maybe you can try this:

_handler = s2 addMPEventHandler ["Respawn",{DW = [s2] execVM "WCRffsx_fnc_DW.sqf"};];

Share this post


Link to post
Share on other sites

My friend and I were discussing leading two squads of our own anyway, so I just ended up placing a trigger off to the side and calling your script with Radio Alpha. You can't really call this a drawback, but in less my friend wants to be mean and change my weapon for me, he can call the script with the radio too. Thank you for your replies.

Share this post


Link to post
Share on other sites

I am having this problem too. It seems as though the revive functionality remembers the action that was added to the player before they died and automatically re-adds the action back to the player when they respawn. So if I have a trigger that detects when the player is alive and then adds the action to them, then the player uses the action and the action is removed, but when the player respawns they then have duplicate actions on their menu, and when they die and respawn again, the action then appears 3 times on their menu. This only happens when I use the norrins revive script.

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  

×