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
Restore rusty valve when you die (still unsolved)
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#17
RE: Restore rusty valve when you die (still unsolved)

Ah, well rusty valve is a bit of a weird prop, so that approach won't work. The valve is actually a multi-body prop with a breakable joint. If you want to break the joint without the player touching the valve, all you need to do is apply a small impulse to the valve, and that will break the joint (You can also use BreakJoint - but you'd still need an impulse otherwise the wheel won't fall off the valve).

The following code assumes you have an area called ScriptArea_BreakValve, which if the player enters breaks the valve.
void OnStart()
{
        // The rest of your OnStart() event \\

    //Add a collision callback between the player and the area which breaks the valve
    AddEntityCollideCallback("Player","ScriptArea_BreakValve","cbCollide_PlayerValveBreakArea",true,1);
}

void YourCheckPoint(string &in asName, int alCount)
{
   // The rest of your Checkpoint code (Spawining the valves etc) \\

   //Re-Add a collision callback between the player and the area which breaks the valve
   AddEntityCollideCallback("Player","ScriptArea_BreakValve","cbCollide_PlayerValveBreakArea",true,1);
}

//This Callback is called when the player walks in an area to break the valve
void cbCollide_PlayerValveBreakArea(string &in asParent, string &in asChild, int alState)
{    
    //Get the current valve's name:
    string valveName = GetLocalVarString("CurrentValvename");
        
    //Because the valve is implemented by an incredibly weak breakable joint
    //We can just apply a small impulse to the valve to break it, as well as make the wheel fall off
    //If you want the wheel to rotate or tumble or something, adjust the values below
    AddPropImpulse(valveName,0,0,0.5f,"local");
}
09-04-2012, 04:27 PM
Find


Messages In This Thread
RE: Restore map when you die - by Mackiiboy - 07-31-2012, 03:59 PM
RE: Restore map when you die - by Steve - 08-04-2012, 07:07 PM
RE: Restore rusty valve when you die - by Steve - 08-05-2012, 10:03 AM
RE: Restore rusty valve when you die (still unsolved) - by Apjjm - 09-04-2012, 04:27 PM



Users browsing this thread: 1 Guest(s)