Frictional Games Forum (read-only)
Noob in trouble! - 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: Noob in trouble! (/thread-14757.html)

Pages: 1 2 3 4


RE: Noob in trouble! - Macetrow - 04-14-2012

No message showed up when i tried to use the key, and i quadrouple x 100000 checked and spammed enter after typing the name and saved it.


RE: Noob in trouble! - DRedshot - 04-14-2012

Very strange...
Are any other scripts in your .hps working?
From what I can see, there is no problem with the scripting at all!

Try creating a script area around the door, tick the 'ItemInteraction' box, and change it's name to "mansion_3_area". Then change your code to the following:

Code:
void OnStart()
{
AddUseItemCallback("KeyOnArea", "key_1", "mansion_3_area", "UsedKeyOnArea", true);
SetEntityCallbackFunc("key_1", "OnPickup");
}

void UsedKeyOnArea(string &in item, string &in entity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_3", 0, false);
RemoveItem(item);
SetEntityActive(entity , false);

AddDebugMessage("Key has been used, is door unlocked?" , false);
}

It's not the ideal way to do it, but I can't see any way that this can fail.




RE: Noob in trouble! - JenniferOrange - 04-14-2012

The error is right here:
void UsedKeyOnArea(string &in item, string &in entity)
it's supposed to be (string &in asItem, string &in asEntity)
C'MON GUYS, JEEZ. Just kidding. <3



RE: Noob in trouble! - Macetrow - 04-14-2012

All my other scripts except for the "unlock door" scripting is working. I spawn a monster with my key and shit, but i can't use that key to open any door.

I tried the long shot, but that didn't work either.


RE: Noob in trouble! - DRedshot - 04-14-2012

I'm out of ideas then. Did you try using an area as the entity to use the item on instead of the door?
Or as suggested above changing entity -> asEntity and item -> asItem.

If you've done both, I can't help you, sorry.



RE: Noob in trouble! - SilentStriker - 04-14-2012

DRedshot may be right, I think the syntax is wrong. It should be string &in asEntity, string &in asItem



RE: Noob in trouble! - Macetrow - 04-14-2012

I've tried all that you just suggested, it doesn't work. I have no idea what is making my door not work (or key). Think i'm just gonna end my dream of ever producing my very own custom story :/


RE: Noob in trouble! - SilentStriker - 04-14-2012

Try this, This is the last attempt

void OnStart()
{
AddUseItemCallback("", "key_1", "mansion_3", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
}

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


RE: Noob in trouble! - Macetrow - 04-14-2012

Sorry, but it didn't work :/


RE: Noob in trouble! - SilentStriker - 04-14-2012

Could you send me the map and script file? You can send in pm if you want Smile