Frictional Games Forum (read-only)
Scripting Queries - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Scripting Queries (/thread-16459.html)



Scripting Queries - JesterTone - 06-24-2012

Basically, as I suck at the moment with scripting and it's a touch too confusing - even though I've read the script tutorials on the wiki.frictionalgames webpage - so I'll be sticking my confusion all in here to keep it together.

1 Solved; 1 Unsolved

#2 - Language - Here is the scripting I'm using to rename my key and give it a bit of a description;

<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">
My description.. basic..
</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemDesc_Key_1">
A key to be used within the corridor.
</Entry>
<Entry Name="ItemName_Key_1">
Corridor Key
</Entry>
</CATEGORY>
</LANGUAGE>

Again - just let me know the tweaks or whatever I need to do to have my Key_1 be renamed 'Corridor Key' and the description become - 'A key to be used within the corridor'.

Thank you and if I have anymore, I'll be sure to change this first post and bump up.

Thanks all.


RE: Scripting Queries - bored2tears - 06-24-2012

(06-24-2012, 03:36 PM)bored2tears Wrote:
(06-24-2012, 03:27 PM)JesterTone Wrote: Basically, as I suck at the moment with scripting and it's a touch too confusing - even though I've read the script tutorials on the wiki.frictionalgames webpage - so I'll be sticking my confusion all in here to keep it together.

First up; locked doors and keys. I have my key and door and such set up. Now heres the script I have -

void OnStart()
{
AddUseItemCallback("", "Key_1", "corridor_door1", "open_CD1", true);
}

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

void OnEnter()
{
}

void OnLeave()
{
}

Now is there something I need to change or delete or add?

A second much smaller question - I have a painting I want to make moveable. Is there a specific painting I need to use?

Thank you and if I have anymore, I'll be sure to change this first post and bump up.

Thanks all.
Use this instead:

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



You need to set asEntity and asItem as the names of the entity/item, I believe.



RE: Scripting Queries - JesterTone - 06-24-2012

Thanks very much, solved my problem.

I've put a new query up.


RE: Scripting Queries - bored2tears - 06-24-2012

(06-24-2012, 03:27 PM)JesterTone Wrote: #2 - Language - Here is the scripting I'm using to rename my key and give it a bit of a description;

<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">
My description.. basic..
</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemDesc_Key_1">
A key to be used within the corridor.
</Entry>
<Entry Name="ItemName_Key_1">
Corridor Key
</Entry>
</CATEGORY>
</LANGUAGE>
Hmm, odd. I cannot see anything wrong with it. Try this:

Code:
<LANGUAGE>
    <CATEGORY Name="Inventory">
        <Entry Name="ItemDesc_Key_1">A key to be used within the corridor.</Entry>
        <Entry Name="ItemName_Key_1">Corridor Key</Entry>
    </CATEGORY>

    <CATEGORY Name="CustomStoryMain">
        <Entry Name="Description">Basic Description! Yippee!</Entry>
    </CATEGORY>

    </LANGUAGE>

Everything seems fine, so try it set up like that. That's how mine is set up, and it works, so maybe yours will too?


RE: Scripting Queries - JesterTone - 06-24-2012

Yeah, I thought I had done it right.
The description of the game is fine and works - but I tried it your way and it still didn't work. Still comes up "Rusty Key" and it's usual description.


RE: Scripting Queries - bored2tears - 06-24-2012

(06-24-2012, 04:39 PM)JesterTone Wrote: Yeah, I thought I had done it right.
The description of the game is fine and works - but I tried it your way and it still didn't work. Still comes up "Rusty Key" and it's usual description.
Did you set the name and the CustomSubItemTypeEntity name? (I keep them both the same name)


RE: Scripting Queries - JesterTone - 06-24-2012

I'd like to say firstly; I'm an idiot.
Heh.
I read that so many times and just never did it I guess. Thats another problem solved.

Quick question; I want to hide my key behind a painting - is there a specific painting I can use that is moveable or is it another scripting job?

Thanks very much to you both!


RE: Scripting Queries - bored2tears - 06-24-2012

(06-24-2012, 05:00 PM)JesterTone Wrote: I'd like to say firstly; I'm an idiot.
Heh.
I read that so many times and just never did it I guess. Thats another problem solved.

Quick question; I want to hide my key behind a painting - is there a specific painting I can use that is moveable or is it another scripting job?

Thanks very much to you both!
I am not sure about that. I know some of the static object walls have cubbies in them. I'm sure that there is a painting that can be moved or set through the options when you click on it.


RE: Scripting Queries - Cruzore - 06-24-2012

Make sure the painting you choose in the level editor has something with dyn or dynamic in it. To make it not fall off, place it slightly inside the wall. Just test it out.