Jump to content
Sign in to follow this  
CombatComm

how to Name items eg: radios

Recommended Posts

Hey all! I just recently mastered the if then else and it rejuvinated my interest in mission making. So I was hoping someone could either point me in the right direction or tell me how to name items such as radios. In order for say applying a script to an item. calling on the radio or NVGs etc in a script. In my mission I want the radio to actulley be vital. playsounds to come from the radio and no sidechat unless the player is within 5 meters of the radio things like that. Thank you in advance for your help.

Share this post


Link to post
Share on other sites

Hi,

I don't think it's possible to name weapons or items. You will have to work with the classname instead.

I.e.

Check if player has a radio:

if (player hasWeapon "ItemRadio") then { hint "I have a radio!"; };

Check if there's a radio lying on the ground (within 50m):

_holder = (nearestObject [player, "WeaponHolder"]);

if (!(isNull _holder)) then { // Weapon holder found

if ((player distance _holder) > 5) exitWith { hint "its more than 5m away!"; };

_content = getWeaponCargo _holder;
if ("ItemRadio" in _content) then { hint "There is a radio close by, lying on the ground!"; };
};

Not 100% sure, if the second example will work like that (untested).

I hope that helps a bit.

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  

×