Jump to content

Knifedge

Member
  • Content Count

    4
  • Joined

  • Last visited

  • Medals

Community Reputation

1 Neutral

About Knifedge

  • Rank
    Rookie
  1. Grumpy Old Man - thanks again, that worked.
  2. HI, I have created the below piece of code which to me looks like it should. I get no errors when running the mission, there is nothing in the RPT log on server or client. Can someone please help me identify where I have gone wrong? The below script gets called in client init, I have other scripts adding in actions at this point and they are working OK. private ["_casAmmoCost", "_casFuelCost", "_availableCASCallers"]; _casAmmoCost = 85; _casFuelCost = 20; _availableCASCallers = ["Radioman", "Squad Leader", "Team Leader", "Commander"]; _c = "<t color='#f20000'>"; _callCASAction = [_c + "Call CAS Strike</t>", { _attachedTo = (_this select 0); _actionCaller = (_this select 1); titleText ["Click to mark CAS Target location.", "PLAIN"]; openMap [true, false]; ["call_cas_" + name player, "onMapSingleClick", { titleText ["", "PLAIN"]; _markerName = "CASSTRIKEMARKER_" + (str _pos); _marker = createMarker [_markerName, _pos]; _marker setMarkerType "hd_objective"; _marker setMarkerColor "ColorRed"; _marker setMarkerText format["CAS Strike (Marked by %1)", name player]; fnc_RemoveResources = { private ["_casAmmoCost", "_casFuelCost"]; _casAmmoCost = _this select 0; _casFuelCost = _this select 1; resources_ammo = resources_ammo - _casAmmoCost; resources_fuel = resources_fuel - _casFuelCost; }; [_casAmmoCost, _casFuelCost] remoteExec ["fnc_RemoveResources", 2]; _center = createCenter sideLogic; _group = createGroup _center; _cas = _group createUnit ["ModuleCAS_F",_pos , [], 0, ""]; _cas setVariable ["vehicle","B_Plane_CAS_01_F",true]; _cas setVariable ["type", 2,true]; ["call_cas_" + name player, "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler; true; fnc_RadioMessage = { private ["_side", "_alias", "_message"]; _side = _this select 0; _alias = _this select 1; _message = _this select 2; [_side, _alias] sideRadio _message; }; [west, "AirBase", format["Roger that %1, CAS Strike Inbound at grid %2, clear the target area immediately.", name player, (mapGridPosition _pos)]] remoteExec ["fnc_RadioMessage, -2]; hint format ["CAS Strike Inbound %1", (mapGridPosition _pos)]; openMap [false, false]; fnc_CleanUpMarker = { private "_marker"; _marker = _this; deletion = _marker spawn { private ["_pmarker", "_markerTimer"]; _pmarker = _this; _markerTimer = 1; while { _markerTimer < 30 } do { uiSleep 30; _markerTimer = _markerTimer + 30; }; deleteMarker _pmarker; }; }; _marker remoteExec ["fnc_CleanUpMarker", 2]; }, []] call BIS_fnc_addStackedEventHandler }, [], 0, false, true, "", "true", -1, false, "", ""]; _this addAction _callCASAction; if (roleDescription _this in _availableCASCallers) then { _this addAction _callCASAction; }; _this addEventHandler ["Respawn",{ if (roleDescription (_this select 0) in _availableCASCallers) then { (_this select 0) addAction _callCASAction; }; }]; Any help appreciated, thanks.
  3. Brilliant, thankyou :), reading up on https://community.bistudio.com/wiki/player makes sense as the command is executed on each client.
  4. Can someone please help me on the below: The script is working correctly bar one thing. When the marker is added to the map I want it to have in brackets (Marked by <playerName>) however currently it just adds "CAS Target (Marked by any)" Can someone explain why the name command is not returning the name of the player? I have in the Init box of the unit in the editor: nul = [this] execVM "scripts\add_markcastarget_action.sqf"; This is add_markcastarget_action.sqf _currentPlayer = _this select 0; _playerName = name _currentPlayer; sleep 10; fnc_addActionMP = { private["_object", "_screenMsg", "_scriptToCall"]; _object = _this select 0; _screenMsg = _this select 1; _scriptToCall = _this select 2; if(isNull _object) exitWith {}; _object addaction [_screenMsg,_scriptToCall]; }; [_currentPlayer, "<t color='#f20000'>" + "Mark CAS Target" + "</t>", { titleText ["Click to mark CAS Target location.", "PLAIN"]; openMap [true, false]; _attachedTo = (_this select 0); ["mk_cas", "onMapSingleClick", { titleText ["", "PLAIN"]; _markerName = "CASMARKER_" + (str _pos); _marker = createMarker [_markerName, _pos]; _marker setMarkerType "hd_destroy"; _marker setMarkerColor "ColorRed"; _marker setMarkerText format["CAS Target (Marked by %1)", _playerName]; ["mk_cas", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler; true; }, [_attachedTo]] call BIS_fnc_addStackedEventHandler } ] remoteExec ["fnc_addActionMP"];
×