Axe Software Forums
  Quest Developer Forum
  Yet ANOTHER question for poor old me


Author Topic:   Yet ANOTHER question for poor old me
Tyrant posted 03-07-2001 19:27 GMT     
Ok, now what I'm trying to do is print a little math that I've done. When the enemy attacks, I want to be able to print how much HP the enemy just took off of you. Here is what I'm trying to do:

*Enemy attacks you
*Change value of HP to -4
*Change value of HP to +yourdefense (yourdefense is a collectible which is basically your DEFENSE POINTS which protects you better against attacks)

It works out good, but I don't know how to print that. Let's say that yourdefense = 2. That would mean that 4 is taken off of HP, but then 2 is added to HP... so in the long run, only 2 was taken off of HP. Now how do I print that? I can't just print "-2" because your defense is constantly being increased as you level up or find armor.

Wizard posted 03-07-2001 20:03 GMT          
If I understand, you are asking about the method more that the formulas.

The defense that you speak of is commonly referred to as Armor Class (AC). Each piece of armor or clothing or magic ring, etc might have an AC rating. The players AC rating is a total of all of this equipment. I would recommend staying away from negative numbers as they have a tendency to confuse players.

Example:
Breast Plate AC=10
Helmet AC=2
Magic Ring AC+1
Leather Leggings AC+3

Total AC=16

This total is used in the formula to determine if a hit is made.

OPTION: you can have the AC rating be the percent of blocking. In the example above the player would have a 16% chance of blocking the hit.

OPTION: If you are really crazy: use the random number generator to determine what part of the body is hit (chest, head, etc.) and use the AC rating the armor worn in that area to determine it is a hit and/or amount of damage.

Hope this helps, Wizard

Tyrant posted 03-07-2001 21:13 GMT          
Actually, that isn't really what I was asking, though the info you just gave could help me further develop my battle engine in future games:-)

What I meant is I wanted to print the output of the formula on the screen for the player. When the enemy attacks, I want "-(hp)" to appear on the screen so the player knows how much HP he just lost in the attack. But I don't know how to actually do this since the defense points must be added to the amount of HP you just lost.

When the player attacks, for example, it's much easier to show the amount of HP the enemy just lost. All I do is use the player's strength points to determine the amount of HP the enemy lost, so I would simply print "-~playerstrength~HP" (So the outcome may be -8HP, for example). I can't do this when I print the amount of HP the player loses when an enemy attacks since a little math must be done to determine this. The enemy's strength points are subtracted from the player's HP, but then the player's defense points are added to the amount he just lost so he doesn't lose as much HP. Am I confusing you? It's sort of hard to explain, but I know it's possible. To sum it all up, basically I want to know how to print mathematical outcomes, but the mathematical numbers are stored as variables (playerstrength, HP, and, if I have to, enemystrength even though I haven't stored that as a variable).

I know how to actually pull off the equation, so the player loses the correct amount of HP, but I don't know how to actually print the amount of HP he just lost so the player can see it on the text output screen.

By the way (Wizard), are you making an RPG as well? If you are adding the elements you've been telling me about, that RPG will be insane! As I further progress my experience with Quest, I should be able to make the battles more complicated and better, but for now they're pretty much simple.

Computer Whizz posted 03-07-2001 22:13 GMT          
AHA!!! Equations.... something I exell at!
OK so what you want to do is to have an HPoutcome right?
Now internally you'd have Quest doing what the enemy did in damage and then adding your defense!
So it's:
[list]
[*] Enemy attacks you.
[*] Change damage to damage-defense.
[*] Set HPoutcome as HP-damage (which has changed!).
[*] Print damage taken.
[*] Print HPoutcome is now your HP amount!
[/list]
simplified it's:

O=Da-De
Hp=Hp-O

The above is AFTER you have been hit ONLY!!!

--CW

Tyrant posted 03-07-2001 22:48 GMT          
I'm a friggin' moron. I must have had a mind block or something because as soon as I saw your post, it instantly came to me. I slapped myself across the head a few times, but now I know how to do it. Thanks for pointing me in the right direction.