Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Item Interaction
Scorch 169 Offline
Junior Member

Posts: 3
Threads: 2
Joined: Aug 2013
Reputation: 0
#1
Item Interaction

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.
08-13-2013, 03:49 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Item Interaction

void OnStart()
{
AddUseItemCallback("", "Bone_Saw", "Wooden_Board", "BreakBoard", true);
}

void BreakBoard(string &in asItem, string &in asEntity)
{
SetEntityActive("Wooden_Board", false);
SetEntityActive("Broken_Board", true);
}

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.

"Veni, vidi, vici."
"I came, I saw, I conquered."
08-13-2013, 06:48 AM
Find
Slanderous Offline
Posting Freak

Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation: 63
#3
RE: Item Interaction

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
08-13-2013, 03:32 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Item Interaction

(08-13-2013, 06:48 AM)JustAnotherPlayer Wrote:
void OnStart()
{
AddUseItemCallback("", "Bone_Saw", "Wooden_Board", "BreakBoard", true);
}

void BreakBoard(string &in asItem, string &in asEntity)
{
SetEntityActive("Wooden_Board", false);
SetEntityActive("Broken_Board", true);
}

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.

Instead of having 2 entities, using SetPropHealth("Wooden_Board", 0); would do the same thing.

Trying is the first step to success.
08-13-2013, 09:36 PM
Find




Users browsing this thread: 1 Guest(s)