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.
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#7
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.
You put the SetLocalVarInt to the void OnStart() part. And if the Player must do all this to unlock a door, and if it locks again if no barrels are in place then you'll need another script.

"Veni, vidi, vici."
"I came, I saw, I conquered."
04-17-2013, 06:15 AM
Find


Messages In This Thread
Script help. - by Storfigge - 04-16-2013, 07:10 PM
RE: Script help. - by Storfigge - 04-16-2013, 08:21 PM
RE: Script help. - by 7heDubz - 04-16-2013, 11:36 PM
RE: Script help. - by Traggey - 04-17-2013, 01:03 AM
RE: Script help. - by 7heDubz - 04-17-2013, 01:15 AM
RE: Script help. - by Yare - 04-17-2013, 01:55 AM
RE: Script help. - by PutraenusAlivius - 04-17-2013, 06:15 AM
RE: Script help. - by Storfigge - 04-17-2013, 04:29 PM
RE: Script help. - by Linus Ågren - 04-17-2013, 09:30 AM
RE: Script help. - by Your Computer - 04-17-2013, 11:33 AM
RE: Script help. - by Linus Ågren - 04-17-2013, 02:38 PM



Users browsing this thread: 1 Guest(s)