ID:266748
 
Set up formulas for attacks and such... for the game I'm making I want to set up these stats

Strength
Magic Skill
Defense
Magic Defense

I need to know how to set up formulas for something like someone with 10 strength attacking someone with 5 defense and etc.... I also need to know how to set up spells

mob/verb/Attack(var/mob/M in oview(1))
Blah Blah Blah
var/DAMAGE = usr.Strength - M.Defense
if(DAMAGE > 0) M.HP -= DAMAGE
Eagle Madigan wrote:
Set up formulas for attacks and such... for the game I'm making I want to set up these stats

Strength
Magic Skill
Defense
Magic Defense

I need to know how to set up formulas for something like someone with 10 strength attacking someone with 5 defense and etc.... I also need to know how to set up spells


Download my demo by Clicking Here

it will explain everything you need to know.
In response to RaeKwon
for some reason it won't work
In response to Eagle Madigan
Eagle Madigan wrote:
for some reason it won't work

You mean Loading? BYOND is alittle slow right now, so give it afew, and click Open Project Files.

To get the code :P

RaeKwon
In response to Garthor
OK... and I pretty much do the same for spells?
In response to Eagle Madigan
Yeah, but you can adjust the formulae however you want, that one sucks.
In response to Garthor
with that formula, does that set the average damage or how much damage will be done?
In response to Eagle Madigan
I'm pretty sure you've gotten past 2nd grade math. Do you see anything that would make the damage higher or lower? use rand(min,max) to have randomized damage. Even better, rand(min/2,max/2) + rand(min/2,max/2) to have damage that is more commonly in the middle.
In response to Garthor
OK... and how exactly do I combine the two?
In response to Eagle Madigan
by using +

Don't you know math?
In response to Garthor
yes so, would this work?
rand(usr. strength*.5/2 - m. defense/2, usr. strength/2 - m. defense.5/2) + rand(usr. strength*.5/2 - m. defense/2, usr. strength/2 - m. defense.5/2)
In response to Eagle Madigan
maybe, but take out the space between m and defense, and what's the *.5/2? Just do /4
In response to Garthor
Just a moment of ignorance...