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
Script help.
Storfigge Offline
Member

Posts: 101
Threads: 31
Joined: Sep 2012
Reputation: 0
#11
Thumbs Up  RE: Script help.

(04-17-2013, 01:55 AM)Yare Wrote: I think it will be like this, step by step:

SetLocalVarInt("BarrelCollisionCount", 0);

Just after "void OnStart/OnEnter" you declare a variable. It doesn't have to be "BarrelCollisionCount", name it as you wish.

AddEntityCollideCallback("BARREL NAME", "SCRIPTAREA1 NAME", "FUNCTION NAME", true, 1);
AddEntityCollideCallback("BARREL NAME", "SCRIPTAREA2 NAME", "FUNCTION NAME", true, 1);
AddEntityCollideCallback("BARREL NAME", "SCRIPTAREA3 NAME", "FUNCTION NAME", true, 1);

Here we add collide callback for 3 script areas. You can do it this way, though for more than 2 objects I usually use "for" loop.

void FUNCTION NAME(string &in asParent, string &in asChild, int alState)
{
    AddLocalVarInt("BarrelCollisionCount", 1);
    if (GetLocalVarInt("BarrelCollisionCount")==3)
    {
        SetSwingDoorLocked("DOOR NAME", false, false);
        (And here put any other effects you would like to play. Maybe unlock sound, or something like that)
    }
}

Every time the function is played, it adds 1 to the variable and checks if the variable equals 3. On the 3rd collision it should unlock the door.

This was perfect thank you a lot Big Grin

04-17-2013, 04:29 PM
Find




Users browsing this thread: 1 Guest(s)