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
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: AddUseItemCallback not working

onStart != OnStart

Tutorials: From Noob to Pro
03-12-2012, 02:50 AM
Website Find
DaAinGame Offline
Member

Posts: 90
Threads: 11
Joined: Mar 2012
Reputation: 4
#3
RE: AddUseItemCallback not working

(03-12-2012, 02:50 AM)Your Computer Wrote: onStart != OnStart

Oh wow.... Now i feel really silly lol.

Thank You. I would've never noticed that.

Realm Of Another Chapter 1: http://www.frictionalgames.com/forum/thread-14142.html
Realm Of Another Chapter 2: Postponed
Adder Halls: 5%
03-12-2012, 02:54 AM
Find




Users browsing this thread: 1 Guest(s)