ID:264818
 
Code:
    Spawn_Hollow()
if(survival)
world<<"1"
var/Survival_Hollow/A = text2path( "/Survival_Hollow/Demi")
A = new A
A.loc = locate_tag(pick("survival1","survival2","survival3","survival4","survival5"))
//Spawn_Hollow()
sleep(50)
Spawn_Hollow()


Problem description:
ok the code sarts off ok but as soon as its suppose to spawn Spawn_Hollow() again it laggggs and freezes game.. I tried loops and goto but all same result..
I am trying to make it so when an event uses this proc and survival ==1 then the mob would spawn and keep spawning till suvival ==0
Vai God69 wrote:
Code:
>   Spawn_Hollow()
> if(survival)
> world<<"1"
> var/Survival_Hollow/A = text2path( "/Survival_Hollow/Demi")
> A = new A
> A.loc = locate_tag(pick("survival1","survival2","survival3","survival4","survival5"))
> //Spawn_Hollow()
> sleep(50)
> Spawn_Hollow()
>

Problem description:
ok the code sarts off ok but as soon as its suppose to spawn Spawn_Hollow() again it laggggs and freezes game.. I tried loops and goto but all same result..
I am trying to make it so when an event uses this proc and survival ==1 then the mob would spawn and keep spawning till suvival ==0

    Spawn_Hollow()
if(survival==1)
world<<"1"
var/Survival_Hollow/A = text2path( "/Survival_Hollow/Demi")
A = new A
A.loc = locate_tag(pick("survival1","survival2","survival3","survival4","survival5"))
//Spawn_Hollow()
sleep(50)
Spawn_Hollow()
else if(survival==0)
return()

if survival=1 the spawn_hollow() proc will be called again every 5 seconds, if survival =0, the proc is stopped.
In response to RedI
Thanks but it just freezes either after it spans 1 hollow of just before.
Procs should not call themselves like that unless you are specifically intending to create a recursive function (you aren't). You need to use a proper looping construct such as while(). So, for example:

while(1)
// blah blah blah
sleep(50)


As for your problem, you aren't giving us enough information to go on. The proc itself isn't the issue, it's something to do with the creation of the mob, or how it's interacting with other objects, or whatever.
In response to Garthor
yea but that is the creation of the hollows inside the proc..what else do u need?
In response to Vai God69
The problem is not with the proc you have posted, aside from the relatively minor issues I've already pointed out. The problem you are describing is a result of something else that is simply the indirect result of the procedure you've posted. Therefore, I'd need to see any procedures that would be affected by the creation or presence of the mobs that you are creating.
In response to Garthor
i found the problem :O thanks garthor i figured it out from what u said.. I was my actual Ai code when they walk.. i use while src but didnt use the sleep for the while proc thats why it froze