Frictional Games Forum (read-only)
Need help with scripting :) - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Need help with scripting :) (/thread-8222.html)



Need help with scripting :) - havis1337 - 05-24-2011

Hey! I need help to make a bottle to be thrown automatically from a table into the wall when i enter an area. What should i write in the HPS and LANG Files?


RE: Need help with scripting :) - triadtimes - 05-24-2011

AddPropImpulse("NAME", X,Y,Z, "world");

That is the line of code to be used to throw things. NAME is whatever the bottle is named in the editor. X Y and Z are coordinates, check it in the editor and change the values accordingly [i.e. if the bottle is going to be thrown across the room along the x axis it should look like this AddPropImpulse("Bottle", 50, 0, 0, "world); you may need to change the 50 if it is too powerful or not powerful enough.] This will be triggered whenever a play enters an area which was defined in the editor. (I will post that code below)

The code in your OnStart would be something like this:

AddEntityCollideCallback("Player", "trigger", "scare", true, 1);

Which means whenever the Player enters the area called trigger then the function scare will be called (in this case that is where you would put the AddPropImpulse.


OVERALL it should look something like this:

Code:
void OnStart()
{    
    AddEntityCollideCallback("Player", "trigger", "scarebottle", true, 1);
}
void scarebottle(string &in asParent, string &in asChild, int alState)
{
    AddPropImpulse("bottle", 50,0, 0, "world");
}



RE: Need help with scripting :) - havis1337 - 05-25-2011

Thank you so much! Big Grin Gonna add sound and make the player look at it Smile