Frictional Games Forum (read-only)
An annoying script problem. - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: An annoying script problem. (/thread-24982.html)



An annoying script problem. - Slanderous - 04-02-2014

Hey everyone,

I'm working on a script file to my map, the problem is I want to make a script that if player tries to open the locked door, he hears ghostly sounds and gets an instant sanity damage, but for some reason this doesn't work. The function also adds a timer which is 7 second, and after it, the door should open, but it does not as well. I added debug messages and they do not show up in-game. Anyone knows the solution?

The "not-working" part of my .hps file

PHP Code:
void Func_StartMadness(string &in entity)
{
    if(
GetSwingDoorLocked("hub_1") == true)
    {
        
AddDebugMessage("Feel the wrath of Shao Kahn!"false);
        
AddTimer("TriggerOpenDoor"7.0f"TriggerOpenDoorFunc"); 
        
SetMessage("Messages""drzwi2"0);
        
GiveSanityDamage(10.0f,true);
        
PlaySoundAtEntity("Ghostly_Sounds""00_cuts_3d""Ghostly_SoundsArea"0false);
    }
}

void TriggerOpenDoorFunc(string &in asTimer)
{
    
AddDebugMessage("Feel the power of Shao Kahn!"false);
    
ChangePlayerStateToNormal();
    
SetPlayerActive(true);
    
SetSwingDoorLocked("hub_1"falsetrue);
    
PlaySoundAtEntity("""unlock_door.snt""hub_1"0.0ftrue);
    
SetPlayerCrouching(false);
    
FadeImageTrailTo(0,1);


ofc the door names in the notepad and level editor are the same. Any help will be appreciated.

EDIT: nvmd, I fixed it. This thread may be closed now.


RE: An annoying script problem. - Wapez - 04-02-2014

How are you calling the function?


RE: An annoying script problem. - Slanderous - 04-02-2014

(04-02-2014, 07:51 PM)Wapez Wrote: How are you calling the function?

I already fixed it - I forgot to add a line to PlayerInteractCallback in Level editor.