[SCRIPT] Item Interaction - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: [SCRIPT] Item Interaction (/thread-22402.html) |
Item Interaction - Scorch 169 - 08-13-2013 Item Interaction I need to create a code for an item interation with the wooden board entity. I have made a bone saw nearby and I need to use the bone saw on the wood and set the entity to the broken board. I tried comparing this to keys but this uses different coding. I am new to amnesia scripting but I have done lots of scripting in other programs. So if I could get some information on the code it will help me understand more. Thankyou. RE: Item Interaction - PutraenusAlivius - 08-13-2013 Code: void OnStart() That's the code. Bone_Saw is the Item you use the Entity on. Wooden_Board is the board that gets replaced by the broken one and the Entity the Item is used on. Broken_Board is the broken board. Please note that the bone saw has to be an item in your inventory. RE: Item Interaction - Slanderous - 08-13-2013 void OnStart() { AddUseItemCallback("", "bonesaw", "woodenboards", "func", true); } void func(string &in asItem, string &in asEntity) { SetEntityActive("wooden boards (normal)", false); SetEntityActive("wooden boards (broken one)", true); PlaySoundAtEntity("", "break_wood.snt", "Player", 0, false); RemoveItem("bonesaw"); //you can delete this line if you want to keep bonesaw in inventory. } hope it helps :p RE: Item Interaction - FlawlessHappiness - 08-13-2013 (08-13-2013, 06:48 AM)JustAnotherPlayer Wrote: Instead of having 2 entities, using SetPropHealth("Wooden_Board", 0); would do the same thing. |