ID:171069
 
Umm, I have this repop code, but i cant get it to work.. When i kill something, it dissapears, but wont respawn O.o

This is the code:

mob
proc
MonsterAttack(mob/M)
if(src.attacking == 0)
src.attacking = 1
//var/parrylist = list("High","Middle","Low")
//continu = 1
//else
// continu = 1
//tryagin
//if(continu == 1)

view() << "[M] takes [src.Str] damage from [src]!"
M.Hp -= src.Str
Death(M)
sleep(src.Delay)
src.attacking = 0

mob
proc
Death(mob/M)
if(src.type == /mob/player)
Playerdie()
else
if(src.Hp<=0)
view()<<"[src] has been killed by [usr]!"
del(src)
therepop()
Playerdie(mob/M)
if(src.Hp<=0)
view() << "[usr] Died!"
src.loc = locate(1,1,1)
src.Hp = Max_Hp
therepop()
proc
therepop()
world.Repop()
sleep(150)


mob
proc
NonAggresiveLook() //name of proc
var/mob/player/M //variable M has to be mob/usr
while(src) //while src is stil kickin
if(M in oview(5)) //if M is in oview(5)
if(M.name in src.killlist) //now if M.name is in src.killlist, this has it only attack if attacked!
walk_to(src,M,1,4) //src walks to M until 1 block away, moving 4/10ths of a second
if(M in oview(1)) //if M is in oview(1)
step_towards(src,M) //src steps toward M
else //if usr.name isnt in src.killlist
//src.killlist += M.name
sleep(15)//pauses for 1 and 1/2 seconds
step_rand(src) //step randomly on the field
break //breaks out of the while loop
else //if M isnt in oview(5)
for(M in view(src)) //for all Ms in view(src)
break //breaks out of the while loop
sleep(5) //pauses 1/2 second before redoing loop
spawn(2) // pauses 2/10 of second before redoing proc
NonAggresiveLook() //redoes proc
AggresiveLook() //name of proc
var/mob/player/M //variable M has to be mob/usr
while(src) //while src is stil kickin
if(M in oview(5)) //if M is in oview(5)
if(M.name in src.killlist) //now if M.name is in src.killlist, this has it only attack if attacked!
walk_to(src,M,1,4) //src walks to M until 1 block away, moving 4/10ths of a second
if(M in oview(1)) //if M is in oview(1)
step_towards(src,M) //src steps toward M
else //if usr.name isnt in src.killlist
src.killlist += M.name
sleep(15)//pauses for 1 and 1/2 seconds
step_rand(src) //step randomly on the field
break //breaks out of the while loop
else //if M isnt in oview(5)
for(M in view(src)) //for all Ms in view(src)
break //breaks out of the while loop
sleep(5) //pauses 1/2 second before redoing loop
spawn(2) // pauses 2/10 of second before redoing proc
NonAggresiveLook() //redoes proc
mob/var
Delay = 50
mob
Enemy
Mutant_Mushroom
icon = 'characters.dmi'
icon_state = "49"
Hp = 15
Max_Hp = 15
Delay = 60
Str = 5
New() //Starts a ummm pattern...best way I can describe it
.=..() //continue as normal before next lines of codes
spawn(1) //wait for 1/10 of a second
NonAggresiveLook() //starts the Look() proc
Bump(mob/M) //when peacefulguy bumps into someone, thing it bumps into is M
if(M.client) //M is a client
if(src.attacking == 0)
MonsterAttack(M) //goes to monsterattack send M
mob
Enemy
WereWolf
icon = 'characters.dmi'
icon_state = "50"
Hp = 30
Max_Hp = 30
Delay = 40
Str = 10
New() //Starts a ummm pattern...best way I can describe it
.=..() //continue as normal before next lines of codes
spawn(1) //wait for 1/10 of a second
NonAggresiveLook() //starts the Look() proc
Bump(mob/M) //when peacefulguy bumps into someone, thing it bumps into is M
if(M.client) //M is a client
if(src.attacking == 0)
MonsterAttack(M) //goes to monsterattack send M

mob/var
killlist = list("")
attacking = 0

Someone Please help ><
i dont see why your repop ing the hole world everytime 1 thing is killed. remove that bit that links to the repop and use this (you may wish to edit it to your need)

world
New() // when a new world starts
spawn(10) repopgame() // wait for 10 ticks and then run a proc


proc
repopgame()
world.Repop() // repop the world
spawn(150) repopgame() // wait for 150 ticks and then run a proc


i think the 150 may be a bit to low :/
In response to Madpeter
Madpeter wrote:
i dont see why your repop ing the hole world everytime 1 thing is killed. remove that bit that links to the repop and use this (you may wish to edit it to your need)

> world
> New() // when a new world starts
> spawn(10) repopgame() // wait for 10 ticks and then run a proc
>
>
> proc
> repopgame()
> world.Repop() // repop the world
> spawn(150) repopgame() // wait for 150 ticks and then run a proc
>

i think the 150 may be a bit to low :/

I might change the 150, but i get a iconsistent indentation error for the spawn(10)... line
In response to Takaru
thats coz you have to tab it right

press Ctrl + t to show the tabs