Frictional Games Forum (read-only)
unlock door - 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: unlock door (/thread-18687.html)



unlock door - rodrigo1999 - 10-08-2012

I'm new doing stories, but I really wanna do one. Now I have a problem with unlock a door, I saw tutorials, and I did what they said but didin't work.
my key's name is firstdoorkey and door's name is firstdoor.
I've got this is my ola.hps:
////////////////////////////
// Run first time starting map
void OnStart()
{
(
AddUseItemCallback("", "firstdoorkey", "firstdoor", "UsedKeyOnDoor", "true");
)

void MyFunc(string &in asItem, string &in asEntity)
(
SetSwingDoorLocked("firstdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "firstdoor", 0, false);
RemoveItem("firstdoorkey");
)
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}




and this in my extra english lang:

<LANGUAGE>
<RESOURCES>
</RESOURCES>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Hello There! Welcome to my first custom story, hope you enjoy! Big Grin</Entry>
<CATEGORY>
<CATEGORY Name="Inventory>
<Entry Name="ItemDesc_firstdoorkey">"Key to First door"</Entry>
<Entry Name="ItemName_firstdoorkey">First door key</Entry>

</CATEGORY>
<LANGUAGE>



so, can someone find any probem? Thanks so much! Big Grin


RE: unlock door - Adny - 10-08-2012

I'll walk you through the mistakes then post a full revision Big Grin

Spoiler below!

void OnStart()
{ <-----Extra bracket
( <---Here you used parentheses instead of a bracket
AddUseItemCallback("", "firstdoorkey", "firstdoor", "UsedKeyOnDoor", "true"); <----true should not be declared (in quotation marks)
) <---Here you used parentheses instead of a bracket

void MyFunc(string &in asItem, string &in asEntity) <---This function is MyFunc, but in the callback you used UsedKeyOnDoor
( <---Here you used parentheses instead of a bracket
SetSwingDoorLocked("firstdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "firstdoor", 0, false);
RemoveItem("firstdoorkey");
) <---Here you used parentheses instead of a bracket



Finally, here's a full revision; copy and paste this into your hps file. Make sure to delete any previous contents:

Spoiler below!


void OnStart()
{
AddUseItemCallback("", "firstdoorkey", "firstdoor", "UsedKeyOnDoor", true);
}

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



void OnEnter()
{

}


void OnLeave()
{

}


If you have any more problems after this, they're not script (hps) related.

Hope that helped!


RE: unlock door - The chaser - 10-08-2012

wow, Andyrockin went faster than me.

Well, rodrigo, Andyrockin's script should be useful for you. Also, this site is a very good one for you:

http://wiki.frictionalgames.com/hpl2/tutorials/start

Here are a lot of tutorials.


RE: unlock door - rodrigo1999 - 10-08-2012

I just copy that instead of mine and...... it worked!! thank you so much man Big Grin

Thank you too, The chaser