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
Multiple Issues Help How to use key to unlock level door?
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#1
Bug  How to use key to unlock level door?

How do I script a key to unlock a level door?

How do I script it so when I pick up a key a monster will spawn?
10-28-2011, 12:01 AM
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#2
RE: How to use key to unlock level door?

You'll want to use AddUseItemCallback for the level door, as well as SetLevelDoorLocked.

For your second question, you'll want
SetEntityPlayerInteractCallback as well as SetEntityActive.

10-28-2011, 12:07 AM
Find
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#3
RE: How to use key to unlock level door?

(10-28-2011, 12:07 AM)Obliviator27 Wrote: You'll want to use AddUseItemCallback for the level door, as well as SetLevelDoorLocked.

For your second question, you'll want
SetEntityPlayerInteractCallback as well as SetEntityActive.
Can you give me examples? I have no idea how to set up the door one...I've tried. My door is "girlsdormfirstfloor" and the key is "masterkey".

Is this correct?



SetEntityPlayerInteractCallback("masterkey", "ScaryMonster", true);


void ScaryMonster(string &in entity)
{
What should go here???
}
10-28-2011, 12:13 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: How to use key to unlock level door?

http://www.youtube.com/watch?v=mEpIqXo7MAc

Tutorials: From Noob to Pro
10-28-2011, 12:17 AM
Website Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#5
RE: How to use key to unlock level door?

http://wiki.frictionalgames.com/hpl2/sta...Atutorials

Wiki will help you a lot.

10-28-2011, 12:18 AM
Website Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#6
RE: How to use key to unlock level door?

void OnStart()
{
         AddUseItemCallback("", "masterkey", "girlsdormfirstfloor", "UnlockDoor", true);
         SetEntityPlayerInteractCallback("masterkey", "SpawnMonster", true);
}
void UnlockDoor(string &in asItem, string &in asEntity)
{
        SetLevelDoorLocked("girlsdormfirstfloor", false);
        PlaySoundAtEntity("", "unlock_door.snt", "girlsdormfirstfloor", 0, false);
        RemoveItem("masterkey");
}
void SpawnMonster(string &in asEntity)
{
       SetEntityActive("servant_grunt_1", true);
       (Add Various Pathnodes here, if you like)
}
Is an example.

10-28-2011, 12:19 AM
Find
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#7
RE: How to use key to unlock level door?

(10-28-2011, 12:19 AM)Obliviator27 Wrote:
void OnStart()
{
         AddUseItemCallback("", "masterkey", "girlsdormfirstfloor", "UnlockDoor", true);
         SetEntityPlayerInteractCallback("masterkey", "SpawnMonster", true);
}
void UnlockDoor(string &in asItem, string &in asEntity)
{
        SetLevelDoorLocked("girlsdormfirstfloor", false);
        PlaySoundAtEntity("", "unlock_door.snt", "girlsdormfirstfloor", 0, false);
        RemoveItem("masterkey");
}
void SpawnMonster(string &in asEntity)
{
       SetEntityActive("servant_grunt_1", true);
       (Add Various Pathnodes here, if you like)
}
Is an example.
Ooh yay! I was close haha! How do I set it so that he notices you right away? ShowPlayerPosition?
10-28-2011, 12:34 AM
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#8
RE: How to use key to unlock level door?

(10-28-2011, 12:34 AM)MissMarilynn Wrote: Ooh yay! I was close haha! How do I set it so that he notices you right away? ShowPlayerPosition?
Yep.

10-28-2011, 01:31 AM
Find




Users browsing this thread: 2 Guest(s)