Post new topic    
Liquid Metal Slime
Send private message
get hero stat and if statements 
 PostWed Jul 25, 2012 2:16 am
Send private message Reply with quote
I am trying to create a script that lowers each of the heroes current HP by 10. If any hero's current HP is reduced below 1, then he is killed. If all of the heroes current HP is reduced below 1, then a text box is displayed and the
game resets.

From what I can tell, here is what I need to do:

1) Reduce each heroes current HP by 10.

2) Check to see if any heroes have less than 10 HP. If so, make them dead.

3) If all heroes have less than 10 HP, display text box and reset the game.

I've figured out this much already:

Code:
oldstat := get hero stat(0, stat:Hull, current stat)
set hero stat(0, stat:Hull, oldstat--10, current stat)

oldstat := get hero stat(1, stat:Hull, current stat)
set hero stat(1, stat:Hull, oldstat--10, current stat)

oldstat := get hero stat(2, stat:Hull, current stat)
set hero stat(2, stat:Hull, oldstat--10, current stat)

oldstat := get hero stat(3, stat:Hull, current stat)
set hero stat(3, stat:Hull, oldstat--10, current stat)


How do I proceed from here?
Metal Slime
Send private message
 
 PostWed Jul 25, 2012 3:09 am
Send private message Reply with quote
You could also use the command, "map cure". Despite it's name, it also works for doing damage to your characters. It might be easier to do that than use variables to store each hero's current HP and then modify them with "set hero stat".

From there, you could just set a game-over script. You would only need two commands.

Code:
show text box (#x)
game over


Yes, it's that simple.
Hey, I just met you, and this is crazy... So here's some lunchmeat... Sandwich, maybe?
Metal King Slime
Send private message
 
 PostWed Jul 25, 2012 3:20 pm
Send private message Reply with quote
There is no step 2. A hero is dead if their HP is zero or less. Changing their HP stat immediately updates the hero's "is alive" tag, but does not end the game if all the heroes are dead.

One option:

Code:

variable (i, new hp, someone alive)
someone alive := false
for (i, 0, 3) do (
  new hp := get hero stat(i, stat:Hull, current stat) -- 10
  set hero stat(i, stat:Hull, new hp, current stat)
  if (new hp >> 0) then (someone alive := true)
)
if (someone alive == false) then (
  #whatever...
  game over
)
Liquid Metal Slime
Send private message
Re: get hero stat and if statements 
 PostThu Jul 26, 2012 2:47 am
Send private message Reply with quote
Thanks for your help guys. I combined your two methods into a working script. The way I was doing it (code below) would cause heroes to have negative HP. For instance, if hero had 7 HP and you lost 10, he would then have -3. This caused all sorts of strange quirks, obviously.

Code:
oldstat := get hero stat(0, stat:Hull, current stat)
set hero stat(0, stat:Hull, oldstat--10, current stat)
Metal King Slime
Send private message
Re: get hero stat and if statements 
 PostThu Jul 26, 2012 1:13 pm
Send private message Reply with quote
Willy Elektrix wrote:
For instance, if hero had 7 HP and you lost 10, he would then have -3. This caused all sorts of strange quirks, obviously.


Obviously? Like what?

I plan to revise the way stats work for Beelzebufo with special attention to negative stats and stat caps. I would like to know about any existing problems with them.
Liquid Metal Slime
Send private message
Re: get hero stat and if statements 
 PostFri Jul 27, 2012 2:20 am
Send private message Reply with quote
TMC wrote:
Willy Elektrix wrote:
For instance, if hero had 7 HP and you lost 10, he would then have -3. This caused all sorts of strange quirks, obviously.


Obviously? Like what?

I plan to revise the way stats work for Beelzebufo with special attention to negative stats and stat caps. I would like to know about any existing problems with them.


On the status screen, it doesn't even display as a negative number. Instead, it shows up as the positive equivalent. For instance, -3 appears as positive 3.

Then when you enter battle, the HP bar is pointed in the negative direction and overlaps the border of the bar. Also the hero has shows his heavily damaged icon instead of his dead icon, although I don't think he can take any actions or be targeted.
Metal King Slime
Send private message
 
 PostSat Jul 28, 2012 10:55 am
Send private message Reply with quote
Ah yes, now I remember that the status menu bizarrely shows the absolute value of your HP and MP. But didn't know about the others; haven't searched for poblems.
Display posts from previous: