Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error when I try to add a memento
Coolfromdah00d Offline
Junior Member

Posts: 38
Threads: 5
Joined: Mar 2013
Reputation: 0
#1
Error when I try to add a memento

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
02-10-2014, 01:23 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Error when I try to add a memento

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:

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

(This post was last modified: 02-10-2014, 02:54 PM by Mudbill.)
02-10-2014, 02:52 PM
Find
Coolfromdah00d Offline
Junior Member

Posts: 38
Threads: 5
Joined: Mar 2013
Reputation: 0
#3
RE: Error when I try to add a memento

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

<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
(This post was last modified: 02-10-2014, 03:46 PM by Coolfromdah00d.)
02-10-2014, 03:39 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: Error when I try to add a memento

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 ^^

02-10-2014, 04:05 PM
Find
Coolfromdah00d Offline
Junior Member

Posts: 38
Threads: 5
Joined: Mar 2013
Reputation: 0
#5
RE: Error when I try to add a memento

(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?
(This post was last modified: 02-10-2014, 04:33 PM by Coolfromdah00d.)
02-10-2014, 04:14 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#6
RE: Error when I try to add a memento

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.

02-10-2014, 04:47 PM
Find
Coolfromdah00d Offline
Junior Member

Posts: 38
Threads: 5
Joined: Mar 2013
Reputation: 0
#7
RE: Error when I try to add a memento

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
(This post was last modified: 02-10-2014, 07:41 PM by Coolfromdah00d.)
02-10-2014, 07:14 PM
Find
PancakeSyndr0m3 Offline
Junior Member

Posts: 4
Threads: 0
Joined: Jun 2014
Reputation: 0
#8
RE: Error when I try to add a memento

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
08-27-2014, 09:02 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#9
RE: Error when I try to add a memento

(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");

Trying is the first step to success.
(This post was last modified: 08-27-2014, 09:49 PM by FlawlessHappiness.)
08-27-2014, 09:46 PM
Find




Users browsing this thread: 1 Guest(s)