Frictional Games Forum (read-only)
Swing Door Locked Text? - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+---- Forum: Technical Support (https://www.frictionalgames.com/forum/forum-37.html)
+---- Thread: Swing Door Locked Text? (/thread-26286.html)

Pages: 1 2


RE: Swing Door Locked Text? - Neelke - 09-23-2014

Show me the whole script. Probably something has been written wrong.


RE: Swing Door Locked Text? - Amnesiaplayer - 09-24-2014

Script
PHP Code:
void OnStart()
{
StopMusic(11);
AddEntityCollideCallback("Player""BreakingArea""BoardCreak"true1);
AddUseItemCallback("""Crowbar""CellarDoor2""UseCrowbarOnDoor"true);
AddEntityCollideCallback("Joint""AreaBreak""BreakDoor"true1);
AddUseItemCallback("""Hamer""PlankDoor""UseHamerOnDoor"true);
AddUseItemCallback("""Bucket""AcidArea""FunctionGetAcid"true);
SetEntityPlayerInteractCallback("CellarDoor""GetSwingDoorLocked"false);
}

void BoardCreak(string&in asParentstring &in asChildint alState)
{
PlaySoundAtEntity("WoodCreaking""CREAKINGNOISE.snt""BreakingArea"0.5ffalse);
SetPropHealth("Plank1"0);
SetPropHealth("Plank2"0);
SetPropHealth("Plank3"0);
SetPropHealth("Plank4"0);
SetPropHealth("PlankE"0);
SetPropHealth("PlankX"0);
PlayMusic("12_amb"true0.7f10false);
SetEntityActive("BlockBox"true);
}

void UseCrowbarOnDoor(string &in asItemstring &in asEntity)
{
RemoveItem(asItem);
PlaySoundAtEntity("""player_crouch.snt""Player"0.05false);
AddTimer(asEntity0.2"TimerPlaceCrowbar");
}

void TimerPlaceCrowbar(string &in asTimer)
{
        
SetEntityActive("Joint"true);
        
PlaySoundAtEntity("""puzzle_place_jar.snt"asTimer0false);
}

void BreakDoor(string &in asParentstring &in asChildint alState)
{
        
SetEntityActive("Joint"false);
        
SetEntityActive("Broken"true);
 
        
SetSwingDoorLocked("CellarDoor2"falsefalse);
        
SetSwingDoorClosed("CellarDoor2"falsefalse);
        
SetSwingDoorDisableAutoClose("CellarDoor2"true);
      
        
CreateParticleSystemAtEntity("""ps_hit_wood.ps""AreaEffect"false);
        
PlaySoundAtEntity("""break_wood_metal""AreaEffect"0false);
        
PlaySoundAtEntity("WoodCreaking""CREAKINGNOISE.snt""UsBreakDoor"0.5ffalse);
 
        
GiveSanityBoostSmall();
 
        
PlayMusic("10_puzzle01.ogg"false0.70.110false);
}

void UseHamerOnDoor(string &in asItemstring &in asEntity)
{
SetPropHealth("PlankDoor"0);
RemoveItem("Hamer");
GiveSanityBoost();
PlaySoundAtEntity("WoodCreaking""CREAKINGNOISE.snt""UseHamerOnDoor"0.5ffalse);
SetSwingDoorLocked("CellarDoor"falsefalse);
SetMessage("Messages""UsedHammer"0);
}

void FunctionGetAcid(string &in asItemstring &in asEntity)
{
    
SetEntityActive("AcidBucket",true);
    
RemoveItem("Bucket");
    
PlaySoundAtEntity("""16_fill_oil.snt""Player"1.0ftrue);


if(
GetSwingDoorLocked("CellarDoor") == true)
{
SetMessage("Sign""CellarDoor"0);

Sad


RE: Swing Door Locked Text? - Romulator - 09-24-2014

You don't have a callback syntax for the code I gave you, which evidently means you copied and pasted it without realising so.

Here. Copy and paste this, overwriting your old if.

PHP Code:
void CellarDoor2(string &in asEntity)
{
if(
GetSwingDoorLocked("CellarDoor") == true)
{
SetMessage("Sign""CellarDoor"0);


And remove the SetEntityPlayerCollideCallback in your OnStart(); because that is already done by your PlayerInteractCallback section of your cellardoor in the Level Editor.


RE: Swing Door Locked Text? - Mudbill - 09-24-2014

Aaaand ninja yet again. I swear you weren't there when I opened it o.o


That last if-statement is not within any code block. That's why you're crashing right now.

You haven't made your callback yet. You must place it where you have your current, invalid if-statement.

Since you put CellarDoor2 in the level editor on the door in the PlayerInteractCallback, you can do
PHP Code:
void CellarDoor2(string &in asEntity)
{
    if(
GetSwingDoorLocked(asEntity)) SetMessage("Sign""CellarDoor"0);


Try this instead of what you have down there.


RE: Swing Door Locked Text? - Amnesiaplayer - 09-24-2014

Thanks!!! it worked Big Grin