ID:147814
 
this is my battle system
mob/characters
verb
Attack(var/mob/M in get_step(src,src.dir))
set category = "Actions"
if(usr.attacking == 0)
var/hitting = rand(1,10000)
if(9999 >= hitting >= 1)
var/damage = rand(1,str)
if(usr.str - M.defense > 0)
usr.attacking = 1
view(6) << "[usr] attacks [M] For [damage]!"
M << "[usr] attacks you for [damage]"
M.HP -= usr.str - M.defense
sleep(3)
usr.Levelup()
M.DeathCheck()
sleep(12)
usr.attacking = 0

else
usr.attacking = 1
M << "[src] Bounces off you!"
view(6) << "[usr]'s attack bounces off of [M]!"
sleep(12)
usr.attacking = 0
if(hitting == 10000)
view(6) << "[usr] attacks [M] For a TKO!!!"
M << "[usr] attacks you for a TKO!!!"
M.HP -= 100000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000
sleep(3)
usr.Levelup()
M.DeathCheck()
usr.attacking = 1
sleep(8)
usr.attacking = 0
else

mob/var/cho = 0



mob/proc/DeathCheck()
if(istype(src,/mob/characters))
if(src.HP <= 0)
if(src.Level>= 5)
if(src.exp >= 50)
src.HP = src.maxHP
src.exp -= 50

view(5) << "[usr] won!"
src.loc=locate(2,2,1)
else
src.exp = 0
view(5) << "[usr] won!"
src.loc=locate(2,2,1)
if(src.HP <= 0)
if(src.Level<= 5)
src.HP = src.maxHP
view(5) << "[usr] won!"
src.loc=locate(2,2,1)


if(istype(src,/mob/monsters))
if(src.HP <= 0)
src.HP = src.maxHP
usr.exp+=src.exp
usr.gold+=src.gold
usr.Kills+=src.Kills
view(5) << "[usr] won!"
del(src)

if(istype(src,/mob/monsters))
if(src.HP <= 0)
src.HP = src.maxHP
usr.exp+=src.exp
usr.gold+=src.gold
usr.Kills+=src.Kills
view(5) << "[usr] won!"
del(src)

mob
proc
checklevel(mob/M as mob)
if (M.exp >= M.maxexp)
Levelup(M)
mob/proc/Levelup() // Leveling Up
if(usr.exp >= usr.maxexp)
usr << "You Gained A Level! You are now level [usr.Level + 1]!"
usr.exp = 0
usr.maxMP += 20
usr.maxHP+=20
usr.Level +=1
usr.gold +=250
usr.maxStamina +=20
usr.str+=(rand(1,3))
usr.defense+=(rand(1,3))
usr.bon += 10
if(usr.Level <= 18)
usr.maxexp *= 2.0
else
usr.maxexp +=(rand(50000,75000))


I need it to work out a bit better.... I need it to allow people with lower str and attacking to still do damage to people and monsters... and I need it to inquire weapon skills. (meaning... if the person has 34 long sword skill... he does more damage than someone with 21 long sword skill) Anyone who could help I will be very thankful.
lol... sorry about the colors... they are kinda in the coding... didnt know they would show up on here
In response to SilentFoe
SilentFoe wrote:
lol... sorry about the colors... they are kinda in the coding... didnt know they would show up on here

Please edit your post to close your HTML tags, then put <dm> tags around your code so the forum doesn't interpret the HTML as colors.

And no put usr in proc. Ungh.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
SilentFoe wrote:
lol... sorry about the colors... they are kinda in the coding... didnt know they would show up on here

Please edit your post to close your HTML tags, then put <dm> tags around your code so the forum doesn't interpret the HTML as colors.

And no put usr in proc. Ungh.

Lummox JR

"
M.HP -= 100000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000"

that could be M.HP=0 :P

and as for explaining lummox jrs topic a tiny bit (8 words):

You should use src in most procs if possible

And shouldnt this be under newbie central, since theres no problem with the code?

and as for your question

if(weapon=="Sword")
damage+=skill

somthing like that any way
What, exactly, is a one in ten-thousand chance of instantly killing the enemy supposed to add to your game?
In response to Wanabe
Wanabe wrote:
and as for explaining lummox jrs topic a tiny bit (8 words):

You should use src in most procs if possible

That's a bit too much of an oversimplification: Often people resort to usr because src isn't the correct thing to use, but they don't think about the right way to do things. The right approach, when src isn't it, is to send more information to the proc.

And shouldnt this be under newbie central, since theres no problem with the code?

Looks like it has plenty of problems to me.

Lummox JR