Jump to content
Sign in to follow this  
sproyd

A simple script to check if player has a particular backpack and NVGs equipped

Recommended Posts

A bit embarrasing but I can't seem to figure out a basic script to determine if the player has a particular backpack and NVGs both on his person at any given time.

I've set up this script

_backpack = unitBackpack player; 
if (("B_TacticalPack_mcamo" == typeof _backpack)) then {gotpack=true};

and then have the variable gotpack as the condition for a trigger but I can't seem to get it to work. The player basically needs to go up to a box and pick up a backpack and NVGs (I haven't got to the NVG bit yet).

I know this is probably kids play but I can't get it to work! Help from you awesome guys appreciated!

Share this post


Link to post
Share on other sites

Hi, try this. Untested.

if ((Player HasWeapon "NVGoggles") && (unitBackpack Player isKindof "B_TacticalPack_mcamo")) then {gotpack=true;};

  • Thanks 1

Share this post


Link to post
Share on other sites
Hi, try this. Untested.

if ((Player HasWeapon "NVGoggles") && (unitBackpack Player isKindof "B_TacticalPack_mcamo")) then {gotpack=true;};

Well the backpack part of your script worked but not the NVGs part - I'm guessing HasWeapon doesn't apply to NVGs - could I use http://community.bistudio.com/wiki/items somehow?

Share this post


Link to post
Share on other sites

Hmm.. that was some old code I pulled from an arma2 mission I had. I assumed it would work here too. You could try hasitem or something similar. Good luck.

Share this post


Link to post
Share on other sites

"NVGoggles" in (items player + assignedItems player)

Will make sure he has a set either worn or in his cargo. Remember NVGoggles is blufor the others are followed by their side name NVGoggles_OPFOR / NVGoggles_INDEP

Cover all

{_x in (items player + assignedItems player)}count ["NVGoggles", "NVGoggles_OPFOR","NVGoggles_INDEP"] > 0

Edited by Larrow

Share this post


Link to post
Share on other sites
Hmm.. that was some old code I pulled from an arma2 mission I had. I assumed it would work here too. You could try hasitem or something similar. Good luck.

hasItem is not a scripting command unfortunately...

---------- Post added at 12:43 ---------- Previous post was at 12:42 ----------

"NVGoggles" in (items player + assignedItems player)

Will make sure he has a set either worn or in his cargo. Remember NVGoggles is blufor the others are followed by their side name NVGoggles_OPFOR / NVGoggles_INDEP

Cover all

{_x in (items player + assignedItems player)}count ["NVGoggles", "NVGoggles_OPFOR","NVGoggles_INDEP"] > 0

Thanks mate that's just the kind of simple and effective code I was looking for. Will test it later tonight. I wasn't aware that the various factions had different classnames for their NVGs - what's the point in that? Unless they use different models/textures which I'm not sure they do unless that's a new addition.

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  

×