Hello Im trying to make an auto Battle System. Now my problem is the enemy mob/pc/Goblin. I dont know how to define him in another proc called Battle(). of course in Battle I just did var/mob/pc/M = usr and that seems to work fine for the player. But i can't seem to get to define the Goblin mob and its variables like the players variables.
Could you please tell me the code to refrence to an enemy mob in a proc and explain it.
My code for Battle() is bellow tell me if you need any more code thanks. If you didnt notice Im using G as the var to represent my Goblin mob but how do I code it so it refrences to him?
if((M.hp>0)||(G.hp>0))
// Cheack to see if either one is still alive
G.pct=rand(0,G.attack_pct)
M.pct=rand(0,M.defense_pct)
// Get % of attack and defense
if(G.pct>M.pct)
world << "DEBUG: " << G.pct
world << "DEBUG: " << M.pct
// See if Enemy can attack player
G.pct = G.attack - M.defense
// Get Enemys attack - players
if(G.pct<1)
// If enemys damage is lower than 1 make it 1
G.pct=1
G.pct = rand(1,G.pct)
M.hp = M.hp - G.pct
// Ochy player looses HP
G.pct=rand(0,G.defense_pct)
M.pct=rand(0,M.attack_pct)
// Get % of attack and defense
if(M.pct>G.pct)
M.pct = M.attack - G.defense
if(M.pct<1)
M.pct=1
M.pct = rand(1,M.pct)
G.hp = G.hp - M.pct
Time_Process++
// Time it takes to die
Heal++
// Heal every so often
if(Heal>5)
M.hp+=2
G.hp+=2
spawn(10) Battle()
// Start Battle() all over again ever 1 second
else
Time_Process++
Output_Battle()
</1></1></<></<>
ID:267292
![]() Feb 15 2003, 2:04 am
|
|
![]() Feb 15 2003, 6:33 am
|
|
NeverMind I figured it out :)
|