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
unlock door
rodrigo1999 Offline
Junior Member

Posts: 2
Threads: 1
Joined: Oct 2012
Reputation: 0
#1
unlock door

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
10-08-2012, 08:53 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
RE: unlock door

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!

I rate it 3 memes.
(This post was last modified: 10-08-2012, 09:03 PM by Adny.)
10-08-2012, 09:02 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#3
RE: unlock door

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.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-08-2012, 09:13 PM
Find
rodrigo1999 Offline
Junior Member

Posts: 2
Threads: 1
Joined: Oct 2012
Reputation: 0
#4
RE: unlock door

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

Thank you too, The chaser
(This post was last modified: 10-08-2012, 09:28 PM by rodrigo1999.)
10-08-2012, 09:27 PM
Find




Users browsing this thread: 1 Guest(s)