ID:143949
 
Code:
mob
proc
startbattle(mob/M1)
for(var/turf/battleloc/B in world)
if(B.inuse==0)
usr.loc=locate(B)
M1.loc=locate(usr.x,usr.y+5,usr.z)
return

turf
battle_grass
icon='battlegrass.dmi'
Entered(mob/M)
if(prob(25))
src<<"You just got into a battle."
var/M1
M1=new/mob/monster/Slimer
M.startbattle(M1)
return
else
return


Problem description:thats what ive gotten so far (plus i have the monster) when the battle initiates i get transported to a black area allthough on my map ive got the battleloc right where its supposed to be, so why aint my charactor and the monster getting transported there? also if your thinking thats from a ib or demo, your mistooken i made it myself and thats why its not fully done yet, i just started on it this morning.

Thanks for your help (in advance if anyone does help)


mob
proc
startbattle(mob/M1)
for(var/turf/battleloc/B in world)
if(!B.inuse)//you should look up boolean variables in the DM refrence/guide
src.loc=locate(/turf/battleloc/B)//your first problem, "usr" does not belong in procs. in procs, "usr" is not "clicking" this. procs are instead called by src(Default var)
//also, make sure you have only ONE battleloc turf on your map, or it will teleport you to a random one
M1.loc=locate(src.x,src.y+5,src.z)
return

that should work
In response to Axerob
then whats this mean?

randbattle.dm:7:error:/turf/battleloc/B:undefined type path
it says that for the locate part

once that gets out of the way, i can start on battle commands :)
In response to VolksBlade
VolksBlade wrote:
then whats this mean?

randbattle.dm:7:error:/turf/battleloc/B:undefined type path

once that gets out of the way, i can start on battle commands :)

Undefined paths usually mean you haven't defined the item the path targets.


Oh and, don't use libraries. I know where some of that comes from.
In response to RedlineM203
if your saying i am using someone elses work, your wrong, i may have looked over just about all the turn based battle systems but i havent yet tooken anything from them, just maybe idea's because most of them i couldent read
In response to VolksBlade
I fixed the problem with a very easy deleating method

check it out

**OLD**

mob
proc
startbattle(mob/M1)
for(var/turf/battleloc/B in world)
if(!B.inuse)
src.loc=locate(/turf/battleloc/B) M1.loc=locate(src.x,src.y+5,src.z)
return


**new**

mob
proc
startbattle(mob/M1)
for(var/turf/battleloc/B in world)
if(!B.inuse)
src.loc=B M1.loc=locate(src.x,src.y+5,src.z)
return


and it put me exactly where i wanted to be.

Now Onto The BCommand System!!
In response to VolksBlade
Minus the 2 indents taken out, I see nothing was changed. How did the 2 indents do that?

EDIT: Whoops.
In response to RedlineM203
look closer to the locate part.

Now i have bigger problem:

when i attack and are done with my turn, the monster is supposed to attack, but it dont, and i dont see a way around it.

check it out below, and tell me what you think.

mob
var/tmp
isturn=0
choice
attacking=0
running=0
skill=0
magic=0
damage
inbattle=0
mob
proc
startbattle(mob/M1)
for(var/turf/battleloc/B in world)
if(!B.inuse)
src.loc=B
M1.loc=locate(src.x,src.y+5,src.z)
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.battle(src)
return
if(src.endurence>=M1.endurence)
src.isturn=1
src.battle(M1)
return
if(src.endurence<=M1.endurence)
M1.isturn=1
M1.battle(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
if(M1.isturn==1)
M1.Attack2(src)
return
sleep(10)
goto start
Attack(mob/M1)
if(prob(50))
src.damage=src.strength-M1.defence
M1.hp-=src.damage
src<<"You attack [M1] for [damage] damage!"
src.isturn=0
M1.MDcheck()
M1.isturn=1
else
src<<"You attack [M1] but [M1] moves at the right moment."
src.isturn=0
Attack2(mob/M1)
if(prob(50))
src.damage=src.strength-M1.defence
M1.hp-=src.damage
src<<"You attack [M1] for [M1] damage!"
src.isturn=0
M1.Dcheck()
else
src<<"You attack [M1] but [M1] moves at the right moment."
src.isturn=0
M1.isturn=1
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.isturn=1
Wait(mob/M1)
src<<"You wait for [M1] to come after you."
src.isturn=0
M1.isturn=1
Dcheck()
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
return
MDcheck()
if(src.hp<=0)
src.isturn=0
src.icon_state="Dead"
sleep(10)
del(src)
return
else
src.isturn=1
return

turf
battle_grass
icon='battlegrass.dmi'
Entered(mob/M)
var/M1
if(prob(15))
src<<"You just got into a battle."
M1=new/mob/monster/Slimer
M.startbattle(M1)
return
else
return
battleloc
var/inuse=0
In response to VolksBlade
you need to create an AI that automatically attacks
In response to Axerob
Axerob wrote:
you need to create an AI that automatically attacks

I *think* he already knows.
In response to RedlineM203
yeah, i already know i need an AI that automatically attacks, i would how-ever like to know which you all would suggest me to check out. :/ ill check some out myself but i dont think there are that many turn-based-Monster-AI's...
In response to VolksBlade
new probem, i had my monster ai working well, then when i waited for my first turn (note: battle command wait) and i attacked (and missed) for my seond turn, tis is what showed up:

You got into a battle
You wait for Slimer to come after you.
You get attacked by Slimer for 0 damage!
runtime error: Cannot execute null.MAttack().
proc name: Attack (/mob/proc/Attack)
source file: randbattle.dm,73
usr: VolksBlade (/mob/Person)
src: VolksBlade (/mob/Person)
call stack:
VolksBlade (/mob/Person): Attack(null)
VolksBlade (/mob/Person): battle(null)
VolksBlade (/mob/Person): Dcheck()
Slimer (/mob/monster/Slimer): MAttack(VolksBlade (/mob/Person))
VolksBlade (/mob/Person): Wait(Slimer (/mob/monster/Slimer))
VolksBlade (/mob/Person): battle(Slimer (/mob/monster/Slimer))
VolksBlade (/mob/Person): gofirst(Slimer (/mob/monster/Slimer))
VolksBlade (/mob/Person): startbattle(Slimer (/mob/monster/Slimer))
the battle grass (3,9,1) (/turf/battle_grass): Entered(VolksBlade (/mob/Person), the battle grass (3,10,1) (/turf/battle_grass))
You attack but moves at the right moment.

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(45))
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(M1)
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=src.strength-M1.defence
if(src.damage<=0)
src.damage=0
M1.hp-=src.damage
src<<"You attack [src] for [src.damage] damage!"
M1<<"You get attacked by [src] for [src.damage] damage!"
src.isturn=0
M1.Dcheck(M1)
else
M1<<"[src] attacks you but you move."
src.isturn=0
M1.Attack(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(M1.hp<=0)
M1.isturn=0
M1.icon_state="Dead"
sleep(10)
del(src)
return
else
M1.isturn=1
M1.MAttack(M1)
return

turf
battle_grass
icon='battlegrass.dmi'
Entered()
var/M1
if(prob(15))
M1=new/mob/monster/Slimer
usr.startbattle(M1)
return
else
return
battleloc
var/inuse=0
In response to VolksBlade
VolksBlade wrote:
new probem, i had my monster ai working well, then when i waited for my first turn (note: battle command wait) and i attacked (and missed) for my seond turn, tis is what showed up:

You got into a battle
You wait for Slimer to come after you.
You get attacked by Slimer for 0 damage!
runtime error: Cannot execute null.MAttack().
proc name: Attack (/mob/proc/Attack)
source file: randbattle.dm,73
usr: VolksBlade (/mob/Person)
src: VolksBlade (/mob/Person)
call stack:
VolksBlade (/mob/Person): Attack(null)
VolksBlade (/mob/Person): battle(null)
VolksBlade (/mob/Person): Dcheck()
Slimer (/mob/monster/Slimer): MAttack(VolksBlade (/mob/Person))
VolksBlade (/mob/Person): Wait(Slimer (/mob/monster/Slimer))
VolksBlade (/mob/Person): battle(Slimer (/mob/monster/Slimer))
VolksBlade (/mob/Person): gofirst(Slimer (/mob/monster/Slimer))
VolksBlade (/mob/Person): startbattle(Slimer (/mob/monster/Slimer))
the battle grass (3,9,1) (/turf/battle_grass): Entered(VolksBlade (/mob/Person), the battle grass (3,10,1) (/turf/battle_grass))
You attack but moves at the right moment.

> 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(45))
> 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(M1)
> 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=src.strength-M1.defence
> if(src.damage<=0)
> src.damage=0
> M1.hp-=src.damage
> src<<"You attack [src] for [src.damage] damage!"
> M1<<"You get attacked by [src] for [src.damage] damage!"
> src.isturn=0
> M1.Dcheck(M1)
> else
> M1<<"[src] attacks you but you move."
> src.isturn=0
> M1.Attack(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(M1.hp<=0)
> M1.isturn=0
> M1.icon_state="Dead"
> sleep(10)
> del(src)
> return
> else
> M1.isturn=1
> M1.MAttack(M1)
> return
>
> turf
> battle_grass
> icon='battlegrass.dmi'
> Entered()
> var/M1
> if(prob(15))
> M1=new/mob/monster/Slimer
> usr.startbattle(M1)
> return
> else
> return
> battleloc
> var/inuse=0
>


um anyone... help?? been here since last night, and was wondering if anyone was going to help..?