| 
		
	
		| Macetrow   Junior Member
 
 Posts: 38
 Threads: 3
 Joined: Apr 2012
 Reputation: 
1
 | 
			| RE: Noob in trouble! 
 
				I tried that, but it didn't work either. This is quite frustrating xD I'm really grateful that someone is trying to help me with this!
			 |  |  
	| 04-14-2012, 09:41 AM |  |  
	
		| zombiehacker595   Member
 
 Posts: 141
 Threads: 51
 Joined: Mar 2012
 Reputation: 
3
 | 
			| RE: Noob in trouble! 
 
				 (04-14-2012, 09:41 AM)Macetrow Wrote:  I tried that, but it didn't work either. This is quite frustrating xD I'm really grateful that someone is trying to help me with this! 
AddUseItemCallback("", "key_1", "mansion_3", "UsedKeyOnDoor", true);
 
change that to this
 
AddUseItemCallback("OpenDoor", "key_1", "mansion_3", "UsedKeyOnDoor", true);
 
in your script you didnt have OpenDoor which will mean it wont work if this still doesnt work i have no idea whats wrong
			 |  |  
	| 04-14-2012, 10:18 AM |  |  
	
		| Datguy5   Senior Member
 
 Posts: 629
 Threads: 25
 Joined: Dec 2011
 Reputation: 
12
 | 
			| RE: Noob in trouble! 
 
				Btw heres an offtopic question  oes your door display a message when you interact with it and its locked?Because mine doesnt   
 |  |  
	| 04-14-2012, 11:54 AM |  |  
	
		| Macetrow   Junior Member
 
 Posts: 38
 Threads: 3
 Joined: Apr 2012
 Reputation: 
1
 | 
			| RE: Noob in trouble! 
 
				 Quote:zombiehacker595Wrote: Quote:AddUseItemCallback("", "key_1", "mansion_3", "UsedKeyOnDoor", true);
 change that to this
 
 AddUseItemCallback("OpenDoor", "key_1", "mansion_3", "UsedKeyOnDoor", true);
 
 in your script you didnt have OpenDoor which will mean it wont work if this still doesnt work i have no idea whats wrong
 
I tried it, but nothing changed. 
  Quote: Btw heres an offtopic question oes your door display a message when you interact with it and its locked?Because mine doesnt ![[Image: sad.gif]](http://www.frictionalgames.com/forum/images/smilies/sad.gif) 
 Add a category in your .lang file with something like:
 
<CATEGORY Name="Messages"> 
<Entry Name="msgname1">This door is locked, you need the key to go through.</Entry> 
</CATEGORY> 
And make sure you have something like this in your script:
 
void DoorLockedPlayer(string &in entity) 
{ 
 if(GetSwingDoorLocked("mansion_3") == true) 
 {
  
 SetMessage("Messages", "msgname1", 0);
  
 } 
}
 
This is what i'm using and it's working.
			 |  |  
	| 04-14-2012, 03:55 PM |  |  
	
		| Datguy5   Senior Member
 
 Posts: 629
 Threads: 25
 Joined: Dec 2011
 Reputation: 
12
 | 
			| RE: Noob in trouble! 
 
				 (04-14-2012, 03:55 PM)Macetrow Wrote:  Quote:zombiehacker595Wrote: Quote:AddUseItemCallback("", "key_1", "mansion_3", "UsedKeyOnDoor", true);I tried it, but nothing changed.
 change that to this
 
 AddUseItemCallback("OpenDoor", "key_1", "mansion_3", "UsedKeyOnDoor", true);
 
 in your script you didnt have OpenDoor which will mean it wont work if this still doesnt work i have no idea whats wrong
 
 
 
 Quote: Btw heres an offtopic questionAdd a category in your .lang file with something like: oes your door display a message when you interact with it and its locked?Because mine doesnt ![[Image: sad.gif]](http://www.frictionalgames.com/forum/images/smilies/sad.gif) 
 <CATEGORY Name="Messages">
 <Entry Name="msgname1">This door is locked, you need the key to go through.</Entry>
 </CATEGORY>
 And make sure you have something like this in your script:
 
 void DoorLockedPlayer(string &in entity)
 {
 if(GetSwingDoorLocked("mansion_3") == true)
 {
 
 SetMessage("Messages", "msgname1", 0);
 
 }
 }
 
 This is what i'm using and it's working.
 
I have it exactly like that.The messages name in my lang is msgname and in the hps heres the part of my script:  
void Lol(string &in entity)
 
{ 
if(GetSwingDoorLocked("Baws") == true) 
{
 
SetMessage("Messages", "msgname", 0);
 
} 
}
			 
 |  |  
	| 04-14-2012, 04:09 PM |  |  
	
		| Macetrow   Junior Member
 
 Posts: 38
 Threads: 3
 Joined: Apr 2012
 Reputation: 
1
 | 
			| RE: Noob in trouble! 
 
				Are you sure you've got msgname in your .lang file as well?
 Also, check if you've typed your function into the "PlayerInteractCallback" box on your door in the Level Editor?
 |  |  
	| 04-14-2012, 04:12 PM |  |  
	
		| Datguy5   Senior Member
 
 Posts: 629
 Threads: 25
 Joined: Dec 2011
 Reputation: 
12
 | 
			| RE: Noob in trouble! 
 
				 (04-14-2012, 04:12 PM)Macetrow Wrote:  Are you sure you've got msgname in your .lang file as well?
 Also, check if you've typed your function into the "PlayerInteractCallback" box on your door in the Level Editor?
 
Yes i have done those both.In my lang file its msgname and in the script its like that.
			 
 |  |  
	| 04-14-2012, 05:15 PM |  |  
	
		| Macetrow   Junior Member
 
 Posts: 38
 Threads: 3
 Joined: Apr 2012
 Reputation: 
1
 | 
			| RE: Noob in trouble! 
 
				Then i don't know why it doesn't work.
			 |  |  
	| 04-14-2012, 05:51 PM |  |  
	
		| Datguy5   Senior Member
 
 Posts: 629
 Threads: 25
 Joined: Dec 2011
 Reputation: 
12
 | 
			| RE: Noob in trouble! 
 
				 (04-14-2012, 05:51 PM)Macetrow Wrote:  Then i don't know why it doesn't work. 
Ok.But thanks anyways.
			 
 |  |  
	| 04-14-2012, 06:01 PM |  |  
	
		| DRedshot   Senior Member
 
 Posts: 374
 Threads: 23
 Joined: Jun 2011
 Reputation: 
11
 | 
			| RE: Noob in trouble! 
 
				This is a long-shot, but try it anyways: void OnStart(){
 AddUseItemCallback("", "key_1", "mansion_3", "UsedKeyOnDoor", true);
 SetEntityCallbackFunc("key_1", "OnPickup");
 }
 
 void UsedKeyOnDoor(string &in item, string &in entity)
 {
 SetSwingDoorLocked(entity, false, true);
 PlaySoundAtEntity("", "unlock_door.snt", entity, 0, false);
 RemoveItem(item);
 AddDebugMessage("Key has been used, is door unlocked?" , false);
 }
Check if the debug message shows up when you unlock the door. If it doesn't, there is a problem with the AddUseItemCallback, if it does, the problem is related to the SetSwingDoorLocked function. 
Also, make sure you are hitting enter when you type the entity name in the Level Editor. It sounds like an obvious thing to say, but so many times I have had these mysterious problems because I forgot to hit enter and the entities name doesn't register.
			
 
				
(This post was last modified: 04-14-2012, 06:47 PM by DRedshot.)
 |  |  
	| 04-14-2012, 06:46 PM |  |  |