Frictional Games Forum (read-only)
[CHAOS] hps scripting and .lang errors? - 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: [CHAOS] hps scripting and .lang errors? (/thread-16781.html)

Pages: 1 2


hps scripting and .lang errors? - Lizard - 07-06-2012

Hi guy

For a total of almost 20 hours, i've tried to read and test my way through my possible errors in my .lang and .hps file, but i just can't find them.

My problem in the .lang file is that it wont use the name and description i've given it on 6 of my keys
(mansionkey1, 2, 3 , 4 , 5 and 6)

In my .hps file my mansionkey4, 5 and 6 wont work, despite i done the same thing with other keys, and they work just fine.

I hope there some of you there want to help me with whats wrong.

PS. my files are in right places

_______________________________________________________________

extra_english.lang file:


<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Your villiage's precious statue has been stolen.[br][br]After some discussion between the council members, and they came to following agreement.[br]They have decided that it is you, that have to enter the mansion, and get back their precious statue.[br][br]Good Luck!</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_CorridorKey">Corridor Key</Entry>
<Entry Name="ItemDesc_CorridorKey">Opwns the door to the corridor</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_CellarKey">Cellar Key</Entry>
<Entry Name="ItemDesc_CellarKey">Opens the door to the cellars</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_CellarKey2">Mansion Key</Entry>
<Entry Name="ItemDesc_CellarKey2">Opens the door to the mansion</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_HallwayKey">Hallway Key</Entry>
<Entry Name="ItemDesc_HallwayKey">Opens the door to the hallway</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_mansionkey1">Mansion Key</Entry>
<Entry Name="ItemDesc_mansionkey1">Opens a mansion door</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_mansionkey2">Mansion Key</Entry>
<Entry Name="ItemDesc_mansionkey2">Opens a mansion door</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_mansionkey3">Mansion Key</Entry>
<Entry Name="ItemDesc_mansionkey3">Opens a mansion door</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_mansionkey4">Mansion Key</Entry>
<Entry Name="ItemDesc_mansionkey4">Opens a mansion door</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_mansionkey5">Mansion Key</Entry>
<Entry Name="ItemDesc_mansionkey5">Opens a mansion door</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_mansionkey6">Mansion Key</Entry>
<Entry Name="ItemDesc_mansionkey6">Opens a mansion door</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_note1_Name">A Little Information</Entry>
<Entry Name="Note_note1_Text">Day 1[br][br]My name is Martin, I was sent into this old and abandoned mansion to find a golden statue, which is very precious to our village.[br][br]The statue was stolen by some monsters that are said to live in this mansion[br][br]In case I should fail in my quest, I will leave notes during my search for the golden statue.[br][br]Martin</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_note2_Name">Whats Going On?</Entry>
<Entry Name="Note_note2_Text">Day 2[br][br]Im starting to wonder if there could be more to this than only monsters?[br]Those things that I've seen so far can't be the monsters work, there most be some magic behind it.[br]It seems that my journey may be a little longer than first assumed.[br][br]Martin</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_note3_Name">The pieces Fall Into Place</Entry>
<Entry Name="Note_note3_Text">Day 3[br][br]My heart is still hammering like hell, after my last encounter with the monsters.[br]Do to my hammering heart, I've used some time to read the notes I got from all the rooms I passed so far, and the pieces is starting to fall into place.[br]It seems that an evil witch has taken over this old mansion, which explains the things I've seen so far.[br]She uses the disappearing monsters and constantly theme shifting of the rooms to confuse any intruder, that enters her domain.[br]I think that I already walked to far inside the mansion, to safe my life.[br][br]Seems like, Im in for a thoug ride.[br][br]Martin</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_note4_Name">Run</Entry>
<Entry Name="Note_note4_Text">RUN!!!</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_note5_Name">Enemy confirmed</Entry>
<Entry Name="Note_note5_Text">Day 4[br][br]As I expected, all the constanly theme shifting rooms that I passed so far, was rooms made of magic, and was not a part of the original part of the mansion.[br]The hallway that just existed was the original entrance to the mansion.[br]Altough I do not think that the witch wanted or even could imagine me coming this far.[br][br]Martin</Entry>
</CATEGORY>
</LANGUAGE>

_____________________________________________________________________________________________

01_Stephano.hps file:


////////////////////////////
// Run first time entering map
void OnStart()
{
AddUseItemCallback("", "mansionkey1","mansion3_2","UsedKeyOnDoor",true);
AddUseItemCallback("", "mansionkey2", "mansion3_3", "UsedKeyOnDoor2", true);
AddUseItemCallback("", "mansionkey3", "mansion4", "UsedKeyOnDoor3", true);
AddUseItemCallback("", "mansionKey4", "mansion4_2", "UsedKeyOnDoor4", true);
AddUseItemCallback("", "mansionkey5", "mansion4_3", "UsedKeyOnDoor5", true);
AddUseItemCallback("", "mansionkey6", "mansion5", "UsedKeyOnDoor6", true);
SetEntityPlayerInteractCallback("note5", "ActivateMonster", true);
}

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

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion3_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion3_3", 0, false);
RemoveItem("mansionkey2");
}

void UsedKeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion4", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion4", 0, false);
RemoveItem("mansionkey3");
}

void UsedKeyOnDoor4(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion4_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion4_2", 0, false);
RemoveItem("mansionkey4");
}

void UsedKeyOnDoor5(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion4_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion4_3", 0, false);
RemoveItem("mansionkey5");
}

void UsedKeyOnDoor6(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion5", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion5", 0, false);
RemoveItem("mansionkey6");
}

void ActivateMonster(string &in item)
{
SetEntityActive("bro_7", true);
AddEnemyPatrolNode("bro_7", "bro_PathNodeArea_1", 0, "idle");
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}



I know it is a long thread, but i hope you can help me


RE: hps scripting and .lang errors? - drunkmonk - 07-06-2012

Your problem is you have separate Inventory and Journal categories, you don't need to do this at all, you can put all the items in one inventory category and all journal entries in one category
I will use my .lang file for example

<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Welcome to my first custom story.[br][br]Your name is John Robinson, and you recieve a letter from your father explaining that Brad, your older brother
who always picked on you when you were little, has gone missing. His last known whereabouts was when
he and other achaeologists were invited to uncover the lost history of old castle Havaria in Prussia.
</Entry>
</CATEGORY>
<CATEGORY Name="LoadingText">
<Entry Name="chase">What was that thing! It was hidious and terrifying, how does such a creature exist? What is going on in this castle?</Entry>
<Entry Name="angel">I'm not really sure what to call it, was it divine protection that saved me or was it just luck. Either way, that thing is trying to kill me anymore.</Entry>
<Entry Name="safe">I feel a sort of calm when i'm in the lab. After what happened with the cave in, it makes me feel like someone is watching over me.</Entry>

</CATEGORY>
<CATEGORY Name="Levels">
<Entry Name="Exit">Exit</Entry>
<Entry Name="Prison1">Eastwing Prison</Entry>
<Entry Name="Lab">Eastwing Lab</Entry>
<Entry Name="EastWingGuest">Eastwing Guest Quarters</Entry>
<Entry Name="UpperLevels">Upper Levels</Entry>
<Entry Name="LowerLevels">Lower Levels</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Quest_LeverQuest_Text">This door is locked by some sort of mechanism, maybe there is a lever around here somewhere.</Entry>
<Entry Name="Quest_SecretDoor_Text">The note mentioned that there was a secret door in Ian's study, maybe there is a way to open it around here somewhere</Entry>
<Entry Name="Quest_KeyQuest_Text">The door to the upper levels is locked, I must find a key somewhere to open it.</Entry>
//Notes

<Entry Name="Note_Brad1_Name">Brad's Journal Entry 17</Entry>
<Entry Name="Note_Brad1_Text">Journal Entry 17[br][br]Dr. Brad Robinson[br][br]It has been several days since my arrival and since we opened that secret door to the depths it has just been
one long nightmare. First it was Ian to go missing, then Hilda. I do not know the fate
of the other guests, I don't even know if Dad got my letter. I get the feeling that I too will
soon end up like Ian and Hilda. If that is to be my fate than there is only one thing
that I regret, I wish I could see John again and tell him how sorry I am for all the things I did to him
when we were growing up.</Entry>
<Entry Name="Note_Discoveries_Name">Discoveries</Entry>
<Entry Name="Note_Discoveries_Text">Discoveries[br][br]Dr. Ian O'Connell[br][br] We have made some fabulous discoveries since our arrival here at the castle. Just today, Alan stumbled upon a
secret lever that opened a passage way, inside we found many texts about the history of the castle, some of
the texts referred to other secret rooms through out the castle and one of them being in my study, but I have failed
to make this discovery.[br][br] Amongst the texts we uncovered, we found a very peculiar tomb, there was no name of the
deceased or a description of whom they were, what they did, or when they were born. we also found what looked to be a
ceremonial dagger upon an alter with writings of a language I have never seen before that was inked, to what appeared
to be, blood. We removed the dagger for further study and as we did, the tomb began to shake and a glow was coming from
inside the sarcophagus, Alan and I gathered what texts we could and we fled the tomb.</Entry>
<Entry Name="Note_Alan1_Name">Alan's Journal Entry 5</Entry>
<Entry Name="Note_Alan1_Text">Journal Entry 5[br][br]Dr. Alan Lewis[br][br] Yesterdays discovery was very intriguing and a little nerve racking. I have been studying the dagger we
recovered from the tomb for many hours, and I can't make heads or tails of it. The dagger is not like any
I have seen and I can't make out what it's even made of, it's as light as a feather and as hard as steel.
It's been down in that tomb for a least a hundred years, probably longer, and it looks as if it was just forged
yesterday. I gave the dagger to Hilda to study because she used to work with her father at a forgery, maybe she
can make some sense of the thing. I keep thinking about what happened in the tomb yesterday, and I can't help but
feel as if we have disturbed something that was better left forgotten.</Entry>
</CATEGORY>
<CATEGORY Name="Locked">
<Entry Name="Exit">I should read the letter on the desk before I go.</Entry>
<Entry Name="LockedLevel"> It's locked, I don't want to go back that way anyway.</Entry>
<Entry Name="LockedLevelDoor">It's locked, there must be a way to open it.</Entry>
<Entry Name="Blocked">It won't budge.</Entry>
</CATEGORY>
<CATEGORY Name="Messages">
<Entry Name="Setting"> Holstein, Prussia[br]Castle Harvaria[br] 1843</Entry>
<Entry Name="Doorbang">Nothing is getting through that door... I don't think.</Entry>
<Entry Name="CaveIn">What just happened?</Entry>
<Entry Name="Angel">Is there an angel watching over me?</Entry>
<Entry Name="Locked"> It's locked.</Entry>
<Entry Name="Unknown">I don't know what this does, I should leave it alone right now.</Entry>
<Entry Name="Wall">This wall looks pretty weak, maybe I and push some of the bricks out of the way.</Entry>

</CATEGORY>

<CATEGORY Name="Inventory">
<Entry Name="ItemName_Key_Upper_Levels">Upper levels key</Entry>
<Entry Name="ItemDesc_Key_Upper_Levels">This is the key to the upper levels.</Entry>
</CATEGORY>
</LANGUAGE>

If you have more than one inventory or journal category, the game will have difficulties trying to locate which category to look under. I hope this helped Big Grin


RE: hps scripting and .lang errors? - Lizard - 07-06-2012

thanks for the tip, but i did not help.

Just tryed it, and it is still the same Sad


RE: hps scripting and .lang errors? - drunkmonk - 07-06-2012

What kind of problem with the keys are you having? Do you mean that they won't unlock a door or the description isn't showing up?


RE: hps scripting and .lang errors? - Lizard - 07-06-2012

with all the keys its the name and description that dosen't work, and with key 4 to 6 it's both the name and description and the scripting that dosen't work


RE: hps scripting and .lang errors? - drunkmonk - 07-06-2012

Ok for unlocking the doors try changing all the "true" for the SetSwingDoorLocked to false and for the name and description of the keys, did you put the name of the key that matchs in the .lang file in the CustomSubItemTypeName box under the entity tab of the key in the level editor?


RE: hps scripting and .lang errors? - Adny - 07-06-2012

One thing I'd like to offer advice on that I noticed is that you have 6 callbacks (all of which are exactly the same ) for unlocking doors when you only need one.

The callback syntax for the function is "(string &in asItem, string &in asEntity)"; asItem and asEntity represent whatever corresponding items you used to make the callback (the door and the key in this case); so instead of writing six separate functions, you can write one function using asItem and asEntity instead of the exact name of the key/door. This can greatly reduce scripting clutter:


void OnStart()
{
AddUseItemCallback("", "mansionkey1","mansion3_2","UsedKeyOnDoor",true);
AddUseItemCallback("", "mansionkey2", "mansion3_3", "UsedKeyOnDoor", true);
AddUseItemCallback("", "mansionkey3", "mansion4", "UsedKeyOnDoor", true);
AddUseItemCallback("", "mansionKey4", "mansion4_2", "UsedKeyOnDoor", true);
AddUseItemCallback("", "mansionkey5", "mansion4_3", "UsedKeyOnDoor", true);
AddUseItemCallback("", "mansionkey6", "mansion5", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("note5", "ActivateMonster", true);
}

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



As for the lang, you're not supposed to hit enter to create separate lines for entries (your journal for example), you can only use the break "[br]" to do that. I used the xml language in my notepade c++ and it was apparent that using enter caused it to read one entry as several. This fix should work:





Welcome to my first custom story.[br][br]Your name is John Robinson, and you recieve a letter from your father explaining that Brad, your older brother who always picked on you when you were little, has gone missing. His last known whereabouts was when he and other achaeologists were invited to uncover the lost history of old castle Havaria in Prussia.



What was that thing! It was hidious and terrifying, how does such a creature exist? What is going on in this castle?
I'm not really sure what to call it, was it divine protection that saved me or was it just luck. Either way, that thing is trying to kill me anymore.
I feel a sort of calm when i'm in the lab. After what happened with the cave in, it makes me feel like someone is watching over me.



Exit
Eastwing Prison
Eastwing Lab
Eastwing Guest Quarters
Upper Levels
Lower Levels



This door is locked by some sort of mechanism, maybe there is a lever around here somewhere.
The note mentioned that there was a secret door in Ian's study, maybe there is a way to open it around here somewhere
The door to the upper levels is locked, I must find a key somewhere to open it.


Brad's Journal Entry 17
Journal Entry 17[br][br]Dr. Brad Robinson[br][br]It has been several days since my arrival and since we opened that secret door to the depths it has just been one long nightmare. First it was Ian to go missing, then Hilda. I do not know the fate of the other guests, I don't even know if Dad got my letter. I get the feeling that I too will soon end up like Ian and Hilda. If that is to be my fate than there is only one thing that I regret, I wish I could see John again and tell him how sorry I am for all the things I did to him when we were growing up.

Discoveries
Discoveries[br][br]Dr. Ian O'Connell[br][br] We have made some fabulous discoveries since our arrival here at the castle. Just today, Alan stumbled upon a secret lever that opened a passage way, inside we found many texts about the history of the castle, some of the texts referred to other secret rooms through out the castle and one of them being in my study, but I have failed to make this discovery.[br][br]Amongst the texts we uncovered, we found a very peculiar tomb, there was no name of the deceased or a description of whom they were, what they did, or when they were born. we also found what looked to be a ceremonial dagger upon an alter with writings of a language I have never seen before that was inked, to what appeared to be, blood. We removed the dagger for further study and as we did, the tomb began to shake and a glow was coming from inside the sarcophagus, Alan and I gathered what texts we could and we fled the tomb.

Alan's Journal Entry 5
Journal Entry 5[br][br]Dr. Alan Lewis[br][br] Yesterdays discovery was very intriguing and a little nerve racking. I have been studying the dagger we recovered from the tomb for many hours, and I can't make heads or tails of it. The dagger is not like any I have seen and I can't make out what it's even made of, it's as light as a feather and as hard as steel. It's been down in that tomb for a least a hundred years, probably longer, and it looks as if it was just forged yesterday. I gave the dagger to Hilda to study because she used to work with her father at a forgery, maybe she can make some sense of the thing. I keep thinking about what happened in the tomb yesterday, and I can't help but feel as if we have disturbed something that was better left forgotten.



I should read the letter on the desk before I go.
It's locked, I don't want to go back that way anyway.
It's locked, there must be a way to open it.
It won't budge.



Holstein, Prussia[br]Castle Harvaria[br] 1843
Nothing is getting through that door... I don't think.
What just happened?
Is there an angel watching over me?
It's locked.
I don't know what this does, I should leave it alone right now.
This wall looks pretty weak, maybe I and push some of the bricks out of the way.



Upper levels key
This is the key to the upper levels.





Hope that helped! (drunkmonk, Y U STEAL MY LINE? xD)


RE: hps scripting and .lang errors? - Lizard - 07-06-2012

(07-06-2012, 05:20 PM)drunkmonk Wrote: Ok for unlocking the doors try changing all the "true" for the SetSwingDoorLocked to false and for the name and description of the keys, did you put the name of the key that matchs in the .lang file in the CustomSubItemTypeName box under the entity tab of the key in the level editor?
___________________________________________________________________________________________


I can try to set the true to false, but in my other cs it says true aswell and it works fine.

DOH what a typical mistake, i totaly forgot to enter the name in CustomSubItemTypeName *facepalm*


RE: hps scripting and .lang errors? - drunkmonk - 07-06-2012

(07-06-2012, 05:22 PM)andyrockin123 Wrote: Hope that helped! (drunkmonk, Y U STEAL MY LINE? xD)
LOL Tongue and for the .lang do you mean just put the entries all on one line and have the [br] where you want the new line?


RE: hps scripting and .lang errors? - Adny - 07-06-2012

(07-06-2012, 05:32 PM)drunkmonk Wrote: LOL Tongue and for the .lang do you mean just put the entries all on one line and have the [br] where you want the new line?
To my knowledge, you should never hit "enter" in the middle of a .lang entry; even for long journal entries, you can use [br] multiple times to get the same effect. I even checked the original game's .lang file; each journal entry is 1 enormous line. So long as you make sure "word wrap" is on, you can easily see all of it at once.