Frictional Games Forum (read-only)
[Solved] Using Boxes To Trigger Script? - 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: [Solved] Using Boxes To Trigger Script? (/thread-13239.html)



[Solved] Using Boxes To Trigger Script? - Strembitsky - 02-11-2012

Here is my code:

Code:
void OnStart()
{
    AddEntityCollideCallback("storage_box_1", "Throw2", "Barricade", true, 1);
    PlayMusic("02_amb_strange.ogg", true, 1, 0, 5, true);
}
void Barricade(string &in asParent, string &in asChild, int alState)
{
    AddPropForce("barrel01_1", 0, 2, 10, "World");
    AddPropForce("barrel01_2", 0, 2, 10, "World");
    AddPropForce("barrel01_3", 0, 2, 10, "World");
    AddPropForce("storage_box_wood02_moveable", 0, 2, 10, "World");
    AddPlayerSanity(25);
    PlaySoundAtEntity("DaughterRelief.ogg", "DaughterRelief.snt", "Player", 0, false);
}


Long story short, it doesn't work. Every entity is named correctly. Basically, this is making it so that when the storage box enters the area of "Throw2", it triggers the script. It doesn't work.


RE: Using Boxes To Trigger Script? - flamez3 - 02-11-2012

Have you named the script file and map file right?


RE: Using Boxes To Trigger Script? - palistov - 02-11-2012

Put a debug message in the Barricade function, to see if the collision is even happening. If the debug message doesn't pop up, try deleting the map cache in your maps folder. Close Amnesia before you do this. If it does pop up, your prop force values are probably too small.


RE: Using Boxes To Trigger Script? - Strembitsky - 02-11-2012

The debug message showed up, but nothing else happened. Not even the player sanity, or the sound.

Sad


RE: Using Boxes To Trigger Script? - palistov - 02-11-2012

Try changing the internal name of the sound. Also, check your sound properties file (snt). Perhaps you forgot to change a value in there. In the debug menu, check the box next to "Show sounds playing". See if the sound plays. If it doesn't, you probably placed the sound file in the wrong directory or something like that.

Multiply the force values by 100, see what that does. It'll take a few minutes of testing to get the values you want.


RE: Using Boxes To Trigger Script? - Strembitsky - 02-11-2012

(02-11-2012, 07:12 AM)palistov Wrote: Try changing the internal name of the sound. Also, check your sound properties file (snt). Perhaps you forgot to change a value in there. In the debug menu, check the box next to "Show sounds playing". See if the sound plays. If it doesn't, you probably placed the sound file in the wrong directory or something like that.

Multiply the force values by 100, see what that does. It'll take a few minutes of testing to get the values you want.
Thanks. You helped. It had something to do in the .snt file about priorities.

Rep for you!


RE: Using Boxes To Trigger Script? - palistov - 02-11-2012

Awesome! Just remember tricks like that, just so you can scope in on the problem.