| 
		
	
		| SetsuPotato   Junior Member
 
 Posts: 6
 Threads: 2
 Joined: Mar 2015
 Reputation: 
0
 | 
			| HPS and extra_english.lang not working 
 
				So today I was making a custom map because I was bored and when I tried to run it, it crashed. I tried removing the extra_english.lang and it will run, but my .hps file seems to be doing nothing whatsoever. None of my keys are working or anything.I probably messed up somewhere while I was writing one of them, which is likely because I'm new to the HPL editor and coding.
 
 My HPS file:
 
 void OnStart()
 {
 AddUseItemCallback("", "key_din", "door_din", "UsedKeyOnDoor", true);
 SetEntityPlayerInteractCallback("key_din", "MonstAct1", true);
 }
 
 void UsedKeyOnDoor()
 {
 SetSwingDoorLocked("door_din", false, true);
 PlaySoundAtEntity("", "unlock_door", "door_din", 0, false);
 RemoveItem("key_din");
 }
 
 void OnEnter()
 {
 
 }
 
 void OnLeave()
 {
 
 }
 
 void MonstAct1(string &in item)
 {
 SetEntityActive("monster1", true);
 AddEnemyPatrolNode("monster1", "PathNodeArea1", 0, "Idle");
 AddEnemyPatrolNode("monster1", "PathNodeArea2", 0, "Idle");
 }
 
 My extra_english.lang:
 
 <LANGUAGE>
 <CATEGORY Name="CustomStoryMain">
 <Entry Name="Description">I don't know where I am.</Entry>
 </CATEGORY>
 
 <CATEGORY Name="Journal">
 <Entry Name="Note_letterbedroom_Name">Is anyone here?</Entry>
 <Entry NAme="Note_letterbedroom_Text">Hello? Is anyone here?[br]I've found some stuff and left it on the desk for if anyone ends up here.[br]I couldn't seem to get that other door open. There's gotta be a key somewhere.</Entry>
 </CATEGORY>
 <CATEGORY Name="Inventory">
 <Entry Name="ItemName_keydin">Dining Room Key</Entry>
 <Entry Name="ItemDesc_keydin">Key to the Dining Room</Entry>
 </CATEGORY>
 </LANGUAGE>[/code][/quote]
 |  |  
	| 03-11-2015, 05:52 PM |  |  
	
		| Neelke   Senior Member
 
 Posts: 668
 Threads: 82
 Joined: Apr 2013
 Reputation: 
26
 | 
			| RE: HPS and extra_english.lang not working 
 
				void UsedKeyOnDoor() 
 The () cannot be empty in this scenario. It needs a few extra things:
 
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 
 asItem = the main item used on the object (in this case the key)
 asEntity = the main object the item is being used on (in this case the door)
 
 Derp. |  |  
	| 03-11-2015, 06:43 PM |  |  
	
		| Traggey   is mildly amused
 
 Posts: 3,257
 Threads: 74
 Joined: Feb 2012
 Reputation: 
185
 | 
			| RE: HPS and extra_english.lang not working 
 
				Make sure to post in the support forum in the future, thread moved!
			 |  |  
	| 03-11-2015, 07:23 PM |  |  
	
		| SetsuPotato   Junior Member
 
 Posts: 6
 Threads: 2
 Joined: Mar 2015
 Reputation: 
0
 | 
			| RE: HPS and extra_english.lang not working 
 
				 (03-11-2015, 06:43 PM)Neelke Wrote:  void UsedKeyOnDoor() 
 The () cannot be empty in this scenario. It needs a few extra things:
 
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 
 asItem = the main item used on the object (in this case the key)
 asEntity = the main object the item is being used on (in this case the door)
 
I tried that and the key still doesn't open the door. Do you also have any idea why when I pick up my key it's supposed to trigger an enemy but it doesn't?
			 |  |  
	| 03-11-2015, 10:55 PM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: HPS and extra_english.lang not working 
 
				 (03-11-2015, 10:55 PM)SetsuPotato Wrote:   (03-11-2015, 06:43 PM)Neelke Wrote:  void UsedKeyOnDoor() 
 The () cannot be empty in this scenario. It needs a few extra things:
 
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 
 asItem = the main item used on the object (in this case the key)
 asEntity = the main object the item is being used on (in this case the door)
 I tried that and the key still doesn't open the door. Do you also have any idea why when I pick up my key it's supposed to trigger an enemy but it doesn't?
 
It's because you didn't write the parameters correctly.
 
You wrote: (string &in item) 
But it's an interaction callback so it's supposed to be: (string &in asEntity)
 
This thread might help: http://www.frictionalgames.com/forum/thread-18368.html 
Here is how the script should look.
 void OnStart(){
 AddUseItemCallback("", "key_din", "door_din", "UsedKeyOnDoor", true);
 SetEntityPlayerInteractCallback("key_din", "MonstAct1", true);
 }
 
 void UsedKeyOnDoor(string &in asItem, string in asEntity)
 {
 SetSwingDoorLocked("door_din", false, true);
 PlaySoundAtEntity("", "unlock_door", "door_din", 0, false);
 RemoveItem("key_din");
 }
 
 void OnEnter()
 {
 
 }
 
 void OnLeave()
 {
 
 }
 
 void MonstAct1(string &in asEntity)
 {
 SetEntityActive("monster1", true);
 AddEnemyPatrolNode("monster1", "PathNodeArea1", 0, "Idle");
 AddEnemyPatrolNode("monster1", "PathNodeArea2", 0, "Idle");
 }
 
 
 Trying is the first step to success. |  |  
	| 03-12-2015, 12:36 AM |  |  
	
		| SetsuPotato   Junior Member
 
 Posts: 6
 Threads: 2
 Joined: Mar 2015
 Reputation: 
0
 | 
			| RE: HPS and extra_english.lang not working 
 
				 (03-12-2015, 12:36 AM)FlawlessHappiness Wrote:   (03-11-2015, 10:55 PM)SetsuPotato Wrote:   (03-11-2015, 06:43 PM)Neelke Wrote:  void UsedKeyOnDoor() 
 The () cannot be empty in this scenario. It needs a few extra things:
 
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 
 asItem = the main item used on the object (in this case the key)
 asEntity = the main object the item is being used on (in this case the door)
 I tried that and the key still doesn't open the door. Do you also have any idea why when I pick up my key it's supposed to trigger an enemy but it doesn't?
 It's because you didn't write the parameters correctly.
 
 You wrote: (string &in item)
 But it's an interaction callback so it's supposed to be: (string &in asEntity)
 
 This thread might help: http://www.frictionalgames.com/forum/thread-18368.html
 
 Here is how the script should look.
 
 void OnStart(){
 AddUseItemCallback("", "key_din", "door_din", "UsedKeyOnDoor", true);
 SetEntityPlayerInteractCallback("key_din", "MonstAct1", true);
 }
 
 void UsedKeyOnDoor(string &in asItem, string in asEntity)
 {
 SetSwingDoorLocked("door_din", false, true);
 PlaySoundAtEntity("", "unlock_door", "door_din", 0, false);
 RemoveItem("key_din");
 }
 
 void OnEnter()
 {
 
 }
 
 void OnLeave()
 {
 
 }
 
 void MonstAct1(string &in asEntity)
 {
 SetEntityActive("monster1", true);
 AddEnemyPatrolNode("monster1", "PathNodeArea1", 0, "Idle");
 AddEnemyPatrolNode("monster1", "PathNodeArea2", 0, "Idle");
 }
 
 Still isn't working.
			 |  |  
	| 03-12-2015, 03:15 PM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: HPS and extra_english.lang not working 
 
				 (03-12-2015, 03:15 PM)SetsuPotato Wrote:  Still isn't working. 
Look, you're not giving enough information. 
You're just saying it doesn't work.
 
I cannot help you, if you don't tell me anything.
 
Please tell me what happens when you run the map. 
Any errors? Does nothing happen at all?
 
If nothing happens at all, do check again that map name and script .hps name corresponds.
 
EDIT: By the way, you wrote "key_din" in your script, but "keydin" in your .lang file. Which is it?
			 
 Trying is the first step to success. |  |  
	| 03-12-2015, 04:26 PM |  |  
	
		| SetsuPotato   Junior Member
 
 Posts: 6
 Threads: 2
 Joined: Mar 2015
 Reputation: 
0
 | 
			| RE: HPS and extra_english.lang not working 
 
				 (03-12-2015, 04:26 PM)FlawlessHappiness Wrote:   (03-12-2015, 03:15 PM)SetsuPotato Wrote:  Still isn't working. Look, you're not giving enough information.
 You're just saying it doesn't work.
 
 I cannot help you, if you don't tell me anything.
 
 
 Please tell me what happens when you run the map.
 Any errors? Does nothing happen at all?
 
 If nothing happens at all, do check again that map name and script .hps name corresponds.
 
 EDIT: By the way, you wrote "key_din" in your script, but "keydin" in your .lang file. Which is it?
 
When I pick up the key, it does not trigger the enemy as it is supposed to. When I attempt to use the key on the door, it says I can't use it on the door.
 
Also, "key_din" is the actual name of the key and my .lang file crashes my game so "keydin" shouldn't matter.
			 |  |  
	| 03-12-2015, 10:01 PM |  |  
	
		| Straxedix   Senior Member
 
 Posts: 426
 Threads: 52
 Joined: Mar 2014
 Reputation: 
5
 | 
			| RE: HPS and extra_english.lang not working 
 
				Bro are you sure that the monster and areas are same in level editor as your ones in script also if you use lang and hps files make sure it is same name example:
 Level01.map
 Level01.hps
 
 About lang file you shall add name key_din to a entity, also check if you are working on correct map (happened to me once).
 
 |  |  
	| 03-13-2015, 08:19 AM |  |  
	
		| Neelke   Senior Member
 
 Posts: 668
 Threads: 82
 Joined: Apr 2013
 Reputation: 
26
 | 
			| RE: HPS and extra_english.lang not working 
 
				Have you even applied the callback function to the key? There are two ways of fixing this, either adding it into the key from the Level Editor or add it in through scripting. void OnStart(){
 SetEntityCallbackFunc("key_din", "MonstAct1");
 }
I think you'll also need to modify this too.
 void MonstAct1(string &in asEntity, string &in asType)
 //asType = basically explaining what the player is doing during this function. The main calls for this is //usually Pickup, Break or Ignite. In this case its Pickup.
 Derp. 
				
(This post was last modified: 03-13-2015, 09:10 AM by Neelke.)
 |  |  
	| 03-13-2015, 09:08 AM |  |  |