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.
Yare Offline
Junior Member

Posts: 22
Threads: 2
Joined: Mar 2013
Reputation: 0
#6
RE: Script help.

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 post was last modified: 04-17-2013, 01:55 AM by Yare.)
04-17-2013, 01:55 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: 2 Guest(s)