Map Markers visable only if player has "ItemRadio"?

AxeCain

Member
Would someone be able to help me with this?

I would like to create map markers and distress calls for crash sites but only have them visible if the player retrieves a radio from a dead NPC.

Here is the code i have written for the message. Unsure if it works though.
Code:
//Radio
if (player hasWeapon "ItemRadio") then {
    cuttext [format["YOU HAVE A RADIO"], "PLAIN DOWN"];
} else {
    cuttext [format["NO RADIO TEST"], "PLAIN DOWN"]};
Is there a way to keep some markers hidden until the player finds a radio?
 
Thank You for the reply.
Would this work then?
Code:
//Add to server_spawnCrashSite.sqf
_pathtotools = "admintools\tools\";
_EXECscript1 = 'player execVM "'+_pathtotools+'%1"';
 
//Radio add after spawn
if ("ItemRadio" in items Player) then this;
    [_EXECscript1,"dayzCrash.sqf"];
    //***Remaining Crash site code***
} else {
    //***Remaining Crash site code***
};
dayzCrash.sqf
Code:
wmc = [0.4, 0, 0, 1];                //Heliwrecks icon color
_bigASSmap = 15000;                    //Size of map (longest x or y) in meters
 
// End of configuration
if (isnil "mapm") then
{
    mapm = true;
    maphalf = _bigASSmap/2; mapscanrad = sqrt (2*maphalf*maphalf);
    _map = (findDisplay 12) displayCtrl 51;   
       
    titleText ["Heli Pilot Distress Call","PLAIN DOWN"];titleFadeOut 2;
    helicrashes = nearestObjects [[maphalf,maphalf],["UH1Wreck_DZ"],mapscanrad];
 
    titleText ["The helicopters last known position has been added to your map","PLAIN DOWN"];titleFadeOut 2;
    _mapdraw = _map ctrlSetEventHandler ["Draw", "_this call drawic;"];
    _minimapdraw = _mini_gpz ctrlSetEventHandler ["Draw", "_this call drawic;"];
};
drawic =
{
    if (!isnil "mapm") then
    {
        {if  (!isnull _x) then {_ctrl drawIcon ["\ca\air2\data\ui\icon_uh1y_ca.paa", wmc, getPosASL _x, 30, 30, 0, "", 1];};} foreach helicrashes;
    };
};
 
Code:
if ("ItemRadio" in items Player) then this;

"this" refers to the object that will be activated. In my case, this was a trigger with a sound and this was the init for it. So you have to modify it for what you want.

Are you trying to display an area or grid ref corresponding to a crash site?
 
I see what you are trying to do now.


Try this:
Code:
//Add to server_spawnCrashSite.sqf
_pathtotools = "admintools\tools\";
_EXECscript1 = 'player execVM "'+_pathtotools+'%1"';
 
//Radio add after spawn
_playerRadio = "ItemRadio" in items player;
 
if (_playerRadio) then {
    [_EXECscript1,"dayzCrash.sqf"];
    //***Remaining Crash site code***
} else {
    //***Remaining Crash site code***
};


I think for dayz ItemRadio is "in weapons player" not sure. Try both, see if either or works.
 
I think for dayz ItemRadio is "in weapons player" not sure. Try both, see if either or works.
It seems that "items" and "weapons" both work.
This is what I have come up with to simplify. For starters. Add to server_spawnCrashSite.sqf
This is not tested. Does it look like it will work?
Code:
//Radio   
_playerRadio = "ItemRadio" in items player;
   
if (_playerRadio) then {
    cuttext [format["Heli Pilot Distress Call"], "PLAIN DOWN"];
    sleep 10;
    cuttext [format["A Marker has been added to the map! Hurry!"], "PLAIN DOWN"];
    {setMarkerTypeLocal "mil_unknown"} foreach {"helicrash"};
};
 
I would assume so. Basically its saying

If this player has Item Radio then on screen text "Heli Pilot Distress Call"

sleep the script for 10 seconds

on screen text "A marker has been added to the map! Hurry!"

then adds a map marker to the heli location.


Seems like it should work. Test it out and let me know. I can think of some other great uses for this :)
 
It seems that "items" and "weapons" both work.
This is what I have come up with to simplify. For starters. Add to server_spawnCrashSite.sqf
This is not tested. Does it look like it will work?
Code:
//Radio 
_playerRadio = "ItemRadio" in items player;
 
if (_playerRadio) then {
    cuttext [format["Heli Pilot Distress Call"], "PLAIN DOWN"];
    sleep 10;
    cuttext [format["A Marker has been added to the map! Hurry!"], "PLAIN DOWN"];
    {setMarkerTypeLocal "mil_unknown"} foreach {"helicrash"};
};

What if we want to make it so you can only see map markers that other players make when you have a radio? Also i would like to use the radio to make some kind of Personal Message Machine. Maybe even add something into the database so you can leave people messages when they are offline.
 
Back
Top