ID:162750
 
Ok, my game has no map, and text-based and I have it where you can click a verb and selection infomation about the mob your about to fight. After you pick all your info, how would you make the mob spawn and the battle begin?
That is an incredibly loaded question. Do you already have a battle system? How do you select the mob to fight?
In response to Garthor
    proc/arena()
switch(input("Welcome to the Sparring Arena, who do you want to fight.","Sparring Arena") in arena)
if("Academy Rank")
switch(input("Ok, Academy Rank, now from what village?","Village Type") in vtype)
if("Leaf")
spawn() new/mob/NPC/leafnin1
StartBattle()
if("Sand")
if("Mist")
if("Sound")
if("Rock")
<dm>
//I'm thinking something like this, I have a battle system..
In response to Lundex
You put </DM> at the end of code posted on the forum, not <DM>.

Anyway: StartBattle() would have to take an argument, which is the mob to fight. spawn() is definitely not to be used here, instead, you'd want to do var/mob/NPC/leafnin1/N = new() Then, StartBattle(N).
In response to Garthor
Ok, but it still didn't work, think you could go though my battle code?


mob
parent_type = /obj
var
mob/A
mob/B

New(location, mob/a, mob/b)
..()
src.A = a
src.B = b
if(A&&B) // if they are both there, start the battle
StartBattle(A, B)

proc/StartBattle(mob/A, mob/B)
if(A.spd<B.spd)
EngageBattle(B, A)
if(A.spd>B.spd)
EngageBattle(A, B)
else
if(prob(50))
var/tempvar = A
A = B
B = tempvar
EngageBattle(A, B)

proc/EngageBattle(mob/A, mob/B)
if(A.client)
var/list/commands = list("Fight","Run")
var/command = input(A,"Please select a command.","Prebattle") in commands
switch(command)
if("Fight")
FightBattle(A, B)
if("Run")
flee(A, B)

proc/FightBattle(mob/A, mob/B)
if(A.client)
var/list/commands = list("Attack","Jutsus/Techniques","Wait")
var/command = input("Select a command.","Battle") in commands
switch(command)
if("Attack")
A.attack(B)
if(B.DeathCheck(A))
EndBattle(A, B, "Win")
else
EngageBattle(B, A)
if("Jutsus/Techniques")
var/list/L = A.skills
if(L.len)
var/skills/I = input(A, "Select a Jutsu.","Jutsu Selection") in L + "Back"
if(I=="Back")
EngageBattle(A, B)
else
var/path = I.skillpath
call(A,path)(B)
if(B.DeathCheck(A))
EndBattle(A, B, "Win")
else
EngageBattle(B, A)
if("Wait")
A<<"You decide to wait a turn to gather chakra."
B<<"[A] waits skips their turn."
sleep(10)
EngageBattle(B, A)
proc/MonsterBattle(mob/A, mob/B)
if(A.hp<=A.maxhp/4)
var/list/L = A.skills
if(L.len)
var/skills/I = pick(L)
var/path = I.skillpath
call(A,path)(B)
if(B.DeathCheck(A))
EndBattle(A, B, "Win")
else
EngageBattle(B, A)
else
var/list/L = A.skills
if(L.len)
var/skills/I = pick(L)
var/path = I.skillpath
call(A,path)(B)
if(B.DeathCheck(A))
EndBattle(A, B, "Win")
else
EngageBattle(B, A)
else
A.attack(B)
if(B.DeathCheck(A))
EndBattle(A, B, "Win")
else
EngageBattle(B, A)

proc/EndBattle(mob/A, mob/B, status)