Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


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

Posts: 28
Threads: 6
Joined: May 2011
Reputation: 0
#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
triadtimes Offline
Senior Member

Posts: 508
Threads: 16
Joined: Jan 2011
Reputation: 21
#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
Find
havis1337 Offline
Junior Member

Posts: 28
Threads: 6
Joined: May 2011
Reputation: 0
#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




Users browsing this thread: 1 Guest(s)