Frictional Games Forum (read-only)
Error when I try to add a memento - 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: Error when I try to add a memento (/thread-24586.html)



Error when I try to add a memento - Coolfromdah00d - 02-10-2014

I'm trying to make a memento happen when I enter an area, but when I start the level, the description is not showed, none of the notes work and it gives me the error message (it gives me this message after I added the CallbackFunc on AreaMemento). I am not new to coding but I just can't seem to find the error...

Here's my english_lang file

<LANGUAGE>


<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Texthere</Entry>

</CATEGORY>

</CATEGORY Name="Journal">
<Entry Name="Quest_pickuplantern_Text"> This could be useful...</Entry>
<Entry Name="Quest_enterarea_Text"> Where am I...? </Entry>

</CATEGORY>

<CATEGORY Name="Journal">
<Entry Name="Note_note01_Name">texthere</Entry>
<Entry Name="Note_note01_Text">texthere </Entry>

</CATEGORY>

<CATEGORY Name="Journal">
<Entry Name="Note_note02_Name">texthere</Entry>
<Entry Name="Note_note02_Text">texthere.</Entry>

</CATEGORY>

<CATEGORY Name="Inventory">
<Entry Name="ItemName_GuestRoomKey">texthere</Entry>
<Entry Name="ItemDesc_GuestRoomKey">texthere</Entry>
</CATEGORY>

</LANGUAGE>
(I shortended down my notes as they are very long)

Here is my HPS file
void OnStart()
{
AddUseItemCallback("Player", AreaMemento, "EventQuest", true, 1);

SetEntityCallbackFunc("GuestRoomKey", "jump");
AddUseItemCallback("", "GuestRoomKey", "door01", "UsedKeyOnDoor", false);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem(asItem);
}

void jump(string &in asEntity, string &in type)
{
SetEntityActive("corpse01", true);
PlaySoundAtEntity("", "21_screams.snt", "corpse01", 0, true);
StartScreenShake(0.5f, 1, 0, 0.25);
GiveSanityDamage(5.0f, true);
}

void PickUpLantern(string &in asEntity, string &in type)
{
AddQuest("lantern", "pickuplantern");
}

void EventQuest(string& in asParent, string& in asChild, int alState)
{
AddQuest("area", "enterarea");
}

I haven't forgotten to name my area "AreaMemento" and neither did I forget to name the lantern "PickUpLantern" in the callbackFunc

Sorry for my bad english. English is not my mother tounge.

Thank you


RE: Error when I try to add a memento - Mudbill - 02-10-2014

You can only have 1 category of the same name in your lang file, or else it will crash like this and cause no text to appear at all.

What you must do is merge your "Journal" categories. Place all the entries under the same one, like this:

Code:
<CATEGORY Name="Journal">
<Entry Name="Quest_pickuplantern_Text"> This could be useful...</Entry>
<Entry Name="Quest_enterarea_Text"> Where am I...? </Entry>

<Entry Name="Note_note01_Name">texthere</Entry>
<Entry Name="Note_note01_Text">texthere </Entry>

<Entry Name="Note_note02_Name">texthere</Entry>
<Entry Name="Note_note02_Text">texthere.</Entry>

<Entry Name="ItemName_GuestRoomKey">texthere</Entry>
<Entry Name="ItemDesc_GuestRoomKey">texthere</Entry>
</CATEGORY>



RE: Error when I try to add a memento - Coolfromdah00d - 02-10-2014

(02-10-2014, 02:52 PM)Mudbill Wrote: You can only have 1 category of the same name in your lang file, or else it will crash like this and cause no text to appear at all.

What you must do is merge your "Journal" categories. Place all the entries under the same one, like this:

Code:
<CATEGORY Name="Journal">
<Entry Name="Quest_pickuplantern_Text"> This could be useful...</Entry>
<Entry Name="Quest_enterarea_Text"> Where am I...? </Entry>

<Entry Name="Note_note01_Name">texthere</Entry>
<Entry Name="Note_note01_Text">texthere </Entry>

<Entry Name="Note_note02_Name">texthere</Entry>
<Entry Name="Note_note02_Text">texthere.</Entry>

<Entry Name="ItemName_GuestRoomKey">texthere</Entry>
<Entry Name="ItemDesc_GuestRoomKey">texthere</Entry>
</CATEGORY>

Ya know, I'm a big fan of your youtube channel Big Grin Helped me understand this sort of codes (been working with java coding). Never expected you to help me like this Tongue You're awesome

Thank you, it worked, however now I get an error message that says "AreaMemento is not declared", I followed your video precise and I can't seem to find the error anywehre


RE: Error when I try to add a memento - Mudbill - 02-10-2014

If that is part of the script, perhaps you didn't name the area correctly?

If you've been working with Java, learning this should be quite fast. I had some Java experience myself and it only took a few months to learn how to properly do things.
And thanks btw, I'm glad to know I'm helping people out ^^


RE: Error when I try to add a memento - Coolfromdah00d - 02-10-2014

(02-10-2014, 04:05 PM)Mudbill Wrote: If that is part of the script, perhaps you didn't name the area correctly?

If you've been working with Java, learning this should be quite fast. I had some Java experience myself and it only took a few months to learn how to properly do things.
And thanks btw, I'm glad to know I'm helping people out ^^

I tried renaming it but the same thing happens... hmmm

Never mind that, I forgot to put the "" marks, noticed when rewatching your tutorial

Now I get an error saying "No matching signatures to AddUseItemCallback(String&@, string&@, string&@, const bool, const uint.

Any idea what this is?


RE: Error when I try to add a memento - Mudbill - 02-10-2014

You did something wrong on that line. By the looks of it, you made a parameter not match with the engine script. How's that line? I think you mixed up the last two. The bool is supposed to be last.


RE: Error when I try to add a memento - Coolfromdah00d - 02-10-2014

Hmm..I will look over this, oh and by the way. Do you think you could make a video on how to set upexplosions in amnesia? if there's a group of rocks blocking the way and you want to blow them away, how do I do? would be awesome Big Grin

(02-10-2014, 04:47 PM)Mudbill Wrote: You did something wrong on that line. By the looks of it, you made a parameter not match with the engine script. How's that line? I think you mixed up the last two. The bool is supposed to be last.

Fixed the error, I wrote UseItemCallbac instead of EntityCollideCallback


RE: Error when I try to add a memento - PancakeSyndr0m3 - 08-27-2014

I'm sorry I'm a total n00b with hpl2 but please can someone help me:
1: How do you script an enemy spawn after you collect a certain item AND
2: How do I add a memento


RE: Error when I try to add a memento - FlawlessHappiness - 08-27-2014

(08-27-2014, 09:02 PM)PancakeSyndr0m3 Wrote: I'm sorry I'm a total n00b with hpl2 but please can someone help me:
1: How do you script an enemy spawn after you collect a certain item AND
2: How do I add a memento

Hello! You should create a new thread instead of necroing an old one.

In your "void OnStart()" have it like this:

void OnStart()
{
SetEntityPlayerInteractCallback("ITEMNAME", "SpawnMonster_1", true);
}

and outside of the "void OnStart()" have it like this:

void SpawnMonster_1(string &in asEntity)
{
SetEntityActive("MONSTERNAME", true);
}



Mementos are called "Quests" in Amnesia.

AddQuest("MEMENTONAME", "MEMENTONAME");

And in your .lang file you have it like this:

<Entry Name="Quest_MEMENTONAME_Text"> TEXT GOES HERE</Entry>


To complete a quest, use:

CompleteQuest("MEMENTONAME", "MEMENTONAME");