Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with scripting :)
Author Message
havis1337 Offline
Junior Member

Posts: 30
Joined: May 2011
Reputation: 0
Post: #1
Need help with scripting :)

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?
05-24-2011 08:47 PM
Find all posts by this user Quote this message in a reply
triadtimes Offline
Senior Member

Posts: 497
Joined: Jan 2011
Reputation: 20
Post: #2
RE: Need help with scripting :)

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:

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

05-24-2011 09:20 PM
Visit this user's website Find all posts by this user Quote this message in a reply
havis1337 Offline
Junior Member

Posts: 30
Joined: May 2011
Reputation: 0
Post: #3
RE: Need help with scripting :)

Thank you so much! Big Grin Gonna add sound and make the player look at it Smile
05-25-2011 12:27 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)