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
Help with scripting a "Scary Door"
Equil Offline
Member

Posts: 94
Threads: 8
Joined: Sep 2010
Reputation: 0
#1
Help with scripting a "Scary Door"

I'm very new to this whole scripting thing and only know a few very basic things, so any help is appreciated.

I've been lurking for a while now looking on how to script a "Scary Door" properly. I saw some threads which did help, it's now functioning properly, slamming shut when the player enters the area I specified.

However, the area still triggers the whole event of slamming and sanity damage when the player enters the area even if the door is closed. I want the event to not occur at all if the player enters the room, closes the door then enters the area.

I know this can be remedied somehow with the "GetSwingDoorClosed" function in an if else ladder, I've experimented with those to no avail, only receiving errors or no results. I believe it's a simple fix but I'm just unsure of how to do this, so again, any help is appreciated.

Here is the existing script:

////////////////////////////
// Run first time starting map
void OnStart()
{
  
    PlayMusic("10_amb.ogg", true, 1.0f, 0, 0, true);
    SetPlayerLampOil(0);
    
    SetEntityPlayerInteractCallback("Door1", "InteractedWithDoor", true);
    AddEntityCollideCallback("Player", "AreaDoorSlam1", "DoorSlam", true, 1);
    
    
}

void InteractedWithDoor(string &in entity)  
{
PlaySoundAtEntity("Grunt", "notice.snt", "AreaGrunt", 0, false);
}


void DoorSlam(string &in asParent, string &in asChild, int alState)
{
  
  StartPlayerLookAt("Door1", 4, 5, "");
  AddTimer("Slam", 0.5f, "TimerSlamDoor");
  
}

void TimerSlamDoor(string &in asTimer)
{
    SetSwingDoorClosed("Door1", true, true);    
    PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);        
    GiveSanityDamage(5.0f, true);
    AddTimer("Stoplook", 1.0f, "PlayerStopLook");
}

void PlayerStopLook(string &in asTimer)
{

//Player stops looking at object
StopPlayerLookAt();

}

    
        
  
////////////////////////////[/quote]
// Run when entering map
void OnEnter()
{

I would appreciate it greatly if someone could point out where this code needs to be. Thanks in advance. Smile
09-25-2010, 09:55 AM
Find


Messages In This Thread
Help with scripting a "Scary Door" - by Equil - 09-25-2010, 09:55 AM
RE: Help with scripting a "Scary Door" - by Equil - 09-25-2010, 11:57 AM



Users browsing this thread: 2 Guest(s)