Mudbill's right, that will most likely work.
Although, if we were to future-proof the code, we're now using the number of vases on multiple occasions. If the number were to change and you forget to change one of those values, it might not work.
So I recommend creating an Integer variable for the number of vases like this:
And actually... I would check if some entities even exist. I doubt that setting them in-active counts as destroying.
I think there is no need to recreate the unbroken vases.
int vasesBroken = 1;
int numberOfVases = 19;
void BreakVase(string &in asEntity, string &in type)
{
if(type != "Break") return;
if(asEntity == "vase_" + vasesBroken)
{
if(vasesBroken == numberOfVases)
{
//The Player got it right!
return;
}
vasesBroken++;
return;
}
vasesBroken = 1;
for(int i = 1; i <= numberOfVases; i++)
{
if(!GetEntityExists("vase_" + i)) //This will create the non-existing vases.
{
CreateEntityAtArea("vase_" + i, "vase_file.ent", "area_vase_" + i, false);
SetEntityCallbackFunc("vase_" + i, "BreakVase");
}
ResetProp("vase_*"); //This will reset the existing vases & the newly created.
}
}