Frictional Games Forum (read-only)
HPS and extra_english.lang not working - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: HPS and extra_english.lang not working (/thread-29734.html)



HPS and extra_english.lang not working - SetsuPotato - 03-11-2015

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]


RE: HPS and extra_english.lang not working - Neelke - 03-11-2015

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)


RE: HPS and extra_english.lang not working - Traggey - 03-11-2015

Make sure to post in the support forum in the future, thread moved!


RE: HPS and extra_english.lang not working - SetsuPotato - 03-11-2015

(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?


RE: HPS and extra_english.lang not working - FlawlessHappiness - 03-12-2015

(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.
PHP Code:
void OnStart()
{
AddUseItemCallback("""key_din""door_din""UsedKeyOnDoor"true);
SetEntityPlayerInteractCallback("key_din""MonstAct1"true);
}

void UsedKeyOnDoor(string &in asItemstring in asEntity
{
SetSwingDoorLocked("door_din"falsetrue);
PlaySoundAtEntity("""unlock_door""door_din"0false);
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");




RE: HPS and extra_english.lang not working - SetsuPotato - 03-12-2015

(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.
PHP Code:
void OnStart()
{
AddUseItemCallback("""key_din""door_din""UsedKeyOnDoor"true);
SetEntityPlayerInteractCallback("key_din""MonstAct1"true);
}

void UsedKeyOnDoor(string &in asItemstring in asEntity
{
SetSwingDoorLocked("door_din"falsetrue);
PlaySoundAtEntity("""unlock_door""door_din"0false);
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.


RE: HPS and extra_english.lang not working - FlawlessHappiness - 03-12-2015

(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?


RE: HPS and extra_english.lang not working - SetsuPotato - 03-12-2015

(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.


RE: HPS and extra_english.lang not working - Straxedix - 03-13-2015

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).


RE: HPS and extra_english.lang not working - Neelke - 03-13-2015

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.

Code:
void OnStart()
{
SetEntityCallbackFunc("key_din", "MonstAct1");
}

I think you'll also need to modify this too.

Code:
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.