himynamebob1
Member
Posts: 57
Threads: 12
Joined: Jun 2012
Reputation:
0
|
[HELP] Keg Pop
Hi, I'd like to make it so my dagger that the user can find is able to puncture through a keg to allow it to flow out the containments, here is my code
//===========================================
// This runs when the player enters the map
void OnEnter()
{
AddUseItemCallback("popgoesthekeg", "breakkegknife", "winekeg", "boomkegopen", true);
}
void boomkegopen(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("bruto2", "put_knife.snt", "Player", 0.0f, false);
SetEntityActive("breakkeg_1", true);
}
But, when approached with the knife and attempted to be used on it says "No object to use item on" or something like that.
|
|
06-30-2012, 01:51 AM |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
RE: [HELP] Keg Pop
Some entities can't be interacted with in such a way, luckily, there's a way to work around it. Simply create a script area (8 in the level editor>Script) and make it roughly the same size as the keg (try to make it as close as possible), and make sure it completely surround the keg entity. Next, select the script area, and press the "Area" tab. Make sure "Item Interaction" is checked. Name this script area whatever you'd like.
For the scripting portion, instead of using the actual keg's name as the entity for the knife to be used on, replace it with the name of the script area.
void OnStart()
{
AddUseItemCallback("", "breakkegknife", "NAMEOFSCRIPTAREA", "boomkegopen", true);
}
void boomkegopen(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("bruto2", "put_knife.snt", "Player", 0.0f, false);
SetEntityActive("breakkeg_1", true);
}
Hope that helped.
I rate it 3 memes.
|
|
06-30-2012, 02:11 AM |
|
himynamebob1
Member
Posts: 57
Threads: 12
Joined: Jun 2012
Reputation:
0
|
RE: [HELP] Keg Pop
Thank you lots.
Actually, still having problems, here's my area.
(This post was last modified: 06-30-2012, 03:51 AM by himynamebob1.)
|
|
06-30-2012, 02:57 AM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: [HELP] Keg Pop
You have to go more on detail. What's wrong? Do you get an error message, or something just won't work?
|
|
06-30-2012, 11:08 AM |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
RE: [HELP] Keg Pop
If you can interact with it, tell me exactly what you are trying to accomplish in game and how you are trying to do it with your scripts. The more information you give us the more likely we can effectively help you.
I rate it 3 memes.
|
|
06-30-2012, 01:11 PM |
|
himynamebob1
Member
Posts: 57
Threads: 12
Joined: Jun 2012
Reputation:
0
|
RE: [HELP] Keg Pop
What I want to happen is, the player picks up a knife and needs what the barrel contains because it is like acid so the player stabs the knife in it makes a sound sets a knife entity active for 2 seconds then turns it off and a particle and water noise start.
|
|
06-30-2012, 05:05 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: [HELP] Keg Pop
Look how FG made it in the main game.
Think, before you speak Google, before you post
|
|
06-30-2012, 05:09 PM |
|
himynamebob1
Member
Posts: 57
Threads: 12
Joined: Jun 2012
Reputation:
0
|
RE: [HELP] Keg Pop
They don't use a knife.
|
|
06-30-2012, 05:33 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: [HELP] Keg Pop
but they use a drill, it's pretty similiar. The only thing you have to change is that the knife won't rotate, but you just set a second knife active.
Think, before you speak Google, before you post
|
|
06-30-2012, 05:35 PM |
|
himynamebob1
Member
Posts: 57
Threads: 12
Joined: Jun 2012
Reputation:
0
|
RE: [HELP] Keg Pop
Well I have no idea which map they did that on.
|
|
06-30-2012, 05:37 PM |
|
|