So I have a script that will count the number of ingredients in an area and will then activate a grunt if all the ingredients are present, but it's not working, and I don't know why....
void Grill(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
if(GetLocalVarInt("NumBodyParts") == 3)
{
SetEntityActive("servant_grunt_1",true);
}
else
{
AddLocalVarInt("NumBodyParts",1);
}
}
else
{
AddLocalVarInt("NumBodyParts",-1);
}
}
With the callback functions
AddEntityCollideCallback("corpse_male_leg_1","Grill","Grill",false,0);
AddEntityCollideCallback("corpse_male_arm_1","Grill","Grill",false,0);
AddEntityCollideCallback("corpse_male_torso_1","Grill","Grill",false,0);
I have used a "playGUIsound" function to test each part of the script above, and each section works except for the section within the
if(GetGlobalVarInt("NumBodyParts") == 3)
{
SetEntityActive("servant_grunt_1",true);
}
It is running the other parts of the code, but either the AddLocalVarInt functions aren't working, or I need to somehow initialize the variable "NumBodyParts" and I do not know how to do this. (From what I could tell from looking at the other Amnesia scripts, this variable should create itself when I use the AddLocalVarInt function, though of course I could be wrong).