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
Scripting assistance requested!
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#4
RE: SUP /B/!

This is one of those multi-step processes that could take hours to properly contruct.

I could start you off a little...

Make an area inside of the cleaner and then add an EntityCollideCallback for the collision of "dirty_object" and "cleaner_area". You would also have to make sure that the "dirty_object" is inside of the "cleaner" when the player closes the "cleaner_door", causing it to lock.

void OnStart()
{
    SetLocalVarInt("ObjectIn", 0);
    SetLocalVarInt("LevPulled", 0);
    AddEntityCollideCallback("dirty_object", "cleaner_area", "Func01", false, 1);
    AddEntityCollideCallback("dirty_object", "cleaner_area", "Func02", false, -1);
    SetEntityConnectionStateChangeCallback("cleaner_lever", "Func03");
    Func04();
}
void Func01(string &in asParent, string &in asChild, int alState)
{
    SetLocalVarInt("ObjectIn", 1);
}
void Func02(string &in asParent, string &in asChild, int alState)
{
    SetLocalVarInt("ObjectIn", 0);
}
void Func03(string &in asEntity, int alState)
{
    if (alState == 1)
    {
        SetLocalVarInt("LevPulled", 1);
    }
    else if (alState == 0)
    {
        SetLocalVarInt("LevPulled", 0);
    }
    else if (alState == -1)
    {
        SetLocalVarInt("LevPulled", 0);
    }
}
void Func04()
{
    if (GetSwingDoorClosed("cleaner_door") == true)
    {
        if (GetLocalVarInt("ObjectIn") == 1)
        {
            SetSwingDoorLocked("cleaner_door", true, true);
            //Add sound effect here maybe.
            if (GetLocalVarInt("LevPulled") ==  1)
            {
                SetLeverStuckState("cleaner_lever", 1, true);
                RemoveEntityCollideCallback("dirty_object", "cleaner_area");
                AddTimer("", 3, "Func05");
            }
        }
    }
}
void Func05(string &in asTimer)
{
    SetSwingDoorLocked("cleaner_door", false, true);
    SetEntityActive("dirty_object", false);
    SetEntityActive("clean_object", true);
    //Insert light, sound, and shake effects here!
}

(This post was last modified: 06-11-2011, 01:06 PM by Kyle.)
06-11-2011, 01:04 PM
Find


Messages In This Thread
Scripting assistance requested! - by SLAMnesia - 06-11-2011, 08:53 AM
RE: SUP /B/! - by laser50 - 06-11-2011, 10:29 AM
RE: SUP /B/! - by xtron - 06-11-2011, 12:34 PM
RE: SUP /B/! - by Kyle - 06-11-2011, 01:04 PM
RE: SUP /B/! - by SLAMnesia - 06-12-2011, 12:51 AM
RE: Scripting assistance requested! - by Acies - 06-12-2011, 01:31 AM
RE: Scripting assistance requested! - by Kyle - 06-12-2011, 12:11 PM



Users browsing this thread: 1 Guest(s)