The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
some errors with scripting [solved]
adamhun Offline
Junior Member

Posts: 34
Threads: 4
Joined: Dec 2010
Reputation: 0
#1
Question  some errors with scripting [solved]

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:
/////////////////////////////////////////////////////////////////////////
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:
/////////////////////////////////////////////////////////////////////////
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

-Retired-
(This post was last modified: 12-23-2010, 02:27 PM by adamhun.)
12-23-2010, 01:46 PM
Find


Messages In This Thread
some errors with scripting [solved] - by adamhun - 12-23-2010, 01:46 PM
RE: some errors with scripting - by Frontcannon - 12-23-2010, 02:22 PM



Users browsing this thread: 1 Guest(s)