hi, i was wondering if anyone could show me how to make a battle code similar to the one in Raekwon's game Temple of Time, that has Strengh Defence Dexterity and Agility, all the demo's in the hub only have attack and defence but i'd like to know how to make it so you can dodge attacks and miss ur target depending on your stats? i'd very much apretiate help!
Thanx
DthKllr
ID:149213
Jun 16 2002, 1:34 pm
|
|
Jun 16 2002, 1:43 pm
|
|
just set up a rand(1,100), then, subtract the defender's agility from the attacker's dexterity, then calculate whether it was a hit or not using that agility-dexterity. Then, if it hits, adjust damage by strength minus defense.
|
In response to Garthor
|
|
where abouts in this code do u suggest i put these alterations?
mob/characters verb Attack(mob/M in oview(1)) var/hitting = rand(1,3) if(hitting == 1) var/damage = rand(1,str) if(usr.str - M.defense > 0) usr << "You Punch [M] For [damage]!" M << "[usr] Punches You For [damage]" M.HP -= usr.str - M.defense usr.Levelup() M.DeathCheck() else M << "[src] Bounces off you!" usr << "Your to weak, you bounce off the [M]" if(hitting == 2) var/damage = rand(1,str) if(usr.str - M.defense > 0) usr << "You Slice [M] For [damage]!" M << "[usr] Slices You For [damage]" M.HP -= usr.str - M.defense M.overlays+='hit.dmi' usr.Levelup() M.DeathCheck() sleep(4) M.overlays-='hit.dmi' else M << "[src] Bounces off you!" usr << "Your to weak, you bounce off the [M]" if(hitting == 3) var/damage = rand(1,str) if(usr.str - M.defense > 0) usr << "You Kick [M] For [damage]!" M << "[usr] Kicks You For [damage]" M.HP -= usr.str - M.defense usr.Levelup() M.DeathCheck() else M << "[src] Bounces off you!" usr << "Your to weak, you bounce off the [M]" mob/proc/DeathCheck() if(istype(src,/mob/monster)) if(src.HP <= 0) src.HP = src.maxHP usr.exp+=src.exp usr.gold+=src.gold view() << "[usr] won!" del(src) if(istype(src,/mob/characters)) if(src.HP <= 0) src.HP = src.maxHP usr.exp+=src.exp usr.gold+=src.gold view() << "[usr] won!" src.loc=locate(1,1,1) mob/proc/Levelup() if(usr.exp >= usr.maxexp) usr << "You Gained A Level!" usr.exp = 0 usr.HP+=5 usr.maxHP+=5 usr.Level +=1 var/strgain = rand(1,3) if(strgain == 1) usr.str+=1 usr << "Strength + 1" if(strgain == 2) usr.str+=2 usr << "Strength + 2" if(strgain == 3) usr.str+=3 usr << "Strength + 3" var/defensegain = rand(1,3) if(defensegain == 1) usr.defense+=1 usr << "Defense + 1" if(defensegain == 2) usr.defense+=2 usr << "Defense + 2" if(defensegain == 3) usr.defense+=3 usr << "Defense + 3" |
In response to DthKllr
|
|
I noticed a few innefficiencies in here. One, there is if(1) if(2) etc. for the strgain. Just have it usr << "Strength + [strgain]" Strength += strgain. I'll read more of your code later, I have to go right now.
|
In response to Garthor
|
|
Hey Garthor, thanx for your help! i was wondering could you make a demo for me? if you could make a nice login and battle code like what you've explaind and a monster so u can attack it? i'll pay dimes for it, i know theres other demos out there but none have what im looking for, maybe i could chat with you online or somthing so u could explain things?
Thanx very much for your time nice person! (Garthor) DthKllr |