Page 1 of 1
counting health without endgame
Posted: Mon Sep 22, 2008 12:26 am
by Commodore
I want to tally health in the middle of the game and award points, but counting means taking and taking all the health makes the game end.
#take health 100
#give health 100
ends the game (assuming you have exactly 100 health)
yet we know the odd truth that:
#endgame
#give health 100
does not end the game. any ideas?
Posted: Mon Sep 22, 2008 4:42 am
by Xhin
#take health 100
#give health 100
Doesn't end the game, although if there's an idle or any other type of command that doesn't happen instantaneously, it will make your game go into hyperspeed. So, just keep taking health until you are incapable, and then immediately give back at least one health point.
Posted: Mon Sep 22, 2008 4:53 am
by Commodore
well this is sort of what I had, but it goes into super speed
:loop
#take health 1 #done
#give score 1
#loop
:done
#give health 100
it executes a couple lines after getting to 0 health before giving health so I guess that's why it doesn't work
Posted: Mon Sep 22, 2008 7:59 am
by Dr. Dos
Commodore wrote:well this is sort of what I had, but it goes into super speed
:loop
#take health 1 #done
#give score 1
#loop
:done
#endgame
#give health 100
Fixed for you.
Posted: Mon Sep 22, 2008 8:20 am
by Commodore
no i tried that. the hyper effect starts when health reaches zero and doing an endgame after the effect starts doesn't slow the game back down.
Posted: Mon Sep 22, 2008 9:41 am
by Microwave
:loop
#take health 3#check2
#give score 3
#loop
:check2
#take health 2#done
#give score 2
#loop
:done
#give score 1
#give health 98
Does that work?
Posted: Mon Sep 22, 2008 2:11 pm
by Dr. Dos
Commodore wrote:no i tried that. the hyper effect starts when health reaches zero and doing an endgame after the effect starts doesn't slow the game back down.
Could the stat order cause that?
Because I ended up making a test world with code exactly like that before seeing your own code.
Posted: Mon Sep 22, 2008 5:49 pm
by Quantum P.
You could do it backwards:
Code: Select all
#give score 100
#start
:loop
#give health 1
#take score 1
:start
#take health 100 loop
#give health 100
There's still one #take health in there, so it might still send you into hyperspeed. Might be solvable by throwing in an idle before the #take health. I haven't tested it.
Posted: Mon Sep 22, 2008 5:57 pm
by Commodore
actually dos you were right, I don't know what I was doing before wrong though because I thought I tried that.
ok. thx