Frictional Games Forum (read-only)

Full Version: [HELP] Keg Pop
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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

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.
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.
Thank you lots.

Actually, still having problems, here's my area.
[Image: untitleasd.png]
You have to go more on detail. What's wrong? Do you get an error message, or something just won't work?
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.
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.
Look how FG made it in the main game.
They don't use a knife.
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.
Well I have no idea which map they did that on.
Pages: 1 2 3