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
Need help with key sais error
swapinamnesia Offline
Junior Member

Posts: 3
Threads: 1
Joined: Feb 2012
Reputation: 0
#1
Need help with key sais error

Hi im trying to make my first amnesia map i did a map with a key and a door that was locked but when i try to load the map in amnesia this error pops up

FATAL ERROR

FATAL ERROR: Could not load script file custom_stories/TheHauntedCellar/maps/TheHauntedCellar.hps! main (13,16) : ERR : Key_1 is not declared

What does that mean??? and heres my script in the hps file

void OnStart()
{

AddUseItemCallback("", "Key_1", "door_1", "UsedKeyOnDoor", true);

}

void FUNCTION(string &in item, string &in door)
{

SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem(Key_1);

}

Could anyone help me have been searching on youtube and google for a solution but i cant find any please help.
02-29-2012, 11:48 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: Need help with key sais error

void FUNCTIONUsedKeyOnDoor(string &in item, string &in door)
{

SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem(Key_1 "Key_1");

}

03-01-2012, 12:18 AM
Website Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#3
RE: Need help with key sais error

void FUNCTIONUsedKeyOnDoor(string &in item, string &in door)(string &in asItem, string &in asEntity)
{

SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem(Key_1 "Key_1");

}

03-01-2012, 12:58 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#4
RE: Need help with key sais error

You don't have to write asItem and asEntity if you are not using them as string variables.

03-01-2012, 01:30 AM
Website Find
Juby Away
Senior Member

Posts: 290
Threads: 2
Joined: May 2011
Reputation: 5
#5
RE: Need help with key sais error

My personal favorite way to do this:

void UsedKeyOnDoor(string &in Item, string &in Door)
{
SetSwingDoorLocked(Door, false, true);
PlaySoundAtEntity("", "unlock_door", Door, 0, false);
RemoveItem(Item);
}

so you can use it multiple times Smile

Insanity. Static.
03-01-2012, 07:01 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#6
RE: Need help with key sais error

(03-01-2012, 07:01 AM)Juby Wrote:
My personal favorite way to do this:

void UsedKeyOnDoor(string &in Item, string &in Door)
{
SetSwingDoorLocked(Door, false, true);
PlaySoundAtEntity("", "unlock_door", Door, 0, false);
RemoveItem(Item);
}

so you can use it multiple times Smile
Wouldn't it be


SetSwingDoorLocked(asEntity, false, true);

03-01-2012, 07:08 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#7
RE: Need help with key sais error

It wouldn't be because:

void UsedKeyOnDoor(string &in Item, string &in Door)
{
SetSwingDoorLocked(Door, false, true);
PlaySoundAtEntity("", "unlock_door", Door, 0, false);
RemoveItem(Item);
}

03-01-2012, 08:57 AM
Website Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#8
RE: Need help with key sais error

Ah, didn't read that.

03-01-2012, 09:08 AM
Find
jessehmusic Offline
Senior Member

Posts: 423
Threads: 102
Joined: Dec 2011
Reputation: 8
#9
RE: Need help with key sais error

(02-29-2012, 11:48 PM)swapinamnesia Wrote: Hi im trying to make my first amnesia map i did a map with a key and a door that was locked but when i try to load the map in amnesia this error pops up

FATAL ERROR

FATAL ERROR: Could not load script file custom_stories/TheHauntedCellar/maps/TheHauntedCellar.hps! main (13,16) : ERR : Key_1 is not declared

What does that mean??? and heres my script in the hps file

void OnStart()
{

AddUseItemCallback("", "Key_1", "door_1", "UsedKeyOnDoor", true);

}

void FUNCTION(string &in item, string &in door)
{

SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem(Key_1);

}

Could anyone help me have been searching on youtube and google for a solution but i cant find any please help.
void OnStart()
{

AddUseItemCallback("", "Key_1", "door_1", "UsedKeyOnDoor", true);

}

void UsedKeyOnDoor(string &in item, string &in door)
{

SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem(Key_1);

}


try this

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
03-01-2012, 04:53 PM
Website Find
swapinamnesia Offline
Junior Member

Posts: 3
Threads: 1
Joined: Feb 2012
Reputation: 0
#10
RE: Need help with key sais error

Thanks guys so much it works now Big Grin
03-02-2012, 05:03 PM
Find




Users browsing this thread: 1 Guest(s)