The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
What's wrong with my script?
physcostealth Offline
Junior Member

Posts: 25
Threads: 12
Joined: Mar 2014
Reputation: 0
#1
What's wrong with my script?

This is just a test area. But I want the player to take a key, open a closet with it, grab a crowbar in the closet (which in turn will also make an area active between the player and a door), and when the player walks into the area thunder will crash and the player will look at a nearby window. Then he can use to crowbar to open the door. Everything works out well up till the area part; it seems like the area is always inactive as when I grab the crowbar and walk into the area, nothing happens. The door still opens when I use the crowbar on it, however.

void OnStart()
{
    AddUseItemCallback("crowbar.ent", "crowbar", "mansion_1", "unlockdoor", false);
    SetSwingDoorLocked("mansion_1", true, true);
    SetSwingDoorLocked("cabinet", true, true);
    AddUseItemCallback("key_tomb.ent", "keycloset", "cabinet", "unlockcloset", false);
    SetEntityActive("thunder", false);
    AddEntityCollideCallback("Player", "thunder", "lookatwindow", true, 1);
}

//To unlock the closet door, grab the key and click on the door.///

void unlockcloset(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("cabinet", false, true);
    PlaySoundAtEntity("locker", "07_pick_lock.ogg", "Player", 0.1f, true);
}

//To unlock the mansion door, grab the crowbar and click the door.///

void unlockdoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("mansion_1", false, true);
    PlayMusic("the_patronus_light.ogg", true, 1.0, 1.0, 1, false);
    PlaySoundAtEntity("lock", "07_pick_lock.ogg", "Player", 0.1f, true);
}

//Before you walk to the mansion door to unlock it, thunder will crash when you walk into the area.//

void lookatwindow(string &in asParent, string &in asChild, int alState)
{
    StartPlayerLookAt("windowblue", 1.0f, 1.0f, "timerset");
    PlaySoundAtEntity("thundercrash", "thunder_crash01.ogg", "windowblue", 0.0f, true);
    if(HasItem("crowbar"))
        {
            SetEntityActive("thunder", true);
        }
    AddTimer("timerthunder", 3.0f, "timerset");
}

//The timer starts when player walks into thunder area.//

void timerset(string &in asTimer)
{
    StopPlayerLookAt();
}

Thanks for your help!
03-16-2014, 09:18 PM
Find


Messages In This Thread
What's wrong with my script? - by physcostealth - 03-16-2014, 09:18 PM
RE: What's wrong with my script? - by Mudbill - 03-16-2014, 09:32 PM
RE: What's wrong with my script? - by plutomaniac - 03-17-2014, 12:03 AM



Users browsing this thread: 1 Guest(s)