ID:143935
 

battle log:
You got into a battle
You attack Slimer but Slimer moves at the right moment.
Slimer attacks you but you move.
You get attacked by Slimer for 2 damage!
You attack Slimer but Slimer moves at the right moment.
Slimer attacks you but you move.
Slimer attacks you but you move.
You get attacked by Slimer for 1 damage!
You attack Slimer but Slimer moves at the right moment.
Slimer attacks you but you move.
You attack Slimer for 8 damage!


Code:
mob
var/tmp
isturn=0
choice
attacking=0
running=0
skill=0
magic=0
damage
inbattle=0
oz
ox
oy
mob
proc
startbattle(mob/M1)
var/turf/battleloc/T
if (prob(50))
for(T in world)
if(!T.inuse)
T.inuse = 1
src.ox = src.x
src.oy = src.y
src.oz = src.z
M1.loc=locate(src.x,src.y+5,src.z)
src<<"You got into a battle"
src.gofirst(M1)
return
gofirst(mob/M1)
if(src.endurence==M1.endurence)
if(src.agility>=M1.agility)
src.isturn=1
src.battle(M1)
return
if(src.agility<=M1.agility)
M1.isturn=1
M1.MAttack(src)
return
if(src.endurence>=M1.endurence)
src.isturn=1
src.battle(M1)
return
if(src.endurence<=M1.endurence)
M1.isturn=1
M1.MAttack(src)
return
battle(mob/M1)
start:
if(src.isturn==1)
src.choice=input("What would you like to do?","BATTLE")in list("Attack","Run","Wait")
if(src.choice=="Attack")
src.Attack(M1)
return
if(src.choice=="Run")
src.Run(M1)
return
if(src.choice=="Wait")
src.Wait(M1)
return
sleep(10)
goto start
Attack(mob/M1)
if(prob(50))
src.damage=src.strength-M1.defence
if(src.damage<=0)
src.damage=0
M1.hp-=src.damage
src<<"You attack [M1] for [damage] damage!"
src.isturn=0
M1.MDcheck(src)
else
src<<"You attack [M1] but [M1] moves at the right moment."
src.isturn=0
M1.MAttack(src)
MAttack(mob/M1)
if(prob(50))
src.damage=rand(11,15)
src.damage-=M1.defence
if(src.damage<=0)
src.damage=0
M1.hp-=src.damage
src<<"You attack [M1] for [damage] damage!"
M1<<"You get attacked by [src] for [damage] damage!"
M1.isturn=0
M1.Dcheck(src)
else
M1<<"[src] attacks you but you move."
src.isturn=0
M1.MAttack(src)
Run(mob/M1)
if(prob(50))
src<<"You quickly side-step [M1] and make a run for it."
src.inbattle=0
del(M1)
else
src<<"You try to side-step [M1] but [M1] was faster than you."
src.isturn=0
M1.MAttack(src)
Wait(mob/M1)
src<<"You wait for [M1] to come after you."
src.isturn=0
M1.MAttack(src)
Dcheck(mob/M1)
if(src.hp<=0)
src.isturn=0
src.icon_state="Dead"
sleep(10)
src.hp=src.mhp
src.loc=locate(1,1,1)
src<<"You died... how sad..."
return
else
src.isturn=1
src.battle(M1)
return
MDcheck(mob/M1)
if(src.hp<=0)
src.isturn=0
src.icon_state="Dead"
sleep(10)
del(src)
return
else
src.isturn=1
src.MAttack(M1)
return

turf
battle_grass
icon='battlegrass.dmi'
Entered()
var/M1
if(prob(40))
M1=new/mob/monster/Slimer
usr.startbattle(M1)
return
else
return
battleloc
var/inuse=0


Problem description:
the monster gets extra turns without me giving them to it, check out the coding and see if your a better coder than i by trying to spot the problem (note: even if you dont see the problem your still probably a better coder than i)


BUMP and yes i can do this it as been 24hr's + 3 minutes and several seconds :)
In response to VolksBlade
I didn't actually run any testing with this and it's slightly hard to follow your code.
but I looked at it

        MAttack(mob/M1)
if(prob(50))
src.damage=rand(11,15)
src.damage-=M1.defence
if(src.damage<=0)
src.damage=0
M1.hp-=src.damage
src<<"You attack [M1] for [damage] damage!"
M1<<"You get attacked by [src] for [damage] damage!"
M1.isturn=0//looks like you are setting the player's isturn to 0 here. Shouldn't it be src.isturn=0
M1.Dcheck(src)
else
M1<<"[src] attacks you but you move."
src.isturn=0
M1.MAttack(src)
In response to Vermolius
i cut out the turn system allready
In response to VolksBlade
need the stats and stuff?

here they are:

mob
Person
strength=10
mstr=10
agility=10
magi=10
defence=10
mdef=10
endurence=10
mdef=10
hp=10
mhp=10
icon='mob.dmi'
monster
Slimer
icon='slimer.dmi'
hp=5
strength=5
mstr=5
agility=5
magi=5
defence=5
mdef=5
endurence=5
mend=5
RSlimer
icon='slimer.dmi'
name="Red Slimer"
hp=7
strength=7
mstr=7
agility=7
magi=7
defence=7
mdef=7
endurence=7
mend=7
In response to VolksBlade
i just took out the death checks and added them to the attack prase and now it works, i was getting confused with all the switching around of the "src" and the "M1" M1 supposedly being the enemy and src being the real person (switched around on the moster battle phrase)
In response to VolksBlade
As was I.