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
Doing nothing on an IF & Resetting level on death?
Nye Offline
Senior Member

Posts: 250
Threads: 8
Joined: Jan 2011
Reputation: 2
#5
RE: Doing nothing on an IF & Resetting level on death?

(02-11-2011, 08:14 AM)junkfood2121 Wrote: Thanks! The first code worked x)
The second worked aswell, but I got a problem.
When changing the val to false on the collidecallback, each time I run into the collide box the event appears so you can run back and fourth into the box to make the event reappear. Any idea on how to fix it?

My code to make sure I did correct Tongue
    //Collide callbacks
    AddEntityCollideCallback("Player", "MoveStatues", "CollideMoveStatues", false, 1);
    AddEntityCollideCallback("Player", "ShutDoor", "CollideShutDoor", true, 1);
    AddEntityCollideCallback("Player", "SoundSteps", "CollideSoundSteps", true, 1);
    AddEntityCollideCallback("Player", "StrangeSound_1", "CollideStrangeSound_1", true, 1);
    AddEntityCollideCallback("Player", "StrangeSound_2", "CollideStrangeSound_2", true, 1);
    SetLocalVarInt("EVENTDONE", 0);
    }

and the other code:

//Throws the two statues heads off and creates dust at them
void CollideMoveStatues(string &in asParent, string &in asChild, int alState)
{
    if(GetLocalVarInt("EVENTDONE") == 0)
    {
        AddPropImpulse("Statue_1", 2.0f, 5.0f, 2.0f, "World");
        CreateParticleSystemAtEntity("StatueBehead_1", "ps_dust_impact_vert.ps", "StatueDust_1", false);
        AddPropImpulse("Statue_2", -2.0f, 5.0f, -2.0f, "World");
        CreateParticleSystemAtEntity("StatueBehead_2", "ps_dust_impact_vert.ps", "StatueDust_2", false);
        GiveSanityDamage(3.0f, true);
        PlaySoundAtEntity("StatueScare", "react_breath", "Player", 0.5f, false);
    }
}

When you run the event after EVENTDONE=0, did you remember to set the local variant EVENTDONE to 1? That way, the procedure will repeat itself but nothing will happen until EVENTDONE =0 again. This is what I did in the example I think Smile (sent from my phone, I might have made a mistake :p)

02-11-2011, 08:24 AM
Find


Messages In This Thread
RE: Doing nothing on an IF & Resetting level on death? - by Nye - 02-11-2011, 08:24 AM



Users browsing this thread: 1 Guest(s)