03-31-2012, 04:35 AM
03-31-2012, 10:15 AM
AddUseItemCallback
SetSwingDoorLocked
RemoveItem
PlaySoundAtEntity
SetSwingDoorLocked
RemoveItem
PlaySoundAtEntity
03-31-2012, 10:17 AM
void OnStart()
{
AddUseItemCallback("", "Nameofyourneedle", "Nameofyourdoor", "Needle", true);
}
void Needle(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("nameofyourdoor", false);
PlaySoundAtEntity("", "unlock_door", "nameofyourdoor", 0, false);
RemoveItem("nameofyourneedle");
}
I hope it works, sorry if it's kinda rushed, I'm in a hurry.
03-31-2012, 10:28 AM
Here's a tutorial. It helped me when I was first in this pinch.
http://wiki.frictionalgames.com/hpl2/tut...cks_a_door
http://wiki.frictionalgames.com/hpl2/tut...cks_a_door
03-31-2012, 10:52 AM
(03-31-2012, 10:17 AM)HollowRiku13 Wrote: [ -> ]void OnStart()or he can just write RemoveItem(asItem);
{
AddUseItemCallback("", "Nameofyourneedle", "Nameofyourdoor", "Needle", true);
}
void Needle(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("nameofyourdoor", false);
PlaySoundAtEntity("", "unlock_door", "nameofyourdoor", 0, false);
RemoveItem("nameofyourneedle");
}
I hope it works, sorry if it's kinda rushed, I'm in a hurry.
03-31-2012, 11:17 AM
(03-31-2012, 10:52 AM)SilentStriker Wrote: [ -> ]works great thanks(03-31-2012, 10:17 AM)HollowRiku13 Wrote: [ -> ]void OnStart()or he can just write RemoveItem(asItem);
{
AddUseItemCallback("", "Nameofyourneedle", "Nameofyourdoor", "Needle", true);
}
void Needle(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("nameofyourdoor", false);
PlaySoundAtEntity("", "unlock_door", "nameofyourdoor", 0, false);
RemoveItem("nameofyourneedle");
}
I hope it works, sorry if it's kinda rushed, I'm in a hurry.
03-31-2012, 04:41 PM
(03-31-2012, 10:52 AM)SilentStriker Wrote: [ -> ]Technically he could just write(03-31-2012, 10:17 AM)HollowRiku13 Wrote: [ -> ]void OnStart()or he can just write RemoveItem(asItem);
{
AddUseItemCallback("", "Nameofyourneedle", "Nameofyourdoor", "Needle", true);
}
void Needle(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("nameofyourdoor", false);
PlaySoundAtEntity("", "unlock_door", "nameofyourdoor", 0, false);
RemoveItem("nameofyourneedle");
}
I hope it works, sorry if it's kinda rushed, I'm in a hurry.
SetLevelDoorLocked(asEntity , false);
PlaySoundAtEntity("", "unlock_door", "asEntity", 0, false); c:
04-01-2012, 12:38 AM
I'm sorry, as I said, yesterday I was in a hurry, I just copied a part of my script.
08-07-2012, 11:57 PM
Actually, I'm having a problem with this. I set the door as "locked" in my level editor, and when I use the needle on it, it makes the noise but it stays locked. So I set the door as unlocked, and in my script, in OnEnter, I put "SetLevelDoorLocked(true);", so it would hopefully stay locked until I used the needle. But no, the door is just unlocked. What am I doing wrong? Here's my script:
Code:
void OnEnter()
{
ChangePlayerStateToNormal();
SetLanternDisabled(false);
SetEntityPlayerLookAtCallback("JimmyOne", "JimmyOne", true);
SetLevelDoorLocked("RoomDoor", true);
AddUseItemCallback("", "JimmyOne", "RoomDoor", "UnlockOne", true);
}
void JimmyOne(string &in asEntity, int alState)
{
SetMessage("Message", "JimmyMessageOne", 6.0f);
}
void UnlockOne(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("RoomDoor", false);
PlaySoundAtEntity("", "unlock_door", "RoomDoor", 0, false);
RemoveItem("JimmyOne");
}