-J4F- Thunder666 10 Posted May 5, 2013 hi, how do I check if the player has a specific ITEM? Is this possible with a trigger? And how would the syntax look like? thx in advance! Share this post Link to post Share on other sites
Larrow 2822 Posted May 5, 2013 this && ("NVGoggles" in (items player) || "NVGoggles" in (assigneditems player)) Should be good for the trigger condition 1 Share this post Link to post Share on other sites
-J4F- Thunder666 10 Posted May 5, 2013 wow works phantastic but now i know i need it for Inventory and a primary weapons Check. I need to check the new Items loke Surpressors , Optics and so on. Maybe you can give me second Solution for the Weapons Check pleeaaase ? :) thx in advance Share this post Link to post Share on other sites
-J4F- Thunder666 10 Posted May 6, 2013 solved :) you are my hero for tonight :) Share this post Link to post Share on other sites
cobra4v320 27 Posted September 24, 2013 (edited) Can you post your solution as I am searching for the same thing. I have tried: if ((player weaponAccessories primaryWeapon player) select 2 == "") exitWith { hint "Select an Optic for your rifle" }; ---------- Post added at 00:52 ---------- Previous post was at 23:57 ---------- Figured it out: if (primaryWeaponItems player select 2 == "") exitWith {hint "no optics"}; select 0 = suppressor select 1 = laser select 2 = optic ---------- Post added at 01:21 ---------- Previous post was at 00:52 ---------- This does not work, no reported script errors and no hint: if (primaryWeapon player == "" && primaryWeaponItems player select 2 == "") exitWith {hint "Choose a weapon and optic first."}; Edited September 24, 2013 by cobra4v320 Share this post Link to post Share on other sites
Larrow 2822 Posted September 24, 2013 (edited) This does not work, no reported script errors and no hint:Code: if (primaryWeapon player == "" && primaryWeaponItems player select 2 == "") exitWith {hint "Choose a weapon and optic first."}; Does for me from the debug console, gives a divide by zero error, as if there is no weapon then index select 2 does not exist. hstring = "Please choose"; if (primaryWeapon player == "") then { hstring = hstring + " a primary weapon and"; }; if ((count (primaryWeaponItems player)) == 0 || {((primaryWeaponItems player) select 2) == ""}) then { hstring = hstring + " an optic"; }else{ hstring = ""; }; if(hstring != "") then { hint format["%1 first!",hstring]; }; Edited September 24, 2013 by Larrow Share this post Link to post Share on other sites
cobra4v320 27 Posted September 24, 2013 (edited) Using it in the debug console gave me no hint. Forgot that I switched from DEV branch to the normal version, just added in -showscripterrors. :/ ---------- Post added at 02:32 ---------- Previous post was at 02:27 ---------- I just need to make sure the player has a weapon and optic before continuing the script. Edited September 24, 2013 by cobra4v320 Share this post Link to post Share on other sites
kylania 568 Posted September 24, 2013 Just give them one if it's so critical? Share this post Link to post Share on other sites
cobra4v320 27 Posted September 24, 2013 (edited) Its a dialog menu, I want the player to have both before exiting the menu. Edited September 24, 2013 by cobra4v320 Share this post Link to post Share on other sites
kylania 568 Posted September 24, 2013 Ok so default to a gun + scope when you exit but allow options Share this post Link to post Share on other sites
Pac Man 10 Posted September 24, 2013 (edited) Disable the escape key & those insertion method buttons until the weapons condition is met. Assuming those buttons close the dialog & spawn the unit somewhere. This will prevent the dialog from closing & the player having no loadout. Or you can simply set a default weapon and optics. So even if the dialog is closed, they have those things. example: DisableSerialization; noesckey = (findDisplay 3000) displayAddEventHandler ["KeyDown", "if ((_this select 1) == 1) then {True}"]; {ctrlEnable [_x, False]} ForEach [6100,6101,6102,6103,6104]; WaitUntil { ... Weapon conditions ... }; (findDisplay 3000) displayRemoveEventHandler ["KeyDown", noesckey]; {ctrlEnable [_x, true]} ForEach [6100,6101,6102,6103,6104]; Edited September 24, 2013 by Pac Man Share this post Link to post Share on other sites
kylania 568 Posted September 24, 2013 :eek: Please don't disable player input for something you can default to effortlessly. If you want someone to have a gun with a scope give them one. Then let them change the scope or the gun if they don't want that one. Don't turn off their control of their client. That's insane. :) Open dialog, give 'em a weapon and a scope then say "This is your weapon now, like it? No? Pick something else then". 1 Share this post Link to post Share on other sites
Pac Man 10 Posted September 24, 2013 (edited) Yup, I agree. But sometimes those commands are very useful & can't be avoided in certain circumstances. This isn't one of them :). Very good commands to know though. In this case, I'd simply have a default weapon & optics. Edited September 24, 2013 by Pac Man Share this post Link to post Share on other sites
cobra4v320 27 Posted September 24, 2013 Insert menu buttons are disabled until you pick a weapon. if (primaryWeapon Player == "") exitWith {hint "Choose a weapon first."}; closedialog 0; Thanks for the ideas, I will figure something out. Share this post Link to post Share on other sites
baeksnip 10 Posted November 18, 2013 Could give me some sample on creating a object detector present in the inventory? Thanks. Share this post Link to post Share on other sites