Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Amnesia Level Editor Key Script Not Working
youngblood128 Offline
Junior Member

Posts: 10
Threads: 2
Joined: Aug 2012
Reputation: 0
#1
Amnesia Level Editor Key Script Not Working

Hey I was really looking for some help on my script, I used a layout to make it so that a key works on a certain door I've seen tutorials and tried it using that layout but it didn't work i revised it and fixed some errors but it still doesn't work(in depth explanation at bottom)and I also tried typing it from scratch and looking at various videos and searching the forums I am still stuck here is my coding.
extra_english.lang file:

<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">You awake in your room to discover that some form of darkness followed you one night you had a case of amnesia and connot remember the horrors of that night whatever it is...it wants you, it is your job to discover his secret and stop the darkness.</Entry>
</CATEGORY>
<CATEGORY Name="inventory">
<Entry Name="ItemName_Key1">Main Hall Key</Entry>
<Entry Name="ItemDesc_Key1">Opens Main Hall Door.</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_01_Name">Danger!</Entry>
<Entry Name="Note_01_Text">Brother! Are you ok I hope you are we heard noises outside and when we went to investigate you were lying on the the floor screaming "man and chain" we took you upstairs to your room so that you could rest about 30 minutes later a death was reported people said they were being attacked by a man covered in chains you know something about this...everybody is dying!...I want you to be save I'm going to barracade the door to protect you I'm going out I want to help the people who I hear with distant screams don't worry about me just be safe and stop whatever this is! </Entry>
<Entry Name="Note_02_Name">Escape!</Entry>
<Entry Name="Note_02_Text">Trapped in this room monster outside he seems to be blocking everyone from leaving I had a plan but its too late due to over growth of bushes, trees and plants half of the castle is covered in plants so we boarded up the windows weeks ago to prevent plants from coming into the castle; with some kind of dagger and a crowbar you might be able to escape I had a crowbar but I dropped it in the prison...I hear him! Good luck to whom ever reads this...you'll need it.</Entry>
</CATEGORY>
</LANGUAGE>
my maps.hps file

void OnEnter()
{
AddUseItemCallback("", "Key_1", "Main1", "UsedKeyOnDoor", true);
}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Main1", false, true);
PlaySoundAtEntity("", "unlock_door", "Main1", 0, false);
RemoveItem("Key_1");
}


void OnLeave()
{

}
--------------------------------
That's the coding I just started, with my key name is key_1 and its sub name is key1 and the door is called
Main1 what happens is that when I pick up the key it says "picked up" but it has no name and no description and it doesn't unlock the door and help would be great thanks.


08-08-2012, 11:28 PM
Find
Melvin Offline
Member

Posts: 245
Threads: 38
Joined: Jun 2012
Reputation: 5
#2
RE: Amnesia Level Editor Key Script Not Working

//////////////////////////////////////////////////AddUseItemCallback("", "Awesomekey","AwesomeDoor", "KeyOnDoor", true);


void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("AwesomeDoor", false, true);
PlaySoundAtEntity("", "unlock_door", "AwesomeDoor", 0, false);
RemoveItem("Awesomekey");
}
///////////////////////////
this is my own usage of the keyscript, I've got no idea whats wrong with yours bro :O

[Image: 25F7U37.png]
08-09-2012, 01:01 AM
Website Find
Seragath Offline
Junior Member

Posts: 34
Threads: 1
Joined: Jan 2011
Reputation: 0
#3
RE: Amnesia Level Editor Key Script Not Working

I've always found the .LANG to be silly and not able to listen to you even though everything is correct. I checked the "AddUseItemCallback" And the last one is a bool. (True/false) for auto destroying the item when used. I guess that means it's removed after it's been used or breaks up like the crowbar does. So having another script to remove the key when you've put this to true could confuse the engine. Or it has nothing to do with it at all..I've not really tested locked doors myself yet. (Yeah I know stupid, huh ?)



And I believe you must have:
void OnStart()
{
}

I think.. Blush
08-09-2012, 09:26 AM
Find
youngblood128 Offline
Junior Member

Posts: 10
Threads: 2
Joined: Aug 2012
Reputation: 0
#4
RE: Amnesia Level Editor Key Script Not Working

Thanks for the replies guys and I did perform some edits based on the ideas you guys had but still no result when I pick up the key it just says "picked up" I'm going to create another locked door in another map with another key and see how that goes, I'll post my results any more suggestions I would love to hear them thanks again.
08-09-2012, 03:22 PM
Find
Melvin Offline
Member

Posts: 245
Threads: 38
Joined: Jun 2012
Reputation: 5
#5
RE: Amnesia Level Editor Key Script Not Working

(08-09-2012, 09:26 AM)Seragath Wrote: I've always found the .LANG to be silly and not able to listen to you even though everything is correct. I checked the "AddUseItemCallback" And the last one is a bool. (True/false) for auto destroying the item when used. I guess that means it's removed after it's been used or breaks up like the crowbar does. So having another script to remove the key when you've put this to true could confuse the engine. Or it has nothing to do with it at all..I've not really tested locked doors myself yet. (Yeah I know stupid, huh ?)



And I believe you must have:
void OnStart()
{
}

I think.. Blush
OnStart means something will happen when the player first enters the map
OnEnter mean something will happen when the player enters the map (so, everytime)

(08-08-2012, 11:28 PM)youngblood128 Wrote: Hey I was really looking for some help on my script, I used a layout to make it so that a key works on a certain door I've seen tutorials and tried it using that layout but it didn't work i revised it and fixed some errors but it still doesn't work(in depth explanation at bottom)and I also tried typing it from scratch and looking at various videos and searching the forums I am still stuck here is my coding.
extra_english.lang file:



You awake in your room to discover that some form of darkness followed you one night you had a case of amnesia and connot remember the horrors of that night whatever it is...it wants you, it is your job to discover his secret and stop the darkness.


Main Hall Key
Opens Main Hall Door.


Danger!
Brother! Are you ok I hope you are we heard noises outside and when we went to investigate you were lying on the the floor screaming "man and chain" we took you upstairs to your room so that you could rest about 30 minutes later a death was reported people said they were being attacked by a man covered in chains you know something about this...everybody is dying!...I want you to be save I'm going to barracade the door to protect you I'm going out I want to help the people who I hear with distant screams don't worry about me just be safe and stop whatever this is!
Escape!
Trapped in this room monster outside he seems to be blocking everyone from leaving I had a plan but its too late due to over growth of bushes, trees and plants half of the castle is covered in plants so we boarded up the windows weeks ago to prevent plants from coming into the castle; with some kind of dagger and a crowbar you might be able to escape I had a crowbar but I dropped it in the prison...I hear him! Good luck to whom ever reads this...you'll need it.


my maps.hps file

void OnEnter()
{
AddUseItemCallback("", "Key_1", "Main1", "UsedKeyOnDoor", true);
}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Main1", false, true);
PlaySoundAtEntity("", "unlock_door", "Main1", 0, false);
RemoveItem("Key_1");
}


void OnLeave()
{

}
--------------------------------
That's the coding I just started, with my key name is key_1 and its sub name is key1 and the door is called
Main1 what happens is that when I pick up the key it says "picked up" but it has no name and no description and it doesn't unlock the door and help would be great thanks.






///////////////////////////// try this

</LANGUAGE>


<CATEGORY Name ="Inventory">
<Entry Name="ItemName_Key_1">YourKeyName</Entry>
<Entry Name="ItemDesc_Key_1">"YourKeyDescription"</Entry>
</CATEGORY>

</LANGUAGE>


If this doesn't work, try to run the leveleditor as admin and edit it.
Also, make sure you save the lang and the script.

[Image: 25F7U37.png]
(This post was last modified: 08-09-2012, 10:41 PM by Melvin.)
08-09-2012, 10:39 PM
Website Find
youngblood128 Offline
Junior Member

Posts: 10
Threads: 2
Joined: Aug 2012
Reputation: 0
#6
RE: Amnesia Level Editor Key Script Not Working

I've been busting my head open trying to get this to work but I still have no result I've tried to re-write the code in different ways I found but I still get no result I've tried it on a different map yet no change hm.....so I'm here to ask if anyone knows how to use a crowbar to open a door instead of a key if anyone wants to check out my map and the coding and see if they can give it a shot that would be beyond awesome thanks again please reply soon.
08-13-2012, 05:23 AM
Find
GrAVit Offline
Senior Member

Posts: 580
Threads: 15
Joined: Oct 2011
Reputation: 22
#7
RE: Amnesia Level Editor Key Script Not Working

You need to name the key in the level editor as Key_1 and you also have to add a CustomSubItemTypeName in the Entity options of the key. You need that so the .lang file will pick it up and it will have a name and description ingame. In this case it should be Key_1 aswell.

(This post was last modified: 08-14-2012, 07:34 AM by GrAVit.)
08-14-2012, 07:33 AM
Find
youngblood128 Offline
Junior Member

Posts: 10
Threads: 2
Joined: Aug 2012
Reputation: 0
#8
RE: Amnesia Level Editor Key Script Not Working

Hey guys its been a while and just so you know I've become an incredible good script-er in my opinion of course and I am 2 months into a custom story, thanks for all your help guys if you guys are interested in my story please post replies or if you need help with scripting I have become really good.(My Dream)
01-30-2013, 03:18 AM
Find
Wolfpa Offline
Junior Member

Posts: 14
Threads: 3
Joined: Aug 2013
Reputation: 0
#9
RE: Amnesia Level Editor Key Script Not Working

(08-09-2012, 03:22 PM)youngblood128 Wrote: Thanks for the replies guys and I did perform some edits based on the ideas you guys had but still no result when I pick up the key it just says "picked up" I'm going to create another locked door in another map with another key and see how that goes, I'll post my results any more suggestions I would love to hear them thanks again.

I saw your problem and I know how to help!

Go the LANG. file and write this: (Just replace "key" with your key name and name and desc!)

<CATEGORY Name="Inventory">
<Entry Name="ItemDesc_key">It's a key for a cellar door</Entry>
<Entry Name="ItemName_key">Cellar Key</Entry>
</CATEGORY>
08-03-2013, 09:38 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#10
RE: Amnesia Level Editor Key Script Not Working

(08-03-2013, 09:38 AM)Wolfpa Wrote:
(08-09-2012, 03:22 PM)youngblood128 Wrote: Thanks for the replies guys and I did perform some edits based on the ideas you guys had but still no result when I pick up the key it just says "picked up" I'm going to create another locked door in another map with another key and see how that goes, I'll post my results any more suggestions I would love to hear them thanks again.

I saw your problem and I know how to help!

Go the LANG. file and write this: (Just replace "key" with your key name and name and desc!)

<CATEGORY Name="Inventory">
<Entry Name="ItemDesc_key">It's a key for a cellar door</Entry>
<Entry Name="ItemName_key">Cellar Key</Entry>
</CATEGORY>

....Did you see his (or her) latest post before?
[EDIT: Mis-read it. I mean look at GrAVit's post]

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 08-03-2013, 09:50 AM by PutraenusAlivius.)
08-03-2013, 09:46 AM
Find




Users browsing this thread: 1 Guest(s)