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
Force to trigger function.
zombiehacker595 Offline
Member

Posts: 141
Threads: 51
Joined: Mar 2012
Reputation: 3
#8
RE: Force to trigger function.

(04-16-2012, 12:41 AM)Damascus Wrote:
(04-15-2012, 05:29 PM)DRedshot Wrote: You place two areas a certain distance from one another.
Place the first area a few inches away from the wall, and put the second on the wall.

Measure the distance between these areas, and declare it in your script as a constant, ie:
float Distance = 0.25f;

Now when the hammer passes through the first area, start a timer, and when it passes through the second timer, call "GetTimerTimeLeft" and use this value to work out the time taken for the collision.

Now divide the Distance by this number to calculate the speed, and have an if statement to check if the speed is larger than a certain value! Smile


Edit: already answered Tongue
Could I get some more info on this method? I'd like to use this method to break down a door with any of several large rocks laying around. I don't know how to declare constants, start running timers and calculating speed...

This is how I'm planning to start the callbacks (given that there are ten large rocks scattered about the level):

void OnStart
{
for(int i=1;i<=10;i++)

{
AddEntityCollideCallback("rock_debris_01_"+i, "ImpactArea1", "Impact1", false, 1);
}
for(int i=1;i<=10;i++)

{
AddEntityCollideCallback("rock_debris_01_"+i, "ImpactArea2", "Impact2", false, 1);
}
}


here is a much easier way of doing it

{

AddEntityCollideCallback("ScriptArea_1", "sledge_1", "DestroyDoor", true, 1);

}

void DestroyDoor(string &in asParent, string &in asChild, int alState)


{
SetEntityActive("cellar_wood01_2", false);
SetEntityActive("cellar_wood01_broken_1", true);
PlaySoundAtEntity("", "break_wood.snt", "ScriptArea_1", 0, false);
}

Place a script area at the door then sledge_1 can be changed to the rocks name, place two doors one working one broken when the rock or whatever youre using collides with the area the door will turn into a broken door with the sound as added effect much more simple and easy
(This post was last modified: 04-16-2012, 12:01 PM by zombiehacker595.)
04-16-2012, 12:00 PM
Find


Messages In This Thread
Force to trigger function. - by AnthonyTrix - 04-15-2012, 05:11 PM
RE: Force to trigger function. - by Acies - 04-15-2012, 05:19 PM
RE: Force to trigger function. - by Homicide13 - 04-15-2012, 05:21 PM
RE: Force to trigger function. - by AnthonyTrix - 04-15-2012, 05:23 PM
RE: Force to trigger function. - by DRedshot - 04-15-2012, 05:29 PM
RE: Force to trigger function. - by Damascus - 04-16-2012, 12:41 AM
RE: Force to trigger function. - by zombiehacker595 - 04-16-2012, 12:00 PM
RE: Force to trigger function. - by AnthonyTrix - 04-15-2012, 05:33 PM



Users browsing this thread: 1 Guest(s)