Storfigge
Member
Posts: 101
Threads: 31
Joined: Sep 2012
Reputation:
0
|
Break boards with hammer and chipper
I've made a hammer and a chipper which is located on different maps. Once you have them both you combine them and are suppose to break some boards(wooden_boards_block) covering a door. What am I suppose to write to make this happen? Also I have made an inventory.hps which the hammer and chipper code is in
void hammer_chipper(string &in asItemA, string &in asItemB)
{
PlayGuiSound("15_make_hammer", 1.0f);
RemoveItem(asItemA); RemoveItem(asItemB);
GiveItem("stone_hammer_chipper", "Puzzle", "stone_hammer_chipper", "stone_hammer_chipper.tga", 0);
}
void OnGameStart()
{
AddCombineCallback("hammer_chipper", "stone_hammer_1", "stone_chipper_1", "hammer_chipper", false);
Thanks.
|
|
12-14-2012, 05:12 PM |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
RE: Break boards with hammer and chipper
So, in your script:
void OnStart()
{
AddUseItemCallback("", "stone_hammer_chipper", "wooden_boards_block", "FUNC", true);
}
void FUNC (string &in asItem, string &in asEntity)
{
SetPropHealth("wooden_boards_block", 0);
///Other things (Remove item, etc)
}
You forgot a bracket in void OnGameStart()
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
12-14-2012, 05:16 PM |
|
Storfigge
Member
Posts: 101
Threads: 31
Joined: Sep 2012
Reputation:
0
|
RE: Break boards with hammer and chipper
(12-14-2012, 05:16 PM)The chaser Wrote: So, in your script:
void OnStart()
{
AddUseItemCallback("", "stone_hammer_chipper", "wooden_boards_block", "FUNC", true);
}
void FUNC (string &in asItem, string &in asEntity)
{
SetPropHealth("wooden_boards_block", 0);
///Other things (Remove item, etc)
}
You forgot a bracket in void OnGameStart()
Sorry for replying like a month later I've been a bit busy... The code doesn't work. This is what I did
"Inventory.hps"
void hammer_chipper(string &in asItemA, string &in asItemB)
{
PlayGuiSound("15_make_hammer", 1.0f);
RemoveItem(asItemA); RemoveItem(asItemB);
GiveItem("stone_hammer_chipper", "Puzzle", "stone_hammer_chipper", "stone_hammer_chipper.tga", 0);
}
void OnGameStart()
{
AddCombineCallback("hammer_chipper", "stone_hammer_1", "stone_chipper_1", "hammer_chipper", false);
}
"floor_2.hps"
void Onstart()
{
AddUseItemCallback("", "stone_hammer_chipper", "wooden_boards_block_1", "FUNC", true);
}
void FUNC (string &in asItem, string &in asEntity)
{
SetPropHealth("wooden_boards_block_1", 0);
RemoveItem("stone_hammer_chipper");
}
void OnEnter()
{
}
void OnLeave()
{
}
I can combine the hammer and chipper but when I use it on the wooden boards they don't break. It says like "You can't use this item" or something you know.
(This post was last modified: 01-02-2013, 06:12 PM by Storfigge.)
|
|
01-02-2013, 06:11 PM |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
RE: Break boards with hammer and chipper
Weird... check names, the "Cannot Use this item this way" is a name problem.
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
01-02-2013, 06:34 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Break boards with hammer and chipper
Remember to have capitals in OnStart
Trying is the first step to success.
|
|
01-02-2013, 07:05 PM |
|
Storfigge
Member
Posts: 101
Threads: 31
Joined: Sep 2012
Reputation:
0
|
RE: Break boards with hammer and chipper
(01-02-2013, 07:05 PM)beecake Wrote: Remember to have capitals in OnStart
Oh lol I forgot the capital letter xD thank you!
|
|
01-02-2013, 07:35 PM |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
RE: Break boards with hammer and chipper
How could I miss that...
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
01-02-2013, 08:08 PM |
|
|