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
Doubt about a puzzle idea (script)
Spelos Away
Banned

Posts: 231
Threads: 19
Joined: Sep 2014
#18
RE: Doubt about a puzzle idea (script)

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.

PHP Code: (Select All)
int vasesBroken 1;
int numberOfVases 19;

void BreakVase(string &in asEntitystring &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<= numberOfVasesi++)
    {
        if(!
GetEntityExists("vase_" i)) //This will create the non-existing vases.
        
{
            
CreateEntityAtArea("vase_" i"vase_file.ent""area_vase_" ifalse);
            
SetEntityCallbackFunc("vase_" i"BreakVase");
        }
        
ResetProp("vase_*"); //This will reset the existing vases & the newly created.
    
}

(This post was last modified: 03-10-2016, 08:42 AM by Spelos.)
03-10-2016, 07:19 AM
Find


Messages In This Thread
RE: Doubt about a puzzle idea (script) - by Spelos - 03-10-2016, 07:19 AM



Users browsing this thread: 1 Guest(s)