Frictional Games Forum (read-only)

Full Version: Needle on Door [SOLVED]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
umm... i think it's supposed to read: SetSwingDoorLocked("GamesDoor", false, true);
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.
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.
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, I thought so, but I wasn't sure.
(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
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.