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
#4
RE: Doubt about a puzzle idea (script)

I agree with Mudbill,
but let's be cute with our code for a second. Tongue

Set the variable to the first vase's suffix. "vase_1" => vasesBroken = 1;
Grab the suffix of currently broken entity by SubString and convert it to an Integer.

Compare those...
(this code prevents you from writing if statements for each vase)

While it's not a problem here, some codes could work with thousands of vases.

PHP Code: (Select All)
int vasesBroken 1;

void BreakVase(string &in asEntitystring &in type)//This can be a standard SetEntityFuncCallback as OnBreak
{
    if(
type != "OnBreak") return;

    if(
vasesBroken == StringToInt(StringSub(asEntity51)))
    {
        if(
vasesBroken == 4// 4 in this case is the last vase
        
{
            
//YAAAY! Player Got it right!
        
}
        
vasesBroken++;
        return;
    }

      
vasesBroken 1// And Mudbill surely wanted to include resetting his variable... right?  

//If you get here, it's the wrong order, restart code here, call CheckPoint, ResetProp etc...

03-07-2016, 11:22 PM
Find


Messages In This Thread
RE: Doubt about a puzzle idea (script) - by Spelos - 03-07-2016, 11:22 PM



Users browsing this thread: 1 Guest(s)