OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: Captain on 11 Jun 2007, 10:50:18
-
Thankyou Mr Peanut, I hope to submit this to the Missions Depot at some point. It's based on the BAS_f Framework and uses IgorDrugov'(sp?) Platoon Control Panel among other scripts. It's a small scale coop mission for about 6 player as Igor' PCP has issues on a dedicated server, that and I have few real life ArmA players to LAN with. So for the same mission but a different script (of which I have no reference script) I was hoping you could whip up a small script that would check when unit A was within 5 meters of unit B and that unit B has the item "MAP_Radio" in his inventory, all things being true unit A should then have an addaction assigned that says something like "Platoon Control", once clicked it should launch this line...
[] exec "PCP\Client\DlgControl.sqs"
I'm sorry I'm a bit scripting crap. I know how to use them and have modified many but trying to write them myself... well it's like a monkey attempting shakespeare. :(
-
It will work only for units in the same group. In init for each playable unit:
nul = [this] execVM "radiocheck.sqf"If you need it to JIP combatible then you need to add that code line to your init.sqf/sqs instead.
Script radiocheck.sqf
if (isPlayer _this) then
{
_grp = group player;
while {TRUE && alive player} do
{
waitUntil {{player distance _x < 5 && alive _x && "MAP_RADIO" in weapons _x && _x != player && alive player} count units _grp > 0};
radioID = player addAction["Use Radio","PCP\Client\DlgControl.sqs", [], 0, false, false, ""];
waitUntil {{player distance _x < 5 && alive _x && "MAP_RADIO" in weapons _x && _x != player && alive player} count units _grp < 1};
player removeAction radioID;
};
};
Hopefully, the dialog will open quickly enough to prevent multiple instances i.e. player clicks on the actio nagain beore dialog has opened.
-
hmmm, no joy Mr.Peanut. I get an 'Error invalid number in expression C:\Docum..........\ArmA\MPMissions\missionname\radiocheck.sqf Line1' :dunno:
-
Arf! I see one problem! I was assuming that each unit would be filled by a player.
Change init line to:
nul = this execVM "radiocheck.sqf"
And change first line in the script to:
if (isPlayer _this) then
I do not think this is the bug causing the error message but it is a bug none the less. Have made these changes to my previous post.