Frictional Games Forum (read-only)
[HELP] Keg Pop - 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: [HELP] Keg Pop (/thread-16607.html)

Pages: 1 2 3


[HELP] Keg Pop - himynamebob1 - 06-30-2012

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.


RE: [HELP] Keg Pop - Adny - 06-30-2012

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.


RE: [HELP] Keg Pop - himynamebob1 - 06-30-2012

Thank you lots.

Actually, still having problems, here's my area.
[Image: untitleasd.png]


RE: [HELP] Keg Pop - Cruzore - 06-30-2012

You have to go more on detail. What's wrong? Do you get an error message, or something just won't work?


RE: [HELP] Keg Pop - Adny - 06-30-2012

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.


RE: [HELP] Keg Pop - himynamebob1 - 06-30-2012

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.


RE: [HELP] Keg Pop - Cruzore - 06-30-2012

Look how FG made it in the main game.


RE: [HELP] Keg Pop - himynamebob1 - 06-30-2012

They don't use a knife.


RE: [HELP] Keg Pop - Cruzore - 06-30-2012

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.


RE: [HELP] Keg Pop - himynamebob1 - 06-30-2012

Well I have no idea which map they did that on.