AddUseItemCallback not working
Okay I am truly baffled here. I have had NO issues from day 1 with this line of script until today. Thinking that it was naming errors in the level editor I have checked, renamed everything, and yada yada about 4-5 times now. So honestly, I don't know if its a naming error or a script error. Here's the script:
void onStart()
{
AddUseItemCallback("", "key_1", "mansion_6", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key_2", "mansion_4", "UsedKeyOnDoor1", true);
AddUseItemCallback("", "key_3", "mansion_2", "UsedKeyOnDoor2", true);
AddUseItemCallback("", "key_4", "level_4", "UsedKeyOnDoor3", true);
AddUseItemCallback("", "needle1", "mansion_4", "UsedKeyOnDoor4", true);
}
void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", true, false);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_2", 0, false);
RemoveItem("key_3");
GiveSanityBoostSmall();
}
void UsedKeyOnDoor3(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("level_4", false);
PlaySoundAtEntity("", "unlock_door.snt", "level_4", 0, false);
RemoveItem("key_4");
GiveSanityBoost();
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_6", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_6", 0, false);
RemoveItem("key_1");
GiveSanityBoostSmall();
}
void UsedKeyOnDoor4(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_4", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_4", 0, false);
GiveSanityBoostSmall();
SetPlayerActive(false);
AddTimer("", 0.5, "Collapse");
}
void Collapse(string &in asTimer)
{
PlaySoundAtEntity("", "break_stairs", "corpse_male_1", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
GiveSanityDamage(5, true);
AddTimer("", 4, "RestorePlayer");
}
void RestorePlayer(string &in asTimer)
{
SetPlayerActive(true);
}
void UsedKeyOnDoor1(string &in asItem, string &in asEntity)
{
RemoveItem("key_2");
AddEffectVoice("","","Voice","KeyBroke", false, "", 0, 0);
PlaySoundAtEntity("", "break_wood_metal1", "mansion_4", 0, false);
}
void OnEnter()
{
}
void OnLeave()
{
}
When I load the map I get no script errors at all, which again, confuses me; is it the script or my level editor. Like I said, I have checked the names on the level editor compared to my script SO many times, and both are the same. Just get the message "Cannot use this item this way" every time I use the key on the door. If you need anything clarified just ask!
(This post was last modified: 03-12-2012, 02:54 AM by DaAinGame.)
|