| 
		
	
		| MissMarilynn   Member
 
 Posts: 77
 Threads: 23
 Joined: Oct 2011
 Reputation: 
1
 | 
			|  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 |  |  
	
		| Obliviator27   Posting Freak
 
 Posts: 792
 Threads: 10
 Joined: Jul 2011
 Reputation: 
66
 | 
			| 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 |  |  
	
		| MissMarilynn   Member
 
 Posts: 77
 Threads: 23
 Joined: Oct 2011
 Reputation: 
1
 | 
			| 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 |  |  
	
		| Your Computer   SCAN ME!
 
 Posts: 3,456
 Threads: 32
 Joined: Jul 2011
 Reputation: 
235
 | 
			| RE: How to use key to unlock level door? 
 
 |  |  
	| 10-28-2011, 12:17 AM |  |  
	
		| Tanshaydar   From Beyond
 
 Posts: 3,085
 Threads: 17
 Joined: Mar 2009
 Reputation: 
67
 | 
			| RE: How to use key to unlock level door? 
 
 |  |  
	| 10-28-2011, 12:18 AM |  |  
	
		| Obliviator27   Posting Freak
 
 Posts: 792
 Threads: 10
 Joined: Jul 2011
 Reputation: 
66
 | 
			| 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 |  |  
	
		| MissMarilynn   Member
 
 Posts: 77
 Threads: 23
 Joined: Oct 2011
 Reputation: 
1
 | 
			| RE: How to use key to unlock level door? 
 
				 (10-28-2011, 12:19 AM)Obliviator27 Wrote:  Is an example.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)
 }
 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 |  |  
	
		| Obliviator27   Posting Freak
 
 Posts: 792
 Threads: 10
 Joined: Jul 2011
 Reputation: 
66
 | 
			| 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 |  |  |