ID:142186
 
Code:
world
mob = /mob/player
name = "Dragonball Adventure Online"
hub = "Kinotsu.DragonballAdventureOnline"
status = "Dragonball Adventure Online (Closed Testing:Characters will be deleted!)"
New()
world.name = "Dragonball Adventure Online (Closed Testing:Characters will be deleted!)"
spawn(150) Dragonball_Scat()
while(repop >= 1)
sleep(10)
repop -= 1
if(repop == 1)
for(var/mob/NPC/piccolo/I in world)
if(I.beans <= 4)
I.beans += 1
for(var/obj/plants/plant/O in world)
if(O.beans <= 9)
O.beans += 1
if(O.beans == 5)
O.icon_state = "plant-2"
if(O.beans == 10)
O.icon_state = "plant-3"


mob
proc
Dragonball_Scat()
var/x = rand(27,250)
var/y = rand(1,205)
new/obj/dragonball(locate(x,y,z))
var/x2 = rand(27,250)
var/y2 = rand(1,205)
new/obj/dragonball(locate(x2,y2,z))
var/x3 = rand(27,250)
var/y3 = rand(1,205)
new/obj/dragonball(locate(x3,y3,z))
var/x4 = rand(27,250)
var/y4 = rand(1,205)
new/obj/dragonball(locate(x4,y4,z))
var/x5 = rand(27,250)
var/y5 = rand(1,205)
new/obj/dragonball(locate(x5,y5,z))
var/x6 = rand(27,250)
var/y6 = rand(1,205)
new/obj/dragonball(locate(x6,y6,z))
var/x7 = rand(27,250)
var/y7 = rand(1,205)
new/obj/dragonball(locate(x7,y7,z))
world << "<b><font color = yellow><u>Event: </u></font><font color = green>The Dragonballs scatter across the earth!</font></b>"
view()<<sound('dbs_flying.wav')
for(var/mob/player/M in world)
M.flash3()
spawn(1600) Dragonball_Scat()


Problem description:

When I call it on the spawn,it keeps on saying that
Dragonball_Scat()

Is undefined when I clearly have it defined -_-''

What could be the problem?
you have dragonball_scat defined under /mob/ You need to remove mob from the proc, and then re-indent it.
In response to Axerob
Axerob wrote:
you have dragonball_scat defined under /mob/ You need to remove mob from the proc, and then re-indent it.

Ah,that seemed to do the trick for the spawn thing.

But now I'm led to a new problem that I need to fix,where the dragonball_scat gets stacked and spams when called upon again.

Like right now,the dragonball_scat proc starts to run as soon as the server starts up.

But I have it so that you make a wish,it runs it again so that the dragonballs scatter.

Problem is,since the dragonball_scat has a spawn command,then it'll start doing it over and over on the already running dragonball_scat proc....

So it could be spammed to a point where you would see the message "The dragonballs have scattered" a buncha times.

So I'm thinking,maybe I should break it into 2 procs then?

One for the world that spawns and then one that doesn't spawn for when you make a wish?
In response to Kinotsu
proc/Dragonball_Scat()
while(world) // while the world is up
sleep(3000) // waits 5 minutes, 600 ticks = 1 minute
world << "<b><font color = yellow><u>Event: </u></font><font color = green>The Dragonballs scatter across the earth!</font></b>"
for(var/mob/player/M in world)
M.flash3()
for(var/I in 1 to 7) // the following will occur 7 times...
new/obj/dragonball(locate(rand(27,250),rand(1,205), z))
oview() << sound('dbs_flying.wav')


Also, i recommend you just delete the dragonballs from the contents and wait for the scatter proc to call.
In response to Axerob
Hmm...okay.

Seems good.

But the only problem is

    New()
spawn(150) Dragonball_Scat()


wont run it when the world starts up. :/
In response to Kinotsu
That's because of the 5 minute timer. What you could do is edit the Dragonball_scat() abit:
proc
Dragonball_scat(T)
sleep(T) // time to delay the scat
// do what it's supposed to
world
New()
spawn(150)Dragonball_scat(1) // this will spawn the dragonballs when the world starts, and then when someone wishes, run the Dragonball_scat(X) // X=the time delay you want the dragonballs to scatter again

If you do everything right it'll would work fine o.o
In response to Ruben7
Alright thanks guys :D

I'm gonna set up a new topic,I'm full of problems lol

I guess this is what I get for actually coding my own stuff :P
In response to Kinotsu
That is because i have sleep(3000) before the stuff executes.