(12-23-2010, 05:05 PM)Dark88 Wrote: I just recently started scripting but I'm pretty sure you could name the 5 wrong keys Wrong_1, Wrong_2, etc and in the AddUseItemCallback for the entity put "Wrong_*" As for discarding the keys just don't remove item until the correct key is used then in that function run RemoveItem("Wrong_*); and RemoveItem("Right").
That should work in giving you just one general function for the wrong keys instead of 5.
Sadly this did not work, the "Wrong_*" did not recognize any of the keys when they were wrong. For discarding I want it to remove the keys as you use them, since this is a beginning puzzle I don't want the user to have to sift through tons of keys just yet.
Current Code section:
////////////////////////////
// wrongkey function
void WrongOne(string &in asItem, string &in asEntity)
{
if(asItem!="LanternKey"){
PlaySoundAtEntity("", "lock_door.snt", "LanternDoor", 0.0f, false);
RemoveItem("Wrong_*");
}
}
////////////////////////////
// Run when entering map
void OnEnter()
{
// This addsfor right key
AddUseItemCallback("", "LanternKey", "LanternDoor", "LanternComp", true);
//This adds for wrong key(s)
AddUseItemCallback("", "Wrong_*", "LanternDoor", "WrongOne", false);
}