Frictional Games Forum (read-only)

Full Version: some errors with scripting [solved]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all!

I have some scripting problem, and it's driving me to madness Angry
There are 2 levels. The first goes through nicely with no errors. But when I want to go to the other map( with level loader door), it gets an error:

FATAL ERROR ..... blablabla ...... ExecuteString(1, 1) : ERR : No matching signatures to 'OnLeave()'
main (6, 2) : ERR : No matching signatures to
'AddEntityCollideCallback(string@&, string@&, string@&, const bool)'

Here's the script file:
Code:
/////////////////////////////////////////////////////////////////////////
void OnEnter()
    {
    // callbacks
    AddUseItemCallback("", "key_to_store", "key_store_door", "KeyOnDoor2", true);
    AddEntityCollideCallback("servant_grunt2", "grunt_leave", "GruntLeaving", true);
    }
    //=============================//
void KeyOnDoor2(string &in asItem, string &in asEntity)
    {
    // unlocks the door
    SetSwingDoorClosed("key_store_door", false, false);
    // plays sound at the door
    PlaySoundAtEntity("", "unlock_door.snt", "key_store_door", 0.0f, true);
    PlaySoundAtEntity("", "guardian_distant2.snt", "mansion_1", 0.0f, true);
    // sanity damage with effects
    GiveSanityDamage( 5.0f, true);
    PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
    PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
    }
    // ___________________________ //
    
void GruntLeaving(string &in asParent , string &in asChild , int alState)
    {
    SetEntityActive("servant_grunt2", false);
    }

PS.: It checks the script when you load an another map? Because I got some errors from the first map when I tried to load the second.

Here's the first map's code, just in case:
Code:
/////////////////////////////////////////////////////////////////////////
void OnEnter()
    {
    // callbacks
    AddEntityCollideCallback("Player", "monsterspawn", "MonsterFunc1", true, 1);
    AddEntityCollideCallback("Player", "Iron_maiden_scare", "ScareIronmaiden", true, 1);
    AddEntityCollideCallback("Player", "end_scarysound", "endscare", true, 1);
    // the level loader door is locked and requires a key
    AddUseItemCallback("", "escape_key", "escape_door", "KeyOnDoor", true);
    // patrol nodes to the grunt
    AddEnemyPatrolNode("servant_grunt1", "startarea_zom_1", 0.0f, "");
    AddEnemyPatrolNode("servant_grunt1", "startarea_zom_2", 0.0f, "");
    AddEnemyPatrolNode("servant_grunt1", "startarea_zom_3", 2.0f, "");
    AddEnemyPatrolNode("servant_grunt1", "startarea_zom_4", 2.0f, "");
    }
////////////////////////////////////////////////////////////////////////
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
    {
    // monster spawning
     SetEntityActive("servant_grunt1", true);
     // gives sanity damage with effects
     GiveSanityDamage( 15.0f, true);
     /* this is not working
     SetEntityActive("startstairlight1", false);*/
     // use this instead
     SetLampLit("startstairlight1", false, true);
     // sounds
     PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
     PlaySoundAtEntity("", "04_scream.snt", "servant_grunt1", 0, false);
     // this turns the lamps off when you enter the area
     SetLampLit("candlestick_floor_3", false, true);
     SetLampLit("candlestick_floor_4", false, true);
     SetLampLit("candlestick_floor_5", false, true);
     SetLampLit("candlestick_floor_6", false, true);
     SetLampLit("candlestick_floor_7", false, true);
     SetLampLit("candlestick_floor_8", false, true);
     SetLampLit("candlestick_floor_9", false, true);
     SetLampLit("candlestick_floor_10", false, true);
     SetLampLit("candlestick_floor_11", false, true);
     SetLampLit("candlestick_floor_12", false, true);
    }
        //_______________________________//
void endscare(string &in asParent , string &in asChild , int alState)
    {
    // sound
    PlaySoundAtEntity("", "guardian_distant1.snt", "escape_door", 0, false);
    // gives sanity damage with effects
    GiveSanityDamage( 15.0f, true);
    }
        //_______________________________//
void KeyOnDoor(string &in asItem, string &in asEntity)
    {
    // if the key is used on the door, it will unlock
    /* SetSwingDoorLocked("escape_door", false, false);
    this is wrong!! when you want to unlock a level loader door,
    use this: */
    SetLevelDoorLocked("escape_door", false);
    // plays sound at the door
    PlaySoundAtEntity("", "unlock_door.snt", "escape_door", 0.0f, true);
    }
        //______________________________//
void ScareIronmaiden(string &in asParent , string &in asChild , int alState)
    {
    // sound
    PlaySoundAtEntity("", "scare_wall_stomp.snt", "Iron_maiden_1", 0, false);
    // first try at creating effects
    CreateParticleSystemAtEntity("", "ps_iron_maiden_event_smoke.ps", "Iron_maiden_1", false);
    }
        //_______________________________//

There were some other errors too, but I could make them work. But I cannot find what's wrong with this one ...
Edit: It only started bugging when I wrote some scripts to the second map's .hps ... will try to delete the scripts from it ...
Edit2: well, it works when I remove the scripts from the second map's hps so the problem will be there somewhere ....
Edit3: fail. I found the problem .... the 1 is missing from the CollideCallback. Well, I can't delete the thread, so it will be here for a while ... at least you can see how I fail at scripting Smile
Edit the thread title to solved then.
Got it, thanks Smile