Feint 137 Posted February 7, 2014 I want to be able to apply a useraction to an item via a config. But I can't get it to work with the usual useraction config entries. For example: class Land_TentA_CGPLUS_folded_F: ItemCore { mapSize = 0.44; author = "Feint"; _generalMacro = "Land_Sleeping_bag_folded_F"; scope = 2; displayName = "Tent (A-Shape) packed PLUS"; descriptionShort = "This packed tent can be assembled into a tent"; picture = "\A3\Weapons_F\Items\data\UI\gear_Toolkit_CA.paa"; model = "\A3\Structures_F\Civ\Camping\Sleeping_bag_folded_F.p3d"; class ItemInfo: TentPackedItem { mass = 80; uniformModel = "\A3\Structures_F\Civ\Camping\Sleeping_bag_folded_F.p3d"; }; //icon = "iconObject_2x1"; //vehicleClass = "Tents"; //destrType = "DestructNo"; //cost = 100; //waterLeakiness = 1; class UserActions { class UNPACKTENTA { displayName = "Pitch Tent"; priority = 0; shortcut = ""; condition = "true"; statement = "[this] execVM ""\A3_campingGearPlus\scripts\tentA_unPack.sqf"""; displayNameDefault = ""; position = "camo"; // pilotcontrol radius = 5; onlyforplayer = 1; }; }; How do I apply an action to an item that can be in your inventory? Thanks in advance! Share this post Link to post Share on other sites
lappihuan 178 Posted February 7, 2014 In this post i describe exactly what you want. E: You would probably also need a Init EH to check if the Item is at the Init already in the inventory. Share this post Link to post Share on other sites
Feint 137 Posted February 7, 2014 That's clever. Thanks! Share this post Link to post Share on other sites
Feint 137 Posted February 7, 2014 (edited) Is there any way to have the action applied directly to the item itself? The event handler "take" and "put" give the classname of the item, but not the name of the item object. I could add an addAction to the player which has a condition of only looking at that classname, but that could get complicated with adding and removing addActions and checking if addActions have already been added, etc. Once the item is out of my inventory, it's contained in a groundWeaponHolder. I can add actions to that via cursorTarget addAction..., but that's a weird workaround too. Edited February 7, 2014 by Feint Share this post Link to post Share on other sites
j0nes 194 Posted February 7, 2014 you might be able to configure it as a satchel charge. then set the damages to zero and make it not be able to be activated as anything. Then set model = "model_of_pitched_tent.p3d"; (this would pitch the tent as soon as you place the "charge" minemodeldisabled = "model_of_roled_up_tent.p3d"; (this would be the folded model after you hit the "deactivate mine" option. youd also have to set a couple other things like disabling the red triangle mine icon, and the "beep" when you place and pack up a mine. plus make the visibility of it reaaaallly low so people dont walk by it and say "MINE DETECTED!". unfortunately the only action to unpack the tent would be the "deactivate mine" one. but there might be a way to change that OR you could configure it as a backpack with no inventory slots that youre allowed to put in your other backpack. then you could make the assemble "static weapon" as assemble/disassemble tent Share this post Link to post Share on other sites
Feint 137 Posted February 8, 2014 Thanks for the ideas, but I already have everything working. I'm just trying to finish this addon up with this last problem because I know everyone will request it if I don't (putting the items into the inventory). Are there any inventory items that run scripts from actions? If I can just find an example, I can work off of that. Share this post Link to post Share on other sites
lappihuan 178 Posted February 10, 2014 Hmm, i don't think there is another option. What Jones suggessed are very good ideas, i would work with the backpack solution. You could look at the DayZ code to see how tents are done there, but i bet it's done as drity as you described it in post #4... Share this post Link to post Share on other sites
Feint 137 Posted February 12, 2014 Yeah, the backpack idea is looking better to me. Thanks for the feedback and input, guys. Share this post Link to post Share on other sites