-FW- Shaanguy 10 Posted February 10, 2015 in my init.sqf all i want is to make my own inventory made up from script, like Wasteland Inventory, the problem here is, my two steps are correct, but step three is incorrect, i dont know how to check the item!? :butbut: in my scripted INV, it has to be like this if (player getVariable "INV" == "BLA1") then {BLA BLA BLA}; _otherItems = ["BLA1","BLA2","BLA3"]; player setVariable ["INV", _otherItems]; and then i went back to the game, and used this code Hint format ["%1", player getVariable "INV"]; well the hint works fine, it shows the inventory objects , so i putted a addaction to a unit, this addaction ["Check BLA1","Checker.sqf"]; Checker.sqf if (player getVariable "INV" == BLA1) then { Hint "you have BLA1!"; }; init.sqf // Worked! Hint // Worked! Checker.sqf: Checking if i have the item // Not working! I dont know how to check the item O_o, For Newbies: remember i am using my own inventory system made up from script, not game inventory xD Share this post Link to post Share on other sites
Schatten 287 Posted February 10, 2015 player getVariable "INV" returns ["BLA1","BLA2","BLA3"] So (player getVariable "INV") select 0 returns "BLA1". Share this post Link to post Share on other sites
dreadedentity 278 Posted February 10, 2015 A better way to do this would be to use the in command: if ("BLA1" in (player getVariable "INV")) then { Hint "you have BLA1!"; }; Share this post Link to post Share on other sites
chiefblackdawg 10 Posted February 10, 2015 Thank you for this informative info, I hope I can start to catch on soon. Shaanguy;2878159']in my init.sqfall i want is to make my own inventory made up from script' date=' like Wasteland Inventory, the problem here is, my two steps are correct, but step three is incorrect, i dont know how to check the item!? :butbut: in my scripted INV, it has to be like this if (player getVariable "INV" == "BLA1") then {BLA BLA BLA}; _otherItems = ["BLA1","BLA2","BLA3"]; player setVariable ["INV", _otherItems]; and then i went back to the game, and used this code Hint format ["%1", player getVariable "INV"]; well the hint works fine, it shows the inventory objects , so i putted a addaction to a unit, this addaction ["Check BLA1","Checker.sqf"]; Checker.sqf if (player getVariable "INV" == BLA1) then { Hint "you have BLA1!"; }; init.sqf // Worked! Hint // Worked! Checker.sqf: Checking if i have the item // Not working! I dont know how to check the item O_o, For Newbies: remember i am using my own inventory system made up from script, not game inventory xD[/quote'] Share this post Link to post Share on other sites
-FW- Shaanguy 10 Posted February 11, 2015 Thanks This works if ("BLA1" in (player getVariable "INV")) then { Hint "you have BLA1!"; }; now to find a way how to remove a variable xD, Share this post Link to post Share on other sites
Schatten 287 Posted February 11, 2015 Shaanguy;2878731']now to find a way how to remove a variable xD' date='[/quote'] player setVariable ["INV", (player getVariable "INV") - ["BLA1"]]; Share this post Link to post Share on other sites
jshock 513 Posted February 11, 2015 Set the value of the variable to nil. player setVariable ["VarName",nil]; Nvm... Share this post Link to post Share on other sites
-FW- Shaanguy 10 Posted February 13, 2015 thanks all for the variable informations, i am not good at pro scripting variables, but i know the basics :D, i am having a other problem also, is there anyway to set a variable to that Bla1 like [["BLA1", 53],["BLA2", 45]] and remove like this >_> // 24- from BLA1, like that maybe, player setVariable ["INV", (player getVariable "INV") - ["BLA1", 24]]; Share this post Link to post Share on other sites
jshock 513 Posted February 13, 2015 If your variable had that info in it yes, that should work, i.e.: player setVariable ["INV",[["BLAH",24],["BLAH,53"],["BLAH",45]]]; //later on player setVariable ["INV",(player getVariable "INV") - ["BLAH",24]];//should set the variable to just [["BLAH,53"],["BLAH",45]] Share this post Link to post Share on other sites
-FW- Shaanguy 10 Posted February 13, 2015 woah i think i am knowing some more information about variables, thanks JShock Share this post Link to post Share on other sites