Frictional Games Forum (read-only)

Full Version: Need help with scripting :)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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");
}
Thank you so much! Big Grin Gonna add sound and make the player look at it Smile