Frictional Games Forum (read-only)
Scripting Problem - 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: Scripting Problem (/thread-21561.html)

Pages: 1 2


RE: Scripting Problem - PutraenusAlivius - 05-21-2013

(05-20-2013, 10:01 PM)Bridge Wrote: Did you see what Tomato Cat said? You're calling a function that doesn't exist.

Code:
AddUseItemCallback("", "Key2", "Door2", "UsedKeyOnDoor", true);

Should be:

Code:
AddUseItemCallback("", "Key2", "Door2", "UsedKeyonDoor", true);

No, it shouldn't. Another function already exists!
Here's how it should be.
Code:
void OnStart()
{
AddUseItemCallback("", "Key", "Mansion_door", "UsedKeyonDoor", true);
AddUseItemCallback("", "Key2", "Door2", "UsedKeyOnDoor", true);
}

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

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



RE: Scripting Problem - Bonehead - 05-21-2013

Also are you saying that the door is NOT locked? Make sure the "Locked" Box is checked in the level editor when you select the door under the entity tab.


RE: Scripting Problem - amnesiaplayer321 - 05-21-2013

Thanks to all of you it got fixed after JustAnotherPlayer's script.


RE: Scripting Problem - Tomato Cat - 05-21-2013

What was ultimately the problem?

Also, I don't recommend giving your functions names that are difficult to distinguish from one another.

Use something like "UsedKeyOnDoor" & "UsedKeyOnDoor2" rather than "UsedKeyOnDoor" and "UsedKeyonDoor".


RE: Scripting Problem - Your Computer - 05-21-2013

(05-21-2013, 05:55 AM)Tomato Cat Wrote: Use something like "UsedKeyOnDoor" & "UsedKeyOnDoor2" rather than "UsedKeyOnDoor" and "UsedKeyonDoor".

Or he should learn about parameters and have only one function handle every key-door combination.


RE: Scripting Problem - amnesiaplayer321 - 05-21-2013

Thanks all about you,now i know about parameters and how to get doors locked.I am creating one now.


RE: Scripting Problem - Tomato Cat - 05-21-2013

(05-21-2013, 11:48 AM)Your Computer Wrote: Or he should learn about parameters and have only one function handle every key-door combination.

True, but that might be a bit confusing for a beginner.