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
Key Name and Description not working
Zaik Offline
Junior Member

Posts: 2
Threads: 1
Joined: Mar 2012
Reputation: 0
#1
Key Name and Description not working

After struggling a bit with this, and watching several tutorials on how the .lang file should be formatted I have decided it is time for some fresh eyes on this problem.

For reference, my .lang file contains exactly the following:

<LANGUAGE>
    <CATEGORY Name="CustomStoryMain">
              <Entry Name="Description">Just a brief description!</Entry>
    </CATEGORY>
    <CATEGORY Name="Inventory">
            <Entry Name="ItemName_key1">Master Key</Entry>
            <Entry Name="ItemDesc_key1">A key that will open all the doors in the mansion</Entry>
    </CATEGORY>
</LANGUAGE>

For now, the story description is just there for me to make sure the .lang file loads correctly, and it seems to do so as the text "Just a brief description!" does indeed appear on the custom story screen when selecting my story, as opposed to the "No description" that would appear could the .lang not load at all.

This leads me to believe that there is a problem with the identifier of the key (as the script that should allow it to open doors does not work either), however I have checked several times (and copy-pasted, to make sure there are no lowercase/uppercase shenangians) and the names do match.

In case it is relevant, here are the parts of the map code that the key is contained within that associates with the opening of doors:

void OnStart ()
{

    /////<SNIP>

    AddUseItemCallback("", "key1", "lockeddoor1", "func_unlockdoor", false);
    AddUseItemCallback("", "key1", "lockeddoor2", "func_unlockdoor", false);

    /////<SNIP>

}

/////<SNIP>

void func_unlockdoor (string &in item, string &in door)
{
    SetSwingDoorLocked(door, false, true);
    PlaySoundAtEntity("", "unlock_door", door, 0, false);
}

/////<SNIP>


Note that both the CustomSubItemTypeName identifier and the Name identifier are set to "key1", and the doors are called "lockeddoor1" and "lockeddoor2".


Side-note: I have also had occasions where the .lang file would not load. But copying it's contents, creating a new .lang file, and pasting the contents inside would make it load.
(This post was last modified: 03-09-2012, 01:44 PM by Zaik.)
03-09-2012, 01:24 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#2
RE: Key Name and Description not working

Try this lang file If this lang doenst work,check are the customsubitemtype the same as in here key1 Its in the level editor when you click the key and go to entity tab.
<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Just a brief description!</Entry>

</CATEGORY>

<CATEGORY Name="Inventory">
<Entry Name="ItemName_key1_Name">Master Key</Entry>
<Entry Name="ItemDesc_key1_Text">A key that will open all the doors in the mansion</Entry>

</CATEGORY>

< /LANGUAGE>

And for the hps
void OnStart ()
{

/////<SNIP>

AddUseItemCallback("", "key1", "lockeddoor1", "func_unlockdoor", false);
AddUseItemCallback("", "key1", "lockeddoor2", "func_unlockdoor", false);

/////<SNIP>

}

/////<SNIP>

void func_unlockdoor (string &in item, string &in door)
{
SetSwingDoorLocked("door", false, true);
PlaySoundAtEntity("", "unlock_door", "door", 0, false);
}

/////<SNIP>

(This post was last modified: 03-09-2012, 01:35 PM by Datguy5.)
03-09-2012, 01:32 PM
Find
Zaik Offline
Junior Member

Posts: 2
Threads: 1
Joined: Mar 2012
Reputation: 0
#3
RE: Key Name and Description not working

(03-09-2012, 01:32 PM)Datguy5 Wrote: Try this lang file If this lang doenst work,check are the customsubitemtype the same as in here key1 Its in the level editor when you click the key and go to entity tab.
.lang file would not load, after fixing the broken </LANGUAGE> bracket it loads but still does not work.

While writing this I think I may have located the error, it seems I have been working on the version of the map located in redist/maps rather than the one in custom_stories/storyroot/maps

It is always the sillies errors.

EDIT: After relocating the map save and reverting the .lang changes you suggested the key description now works.
Thanks for the assistance, but it appears the problem was between the keyboard and chair rather than in the code.

EDIT2: Also had to revert the change you made to the script code, door refers to the variable door that is defined when calling unlockdoor as the door that we use the key on, it is not actually the name of a particular door in the level.

(This post was last modified: 03-09-2012, 01:48 PM by Zaik.)
03-09-2012, 01:41 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#4
RE: Key Name and Description not working

Ok im just glad you fixed the problem : )

03-09-2012, 01:55 PM
Find




Users browsing this thread: 1 Guest(s)