The following part should be applied to the mapscript which contains the key:
void OnStart
{
SetEntityPlayerInteractCallback("The_Key_name", PickUpCatleena, true);
}
void PickUpCatleena
(string &in asEntity)
{SetGlobalVarInt("HasKeyCatleena", 1);
}
[/code]
----------------------------------------------------------------------
Your original script with key:
void OnEnter()
{
PlayMusic("25_amb.ogg", true, 1.0f, 10.0f, 1, true);
AddEntityCollideCallback("Player", "keycheck", "keytrigger", false, 1);
}
void keytrigger(string &in asParent, string &in asChild, int alState)
{
if (GetGlobalVarInt("HasKeyCatleena") == 1){
SetEntityActive("tablechair_*", true);
SetEntityActive("chairattable_*", false);
}else//If player doesn't have key - do stuff below
}
Information on variables:
- Local variables only apply to the specific map - so if the key is in the same map as checked for this will be okay
- Global variables apply to every map in your story
- The default value of any variable is always 0
- Int is integer values: 0, 1, 2, 3 and so forth
- Float is values with decimals 1.3, 1.45, and so forth
Think of the variable as 0 = false | 1 = true
in the case of checking wheter a puzzle is complete or an item has been picked up.