Frictional Games Forum (read-only)
Why does my SetSwingDoorLocked no effect? - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Why does my SetSwingDoorLocked no effect? (/thread-6944.html)



Why does my SetSwingDoorLocked no effect? - Raymond - 03-19-2011

I try to use the key on it but it says " Cannot use this item away". My code is like this:
Code:
void Onstart()
{
AddUseItemCallback("", "prisonkeylight_1", "mansion_3", "UsedKeyOnDoor", true);
}

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

It doesn't have any errors it just doesn't seem to work. Did i put something wrong Huh.


RE: Why does my SetSwingDoorLocked no effect? - Danny Boy - 03-19-2011

think the name of it must be in the first "" but i'm noob on scripting so i don't realy know =/ but check out this http://wiki.frictionalgames.com/hpl2/tutorials/start this might help.


RE: Why does my SetSwingDoorLocked no effect? - Raymond - 03-19-2011

I followed "the Make a key unlock a specific door" but still not working.


RE: Why does my SetSwingDoorLocked no effect? - Danny Boy - 03-19-2011

oh! i think i found it!
in the
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
you missed ; at the end!

void UsedKeyOnDoor(string &in asItem, string &in asEntity);
this is the correct one... i hope it helps


RE: Why does my SetSwingDoorLocked no effect? - Linus Ă…gren - 03-19-2011

(03-19-2011, 02:42 PM)Danarogon Wrote: oh! i think i found it!
in the
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
you missed ; at the end!

void UsedKeyOnDoor(string &in asItem, string &in asEntity);
this is the correct one... i hope it helps

Callbacks aren't supposed to have ;'s at the end.
Is the door named "mansion_3" and the key prisonkeylight_1?


RE: Why does my SetSwingDoorLocked no effect? - Raymond - 03-19-2011

(03-19-2011, 02:42 PM)Danarogon Wrote: oh! i think i found it!
in the
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
you missed ; at the end!

void UsedKeyOnDoor(string &in asItem, string &in asEntity);
this is the correct one... i hope it helps

The video didn't tell me to put the ";". Besides, when i put the ";" it gives me an error said "Unexpected {".


RE: Why does my SetSwingDoorLocked no effect? - Danny Boy - 03-19-2011

oh... right sorry i haven't noticed i didn't had it either in my own code... well so the best thing i can tell you is that try to save the map before you test it... sometimes stupid stuff like thus happens because i fergot to save the map. or you cold try to make code from scratch again and if it does not work i hope someone whit more knolage about scripting than me helps you out.


RE: Why does my SetSwingDoorLocked no effect? - Pandemoneus - 03-19-2011

You wrote Onstart().
It has to be OnStart().
Noticed the difference?


RE: Why does my SetSwingDoorLocked no effect? - Nye - 03-19-2011

(03-19-2011, 04:17 PM)Pandemoneus Wrote: You wrote Onstart().
It has to be OnStart().
Noticed the difference?

In case you don't notice the difference, it needs to be capitalised 100% accurately. Scripting is very case sensitive, so be careful in future! Sleepy


RE: Why does my SetSwingDoorLocked no effect? - Raymond - 03-20-2011

(03-19-2011, 07:54 PM)Nye Wrote:
(03-19-2011, 04:17 PM)Pandemoneus Wrote: You wrote Onstart().
It has to be OnStart().
Noticed the difference?

In case you don't notice the difference, it needs to be capitalised 100% accurately. Scripting is very case sensitive, so be careful in future! Sleepy

I see the difference. Onstart = OnStart, i forgotten the capital S.
Thanks.