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
error after loading the custom story
Green Sonic Offline
Junior Member

Posts: 1
Threads: 1
Joined: Jun 2019
Reputation: 0
#1
error after loading the custom story

I get an error after I load the map
Fatal Error: Could not load script file
main (12,1) : ERR : Unexpected token '{'

void OnStart()
{
AddUseItemCallback("", "key_tomb_rusty_1", "level_hub_1", "KeyOnLevelDoor", true);
}

void KeyOnLevelDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked(asEntity, false);
RemoveItem(asItem);
}

{  
        AddUseItemCallback("", "Crowbar", "Door", "UseCrowbarOnDoor", true);
        AddEntityCollideCallback("Joint", "AreaBreak", "BreakDoor", true, 1);
}
 
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("Door", false, false);
        SetSwingDoorClosed("Door", false, false);
        SetSwingDoorDisableAutoClose("Door", true);
 
        AddPropImpulse("Door", 0, 0, 3, "world");
 
        CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "AreaEffect", false);
        PlaySoundAtEntity("", "break_wood_metal", "AreaEffect", 0, false);
 
        GiveSanityBoostSmall();
 
        PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
 
        AddTimer("", 0.1, "TimerPushDoor");
}
 
void TimerPushDoor(string &in asTimer)
{
        AddPropImpulse("Door", -4, 2, 1, "world");
        AddTimer("", 1.1, "TimerDoorCanClose");
}
 
void TimerDoorCanClose(string &in asTimer)
{
        SetSwingDoorDisableAutoClose("Door", false);
}
06-11-2019, 08:16 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: error after loading the custom story

Your syntax is wrong. This part is causing the script to fail:

PHP Code: (Select All)
{  
        
AddUseItemCallback("""Crowbar""Door""UseCrowbarOnDoor"true);
        
AddEntityCollideCallback("Joint""AreaBreak""BreakDoor"true1);


The reason is because you open this code block without a function declaration. This is required in the top level of the file.

It looks like you want these two callbacks to be created in OnStart, so I suggest you move them into your OnStart function and then remove the empty block left over, so that your OnStart looks like this:

PHP Code: (Select All)
void OnStart()
{
    
AddUseItemCallback("""key_tomb_rusty_1""level_hub_1""KeyOnLevelDoor"true);
    
AddUseItemCallback("""Crowbar""Door""UseCrowbarOnDoor"true);
    
AddEntityCollideCallback("Joint""AreaBreak""BreakDoor"true1);


(This post was last modified: 06-12-2019, 12:11 AM by Mudbill.)
06-12-2019, 12:10 AM
Find




Users browsing this thread: 1 Guest(s)