ID:176952
 
how do i make an attack take off MP from the users MP?
usr.MP -= 999999999999999999
Leahcim wrote:
how do i make an attack take off MP from the users MP?

However the attack happens, you'll basically have to include something like this:
mob
proc/MPDamage(damage) // remove MP points from src
MP = max(MP-damage, 0)
Then if the attack takes off, say, 4 points from the target, call target.MPDamage(4).

It may be simpler just to include the MP=max(...) statement right in the attack proc, but that depends on how the attack is implemented. If a lot of things can reduce MP, using a proc like this one may be a better way to go.

Lummox JR
In response to Garthor
mob
verb
SuperSlash(mob/M as mob in oview(3))
set category = "Battle"
usr.icon_state = "kneel"
sleep(30)
usr.icon_state = "locke"
flick("battle",usr)
var/damage = usr.STR - M.DEF + rand(2,20)
if(damage <= 0)
usr << "[M] easily dodges your attack!"
M << "You easily dodge [usr]'s attack."
else
M.HP -= damage
view() << "[usr] attacks [M] for [damage] HP!"
M:deathcheck()


this is my script does it help?
In response to Leahcim
mob
verb
SuperSlash(mob/M as mob in oview(3))
set category = "Battle"
usr.icon_state = "kneeel"
sleep(30)
usr.icon_state = "lockee"
usr.mp -= 2
var/damage = usr.STR - M.DEF + rand(2,20)
if(damage <= 0)
usr << "[M] easily dodges your attack!"
M << "You easily dodge [usr]'s attack."
else
M.HP -= damage
view() << "[usr] attacks [M] for [damage] HP!"
M:deathcheck()

NOW DATS SOME GOOD CODING FOR A BONG SMOKING MAN!