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
Use key to unlock door script, but the script crashes my level?
Austums Offline
Member

Posts: 60
Threads: 11
Joined: Mar 2011
Reputation: 0
#1
Use key to unlock door script, but the script crashes my level?

Hi guys. I just added this to my hps

void OnStart()
{
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_25",3.0f, "");
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_17",3.0f, "");
AddEntityCollideCallback("Player", "Scream_1", "Scream_1", true, 1);
AddEntityCollideCallback("Player", "Monster_1", "MonsterFunc1", true, 1);
AddUseItemCallback("", "key_study_1", "level_wood_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
    SetLevelDoorLocked("level_wood_1", false, true);
    PlaySoundAtEntity("", "unlock_door.snt", "level_wood_1", 0.0f, true);
}

The AddUseItemCallback is where the key stuff starts, obviously.

I don't see what the problem is. I named everything correctly.


Oh, here's the error I get

main (28,5) : ERR: No matching signatures to 'SetLevelDoorLocked(string@&, const bool, const bool)'
(This post was last modified: 03-23-2011, 06:22 PM by Austums.)
03-23-2011, 06:19 PM
Find
Viperdream Offline
Member

Posts: 124
Threads: 16
Joined: Jan 2011
Reputation: 0
#2
RE: Use key to unlock door script, but the script crashes my level?

What does the error say?

EDIT:
Nevermind, this is what's wrong, you left the name open.
AddUseItemCallback("KeyOnDoor", "key_study_1", "level_wood_1", "KeyOnDoor", true);  //Fix'd code

This should help

(This post was last modified: 03-23-2011, 06:25 PM by Viperdream.)
03-23-2011, 06:22 PM
Find
Austums Offline
Member

Posts: 60
Threads: 11
Joined: Mar 2011
Reputation: 0
#3
RE: Use key to unlock door script, but the script crashes my level?

Updated my original post with the error.
Still getting an error :/

ERR: No matching signatures to 'SetLevelDoorLocked(string@&, const bool, const bool)'

I'll post my entire script. Everything works fine when I take out this new door script, btw. Also thank you for your help!

void OnEnter()
{
AddTimer("FadeIntro", 0, "FadeIntro");
}

void FadeIntro(string &in asTimer)
{
FadeOut(0);
FadeIn(6);
PlaySoundAtEntity("Startle_1", "react_scare.snt", "Startle_1", 0, false);
}

void OnLeave()
{
}

void OnStart()
{
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_25",3.0f, "");
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_17",3.0f, "");
AddEntityCollideCallback("Player", "Scream_1", "Scream_1", true, 1);
AddEntityCollideCallback("Player", "Monster_1", "MonsterFunc1", true, 1);
AddUseItemCallback("KeyOnDoor", "key_study_1", "level_wood_1", "KeyOnDoor", true);

}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
    SetLevelDoorLocked("level_wood_1", false, true);
    PlaySoundAtEntity("", "unlock_door.snt", "level_wood_1", 0.0f, true);
}

void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
  SetEntityActive("servant_grunt_1", true);
}
void Scream_1(string &in asParent, string &in asChild, int alStates)
{
   AddTimer("Somenamedoesntreallymatter", 3.0f, "Scream_Trigger");
}

void Scream_Trigger(string &in asTimer)
{
   PlaySoundAtEntity("Scream_1", "12_girl_scream.snt", "Scream_1", 0, false);
   PlaySoundAtEntity("Scream_1", "react_scare.snt", "Scream_1", 0, false);
   StartPlayerLookAt("LookArea_1", 2, 2, "");
   AddTimer("Somenamedoesntreallymatter", 2.0f, "LookArea_Trigger");
}
void LookArea_Trigger(string &in asTimer)
{
   StopPlayerLookAt();
}
(This post was last modified: 03-23-2011, 06:29 PM by Austums.)
03-23-2011, 06:23 PM
Find
Viperdream Offline
Member

Posts: 124
Threads: 16
Joined: Jan 2011
Reputation: 0
#4
RE: Use key to unlock door script, but the script crashes my level?

Wait, now I see the problem

Remove the last "true" of the SetLevelDoorLocked

Level doors don't have an effect Smile

03-23-2011, 06:30 PM
Find
Austums Offline
Member

Posts: 60
Threads: 11
Joined: Mar 2011
Reputation: 0
#5
RE: Use key to unlock door script, but the script crashes my level?

Good news is the level ran!

Bad news is, the door wasn't even locked. xD Do I lock a door from the Level Editor?
03-23-2011, 06:33 PM
Find
Viperdream Offline
Member

Posts: 124
Threads: 16
Joined: Jan 2011
Reputation: 0
#6
RE: Use key to unlock door script, but the script crashes my level?

Yup

You can also do that in the script with

void OnStart()
{
SetLevelDoorLocked("level_door", true);
}

But that's kind of a waste of time Tongue

03-23-2011, 06:35 PM
Find




Users browsing this thread: 1 Guest(s)