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
Swing Door Locked Text?
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#11
RE: Swing Door Locked Text?

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

Derp.
09-23-2014, 07:07 PM
Find
Amnesiaplayer Offline
Senior Member

Posts: 539
Threads: 105
Joined: Jun 2014
Reputation: 0
#12
RE: Swing Door Locked Text?

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

void BoardCreak(string&in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("WoodCreaking", "CREAKINGNOISE.snt", "BreakingArea", 0.5f, false);
SetPropHealth("Plank1", 0);
SetPropHealth("Plank2", 0);
SetPropHealth("Plank3", 0);
SetPropHealth("Plank4", 0);
SetPropHealth("PlankE", 0);
SetPropHealth("PlankX", 0);
PlayMusic("12_amb", true, 0.7f, 1, 0, false);
SetEntityActive("BlockBox", true);
}

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

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

void BreakDoor(string &in asParent, string &in asChild, int alState)
{
        
SetEntityActive("Joint", false);
        
SetEntityActive("Broken", true);
 
        
SetSwingDoorLocked("CellarDoor2", false, false);
        
SetSwingDoorClosed("CellarDoor2", false, false);
        
SetSwingDoorDisableAutoClose("CellarDoor2", true);
      
        
CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "AreaEffect", false);
        
PlaySoundAtEntity("", "break_wood_metal", "AreaEffect", 0, false);
        
PlaySoundAtEntity("WoodCreaking", "CREAKINGNOISE.snt", "UsBreakDoor", 0.5f, false);
 
        
GiveSanityBoostSmall();
 
        
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
}

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

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

if(
GetSwingDoorLocked("CellarDoor") == true)
{
SetMessage("Sign", "CellarDoor", 0);
} 
Sad
09-24-2014, 06:15 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#13
RE: Swing Door Locked Text?

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: (Select All)
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.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
09-24-2014, 07:35 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#14
RE: Swing Door Locked Text?

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: (Select All)
void CellarDoor2(string &in asEntity)
{
    if(
GetSwingDoorLocked(asEntity)) SetMessage("Sign", "CellarDoor", 0);
} 

Try this instead of what you have down there.

(This post was last modified: 09-24-2014, 01:55 PM by Mudbill.)
09-24-2014, 07:53 AM
Find
Amnesiaplayer Offline
Senior Member

Posts: 539
Threads: 105
Joined: Jun 2014
Reputation: 0
#15
RE: Swing Door Locked Text?

Thanks!!! it worked Big Grin
09-24-2014, 01:02 PM
Find




Users browsing this thread: 1 Guest(s)