Frictional Games Forum (read-only)
Can anyone help me find the Script Error? - 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: Can anyone help me find the Script Error? (/thread-18303.html)



Can anyone help me find the Script Error? - danimora2012 - 09-13-2012

Thank You For Reading this thread... Smile
My problem is that i can not find the error in this script... Tongue
I have a key named Key_Tomb_1 and a door named Doortodeath_1
When i use the key nothing happens...I wanted it to open the unlock the door... It is a level door by the way...NOT a swing door...Can you help me please Rolleyes ?
So here is my script----



////////////////////////////
//Run First Time Starting map
void OnStart()
{
AddUseItemCallback("", "key_Tomb_1", "Doortodeath_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Doortodeath_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Doortodeath_1", 0.0f, false);
RemoveItem("Key_Tomb_1");
AddDebugMessage("KeyOnDoor", false);
}

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

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

The one who solves it gets the place on the credits...
Hope you can help me...You will probably be on youtube...PS-Pewdiepie
Please help ---Il leave the custom story attached to this post if you want to try it and see it for your self---

The key is on the top of the "stove front"


RE: Can anyone help me find the Script Error? - Adny - 09-13-2012

SetLevelDoorLocked doesn't have the same amount of arguments as a swing door, there is 1 less Boolean value. Also, the name of the key in the callback/function didn't match (capitalization issue.) Here's a revision:


void OnStart()
{
AddUseItemCallback("", "key_Tomb_1", "Doortodeath_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Doortodeath_1", false);
PlaySoundAtEntity("", "unlock_door", "Doortodeath_1", 0.0f, false);
RemoveItem("key_Tomb_1");
AddDebugMessage("Key On Door", false);
}

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

}

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

}


Also, I wouldn't like to be in the credits if it means there's a chance my name will be associated with Pewdiepie. Thanks for understanding.

Hope that helped!


RE: Can anyone help me find the Script Error? - danimora2012 - 09-13-2012

(09-13-2012, 04:57 AM)andyrockin123 Wrote: That helped me bye removing the error i had when loading the custom story...Now i can load it and play it but the door still doesn't get unlocked... And i understand that you don't want to be in the credits...Helped me a LOT but can you fix it? i can't unlock the door with the key Blush



RE: Can anyone help me find the Script Error? - Adny - 09-13-2012

Because of the previous issue with the names, I'm assuming that is the main cause at this point. Make sure you key is named "key_Tomb_1" and your door is named "Doortodeath_1". If that doesn't work, then take a quick look at this checklist:

-Make sure your .hps is an actual C++ script file, and that you didn't just rename the extension on a .txt file (if you're using notepad++ or geany, you can just use "Save as...").
-Make sure your .hps file is in the same folder as your .map file.
-Make sure your .hps and .map files have exactly the same name.

If none of that provides a solution to your problem, I'm afraid I don't know what it could be D:


RE: Can anyone help me find the Script Error? - danimora2012 - 09-13-2012

(09-13-2012, 05:11 AM)andyrockin123 Wrote: Because of the previous issue with the names, I'm assuming that is the main cause at this point. Make sure you key is named "key_Tomb_1" and your door is named "Doortodeath_1". If that doesn't work, then take a quick look at this checklist:

-Make sure your .hps is an actual C++ script file, and that you didn't just rename the extension on a .txt file (if you're using notepad++ or geany, you can just use "Save as...").
-Make sure your .hps file is in the same folder as your .map file.
-Make sure your .hps and .map files have exactly the same name.

If none of that provides a solution to your problem, I'm afraid I don't know what it could be D:
IT WORKED!! THANK YOU!!!!
The problem was with the Capital Letters!! i had the key named to key_tomb_1 and it should be key_Tomb_1 because on the scrip it was with capital letters!.... Big Grin Thank you very much... How can i repay you? Tongue


RE: Can anyone help me find the Script Error? - Adny - 09-13-2012

(09-13-2012, 05:15 AM)danimora2012 Wrote: Thank you very much... How can i repay you? Tongue
I'll gladly accept a cookie; most varieties will do (except raisin, nobody likes raisin). I prefer traditional sugar. Delicious.


RE: Can anyone help me find the Script Error? - danimora2012 - 09-13-2012

(09-13-2012, 05:20 AM)andyrockin123 Wrote:
(09-13-2012, 05:15 AM)danimora2012 Wrote: Thank you very much... How can i repay you? Tongue
I'll gladly accept a cookie; most varieties will do (except raisin, nobody likes raisin). I prefer traditional sugar. Delicious.
Il send you a virtual cookie then!