Frictional Games Forum (read-only)
HELP ME! My scripting seems right but doesn't work. Please Help. - 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: HELP ME! My scripting seems right but doesn't work. Please Help. (/thread-14310.html)

Pages: 1 2


HELP ME! My scripting seems right but doesn't work. Please Help. - Wapez - 03-28-2012

Hi I would like to know what's wrong with this. The door isn't locked and the key shows up without name and description. Please help.


//===========================================
// Starter's Script File!
//===========================================

//===========================================
// This runs when the map first starts
void OnStart()
{

AddUseItemCallback("", "firstdoorkey1", "firstdoor", "UsedKeyOnDoor", true);

}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)

{

SetSwingDoorLocked("firstdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "firstdoor", 0, false);
RemoveItem("firstdoorkey1");

}
//===========================================
// This runs when the player enters the map
void OnEnter()
{
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}

This is my .lang file:

<LANGUAGE>
<CATEGORY Name="TutorialStory">
<Entry Name="Description">This is a tutorial story. [br] [br]I hope you like it! Big Grin </Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemDesc_firstdoorkey>"Key to First Door"</Entry>
<Entry Name="ItemName_firstdoorkey>First Door Key</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_Introduction_Name">Welcome.</Entry>
<Entry Name="Note_Introduction_Text">You shall die...</Entry>
</CATEGORY>
</LANGUAGE>


RE: HELP ME! My scripting seems right but doesn't work. Please Help. - Greven - 03-28-2012

Have you named the entities in the entity tabs so the script can know what its supposed to lock/show?

For example the key is named in the second entity tab under the CustomSubItemTypeName. And the door in the first entity tab.



RE: HELP ME! My scripting seems right but doesn't work. Please Help. - Wapez - 03-28-2012

(03-28-2012, 04:53 PM)Greven Wrote: Have you named the entities in the entity tabs so the script can know what its supposed to lock/show?

For example the key is named in the second entity tab under the CustomSubItemTypeName. And the door in the first entity tab.
Yes, the key is named Key1 in the "CustomSubItemTypeName" in the entity tab.
My notes won't work either btw.


RE: HELP ME! My scripting seems right but doesn't work. Please Help. - SilentStriker - 03-28-2012

here's the problem..

"ItemName_firstdoorkey"
"ItemDesc_firstdoorkey"


you forgot the "





RE: HELP ME! My scripting seems right but doesn't work. Please Help. - Wapez - 03-28-2012

(03-28-2012, 05:15 PM)SilentStriker Wrote: here's the problem..

"ItemName_firstdoorkey"
"ItemDesc_firstdoorkey"


you forgot the "
Thanks alot man, but it still won't work.




RE: HELP ME! My scripting seems right but doesn't work. Please Help. - SilentStriker - 03-28-2012

Name the key firstdoorkey on both the name and the customsubitemtypename



RE: HELP ME! My scripting seems right but doesn't work. Please Help. - Wapez - 03-28-2012

(03-28-2012, 05:44 PM)SilentStriker Wrote: Name the key firstdoorkey on both the name and the customsubitemtypename
I made some changes to the scripts:


<LANGUAGE>
<CATEGORY Name="TutorialStory">
<Entry Name="Description">This is a tutorial story. [br] [br]I hope you like it! Big Grin </Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemDesc_Key1">Unlocks The Locked Door</Entry>
<Entry Name="ItemName_Key1">Key To Locked Door</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_01_Name">Welcome.</Entry>
<Entry Name="Note_01_Text">You shall die...</Entry>
</CATEGORY>
</LANGUAGE>
_________________________________________________________________________________


//===========================================
// Starter's Script File!
//===========================================

//===========================================
// This runs when the map first starts
void OnStart()
{
AddUseItemCallback("", "Key1", "Door1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in item, string &in door)
{
SetSwingDoorLocked(Door1, false, true);
PlaySoundAtEntity("", "unlock_door", Door1, 0, false);
RemoveItem(Key1);
}

//===========================================
// This runs when the player enters the map
void OnEnter()
{
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}

I have the same name in the customsubitemtypename... When i pick up the key it just says: "Picked up", the door is still unlocked, and the notes is blank. I'm thinking it might be something else, not the scripts.


RE: HELP ME! My scripting seems right but doesn't work. Please Help. - Your Computer - 03-28-2012

Item names and descriptions.

The door will forever be unlocked until you first lock it somewhere else (either through the script or level editor).


RE: HELP ME! My scripting seems right but doesn't work. Please Help. - Wapez - 03-28-2012

(03-28-2012, 06:25 PM)Your Computer Wrote: Item names and descriptions.

The door will forever be unlocked until you first lock it somewhere else (either through the script or level editor).
Yes, i locked it, and the key has a name in the game. But i can't unlock the door. Do i have to do something more with the door in level editor than just changing the name?


RE: HELP ME! My scripting seems right but doesn't work. Please Help. - Your Computer - 03-28-2012

(03-28-2012, 06:50 PM)Wapez Wrote: Yes, i locked it, and the key has a name in the game. But i can't unlock the door. Do i have to do something more with the door in level editor than just changing the name?

I have no idea what kind of door you're trying to unlock, but if you're trying to unlock level doors with swing door functions, then it's not going to work. Also, if the script you're using is the one you posted recently, then the engine should have complained that Door1 and Key1 were not properly declared. In other words, you tried to use non-existing variables in place of existing variables or values.