Re: Newbie Programming weapons

From: Ivan Matyunin (
Date: 04/06/00

I got an idea that might help you...
with this peice of code, a level 2 attacking with a weapon that does say 1-4 points of damage would deal 3-7
and a level 3 would deal 4-8 and so on.... you can modify this to fit because a level 50 attacking with the same weapon certainly should not deal 51-55 damage but that is entirely up to you...
in fight.c
you will find a function that looks something like:
int damage(struct char_data * ch, struct char_data * victim, int dam, int attacktype)
in it you will find a line that should look like this:
dam = MAX(MIN(dam, 100), 0);
and right after it you will see:
GET_HIT(victim) -= dam;
now what you should do is BETWEEN this lines add this
dam = dam + GET_LEVEL(ch);

this will add the level number to the damage of the attacker...
alternately you could do something like this:
if a level 5 attacks a level 4 then he gets 1 bonus to his damage, if a level 4 attacks a level 5 he gets a pentalty of 1. In this case you should add this
dam = dam + (GET_LEVEL(ch) - GET_LEVEL(victim));

hope this helps... if you have any problems with this code just tell me what happens and i'll do my best to help you out.


     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 04/10/01 PDT