Frictional Games Forum (read-only)
Needle on Door [SOLVED] - 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: Needle on Door [SOLVED] (/thread-7977.html)



Needle on Door [SOLVED] - Karai16 - 05-13-2011

Hey guys, I'm once again trying to get something to work, and it just doesn't... Huh
I'm trying to get a door open with a needle, but it just says that I cannot use the needle that way
Code:
void OnStart()
{
AddUseItemCallback("", "HollowNeedle", "GamesDoor", "UsedItemOnDoor", true);
}

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

Can anybody tell me what's wrong?


RE: Needle on Door - dragonlordsd - 05-13-2011

umm... i think it's supposed to read: SetSwingDoorLocked("GamesDoor", false, true);


RE: Needle on Door - Anxt - 05-13-2011

Did you rename the hollow needle to HollowNeedle? If not, the name of the entity is likely "hollow_needle_1".

The only thing I can suggest is to double and triple check to make sure all names are what they should be. The code looks fine to me.


RE: Needle on Door - dragonlordsd - 05-13-2011

oh yeah, and in mine I usually define the removed item:
RemoveItem("HollowNeedle");

Don't know if that changes anything though. Anxt is probably right, he knows more.


RE: Needle on Door - Anxt - 05-13-2011

asEntity and asItem will work in the ways Karai used them, and since the game isn't spitting out an error, I think it is just a mis-named object somewhere.


RE: Needle on Door - dragonlordsd - 05-13-2011

yeah, I thought so, but I wasn't sure.


RE: Needle on Door - Karai16 - 05-13-2011

(05-13-2011, 07:08 PM)Anxt Wrote: asEntity and asItem will work in the ways Karai used them, and since the game isn't spitting out an error, I think it is just a mis-named object somewhere.

yeah, But I'm pretty sure I named my Hollow Needle HollowNeedle, and also but it in that ItemSub something bar...

-------
EDIT: nvm, I found the mistake... In the level editor I misspelled the name (HolowNeedle)
at Dragonlordsd, I use asEntity and asItem instead of the names because then I can reuse the function, instead of making a UsedKeyOnDoor1, "2... etc


RE: Needle on Door - Acies - 05-13-2011

The itemSub is used to name the item/add description using the .lang file and will not affect your "open door" script in any way.

The only possible issue is a false name on either the needle or the door.