Detect when game won?

Started by Courtesy, December 27, 2014, 02:21:55 PM

Previous topic - Next topic

Courtesy

I want to have additional dialog once the map has been completed play out. Is there a way to connect an if function to the game being completed?

knucracker

I'm not seeing any easy way to detect that right off the bat.  You could check the score by calling GetScore and if that doesn't change for like 30 frames in a row, then there's a good chance the game is complete.  The score "locks" to a value upon game completion, that's why that should work in theory.  You just have to be careful since the score decrease slows down the longer the game runs, so you have to wait long enough so that a false trigger doesn't happen.

planetfall

How about this?


once
   1 ->playing
endonce

<-playing if

   0 0 999 GetEnemyUnitsInRange 0 do
      CONST_COUNTSFORVICTORY GetUnitAttribute not ->playing
      <-playing if
          break
      endif
   loop

   <-playing not if
      #Display conversation here
   endif
endif
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.

Courtesy

It doesn't work. Killing emitters doesn't seem to change anything. I have the CRPL one set to not count for victory.
I do have a message set up, the default example one ("You're on a planet!")

Virgil, wouldn't that false flag if the player pauses?

planetfall

Quote from: Courtesy on January 01, 2015, 05:21:03 PM
Virgil, wouldn't that false flag if the player pauses?

Only if the core is set to operate while paused (which they are not by default.)
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.