Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Armour Systems.

So, I'm adding a combat system to the game. I have the chances to hit and stuff all worked out, but for armour, I need some help. The general idea is around the code
<<set $health - $damage-$armour>>
But this could mean that the player gets healed if the damage is less than the armour. How would I go around solving this? It probably has a simple answer, but I cant figure it out.

Comments

  • Try this:

    <<if $damage - $armor gt 0>><<set $health -= $damage - $armor>><<endif>>
  • You may find doing it longhand will be more conducive to future expansion:
    <<set $damage -= $armour>>

    <<if $damage gt 0>>
    <<set $health -= $damage>>
    <<print "You are hit for " + damage + " points>>
    <<endif>>
    ...allows you to insert things like...
    <<if $affects[stoneskin] = 1>>
    <<$dmage -= 20>>
    <<endif>>
    ...without ending up with a terrible tangle of ifs.
  • Thanks both of you, that should work. I think I could use both, in a way.
Sign In or Register to comment.