Indomitus 388 Posted January 19, 2019 (edited) Today I started playing with options for building a game timer without using a timer object (using the DELAY tile instead) and realized that the same technique could be applied to "Move Or Die" style logic. If you've never played Move Or Die, it's a fast-paced VS game, and one of the main mechanics of it is that if you stand still for too long, you die and automatically lose that round. To stay in the game, you have to keep moving. I figured that could be a fun game mechanic to have in Ylands, if someone comes up with a game mode to use it. Here's the results. Have fun with it. I'm just posting screenshots for now, since it's actually pretty simple code. The main code is in an Entity Storage. All of the variables being used are listed under the "On Create" event. Those would need to be defined in the Variables section at the left. Certain ones are just values you can change to adjust the behavior of the logic. And of course the "DisplayTimer" routine can be changed or even removed depending on the needs of the game. To make it work, this is the code I added into a Player Role object. The Delay tile in this part is completely optional. One possible variation could be: If the move distance is higher than the minimum, where it currently sets "MyStandStillTime" to 0, it could instead subtract the "TimerInterval" (or a different value) to make the time act like regenerating health instead of resetting all at once. Another variation could use the player's actual Hit Points instead of a timer. That would give a built-in display and warning when it's running out. Edited January 19, 2019 by Indomitus Share this post Link to post Share on other sites
Oliver Hope 261 Posted January 19, 2019 (edited) I was thinking about custom timers like this and im actually surprised it works seeing as the delay function doesnt work in while loops. Interesting Edited January 19, 2019 by Oliver Hope Share this post Link to post Share on other sites
Oliver Hope 261 Posted January 19, 2019 Are the return functions a way of breaking the loop? or what do they do? Share this post Link to post Share on other sites
Indomitus 388 Posted January 19, 2019 (edited) A Return tile is basically an "END" command. It tells the script to exit the routine. There's a plain one, and one that can return a value, so you have to use the one that matches the block of code you're in. If that code was called from somewhere else, it will return to the next line back there. The Delay tile does kind of the same thing. It will end the block of code, so it has to be at the end, or inside a piece of logic where it's okay to exit the routine (like inside an IF block). Edited January 19, 2019 by Indomitus Share this post Link to post Share on other sites
Oliver Hope 261 Posted January 19, 2019 49 minutes ago, Indomitus said: A Return tile is basically an "END" command. It tells the script to exit the routine. There's a plain one, and one that can return a value, so you have to use the one that matches the block of code you're in. If that code was called from somewhere else, it will return to the next line back there. The Delay tile does kind of the same thing. It will end the block of code, so it has to be at the end, or inside a piece of logic where it's okay to exit the routine (like inside an IF block). Wow i just learnt a lot thanks Share this post Link to post Share on other sites