Frictional Games Forum (read-only)
Key Script? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Key Script? (/thread-4364.html)

Pages: 1 2 3


RE: Key Script? - jens - 09-15-2010

If you look at the script tutorial it is basically using a timer to show a message, use the timer to disable the monster instead.

http://hpl2.frictionalgames.com/tutorials:amnesia_script:tutorial_1


RE: Key Script? - grahfcard - 09-15-2010

Thanks for the info, Jens Big Grin
I have absolutely no experience in any scripting language (except a couple of interactive fiction ones, but they were obviously different), so most of the scripts look like gibberish since I can't understand the terms. The manual is coming in handy, and I've started reading up.


RE: Key Script? - sacroid - 09-15-2010

(09-15-2010, 02:33 PM)jens Wrote: If you look at the script tutorial it is basically using a timer to show a message, use the timer to disable the monster instead.

http://hpl2.frictionalgames.com/tutorials:amnesia_script:tutorial_1

That's a nice alternative, thanks!


RE: Key Script? - theDARKW0LF - 09-15-2010

(09-15-2010, 02:31 PM)Jordo76 Wrote: Door are Simple,All you need is a Door (Of course),a key (Big Grin) and a .hps

To open a door with a key,it's simple,name the door first,we'll name it "door_1" and the key "key_1"
Set the Door to Locked
Go to the hps file,open it and type :
Code:
void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);

RemoveItem(asItem);
}


void OnStart()
{

AddUseItemCallback("useexit", "key_1", "door_1", "UseKey",true);

}

And you're all set !
You can add everything in void Onstart() for example :
GiveItemFromFile("lantern", "lantern.ent");
For giving a lantern to the players,etc...
Yes i used the script of the 30 min editor map,
I hope you will do a great map !

PS : If my english is bad it's because i'm french ^^

Thanks for your help, that worked well, but I have one more question: Is there a way to rename the key you place into your map? The one I have that works is called the "Machine Room Key", but obviously that's not what it is used for. Thanks!


RE: Key Script? - sacroid - 09-15-2010

To change the entity's name you need to select it in the editor and in the entity bar, you can change it's name Wink


RE: Key Script? - theDARKW0LF - 09-16-2010

(09-15-2010, 11:14 PM)sacroid Wrote: To change the entity's name you need to select it in the editor and in the entity bar, you can change it's name Wink

I was trying to change the name that is shown when you pick it up in-game, but I can't seem to get it to work right. I'm trying to enter the name in the "CustomSubItemTypeName" field in the Entity tab, but every time I pick it up ingame, all it says is, "Picked up"? There's no name after those two words. What is the right syntax to use when entering a name in that field? It says, to use 'ItemName_', but I can't find out whether to remove the ' and where to place the name and whether it needs an underscore instead of a space, etc... Lol a lot of stuff I don't know and need to know.


RE: Key Script? - Neurological - 09-16-2010

Most of the name stuff are stored inside the lang files, you may need to modify them and call the string name from the entity in the level editor.


RE: Key Script? - theDARKW0LF - 09-16-2010

(09-16-2010, 12:46 AM)Neurological Wrote: Most of the name stuff are stored inside the lang files, you may need to modify them and call the string name from the entity in the level editor.

Haha ok sorry for yet another question, but how do I do that?


RE: Key Script? - Neurological - 09-16-2010

inside config/lag_main there are all the language files where all text is stored. Ope n for example english.lang with notepad or any other text editor.

The category for the inventory items is right on the top. Example:

<Entry Name="ItemName_KeyWineCellar">Wine Cellar Key</Entry>

The suffix ItemName_ is what tell the game that this is the text for the item title name, you would need to put only KeyWineCellar on the entity in the level editor.

Try to put another string and see if it works.


RE: Key Script? - theDARKW0LF - 09-16-2010

(09-16-2010, 01:20 AM)Neurological Wrote: inside config/lag_main there are all the language files where all text is stored. Ope n for example english.lang with notepad or any other text editor.

The category for the inventory items is right on the top. Example:

<Entry Name="ItemName_KeyWineCellar">Wine Cellar Key</Entry>

The suffix ItemName_ is what tell the game that this is the text for the item title name, you would need to put only KeyWineCellar on the entity in the level editor.

Try to put another string and see if it works.

Ok, so let me get this straight, I need to add a new entry in the english.lang, or edit a current one (wouldn't that also then edit that entity in the main game then)? Where would I put the name in the editor?

EDIT: Nevermind this post, looks like I found it out, thanks for your help!