The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AddUseItemCallback not working
DaAinGame Offline
Member

Posts: 90
Threads: 11
Joined: Mar 2012
Reputation: 4
#1
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!

Realm Of Another Chapter 1: http://www.frictionalgames.com/forum/thread-14142.html
Realm Of Another Chapter 2: Postponed
Adder Halls: 5%
(This post was last modified: 03-12-2012, 02:54 AM by DaAinGame.)
03-12-2012, 02:28 AM
Find


Messages In This Thread
AddUseItemCallback not working - by DaAinGame - 03-12-2012, 02:28 AM
RE: AddUseItemCallback not working - by DaAinGame - 03-12-2012, 02:54 AM



Users browsing this thread: 1 Guest(s)