ID:174985
 
Ok, I was looking through newbie central the other day and I saw Master Flame sage say he wanted smoke like in MLAAS. So I decided to make a demo and but it up on Bwicki. Here's what I have so far.

proc/smoke(what,range,amount,length)
spawn(8)
while(what)
walk_rand(what,20)
sleep(length)
del(what)


Now, the what is what is being created. Smoke, Gas, Poison.

The range is how far the smoke goes from the place where it was created.

Amount is the amount of "clouds" is made. This is where I'm having trouble figuring out how I would do this.

And length is how long the clouds last.
Sariat wrote:
Ok, I was looking through newbie central the other day and I saw Master Flame sage say he wanted smoke like in MLAAS. So I decided to make a demo and but it up on Bwicki. Here's what I have so far.
proc/smoke(what,range,amount,length)
spawn(8)
while(what)
walk_rand(what,20)
sleep(length)
del(what)
Now, the what is what is being created. Smoke, Gas, Poison.

The range is how far the smoke goes from the place where it was created.

Amount is the amount of "clouds" is made. This is where I'm having trouble figuring out how I would do this.

And length is how long the clouds last.

Well, it looks to me like the problem is that you're initializing the object in the wrong place. The "what" should be a type path, and the obj should really handle the movement and deleting itself. To handle this I've added an extra argument, to say where the stuff is spawned, and rearranged a bit for a more logical order.

I haven't seen MLAAS, so I'm not sure if you want the clouds moving continuously or just moving into position. It looks like you just want them to move into place and stop, which is easier to handle. If you want them to move around, you need another argument for their speed (unless each material knows its own speed) and then you need to start up a loop in which they move around--but spawn() it out.
proc/smoke(what, where, amount = 1, range = 1, duration = 10)
while(amount-- > 0) new what(where, range, duration)

obj/smoke
layer = FLY_LAYER

New(where, range = 1, duration = 10)
while(range-- > 0)
where = get_step_rand(where)
loc = where
spawn(duration) del(src)

Lummox JR
In response to Lummox JR
MLAAS makes the clouds move randomly out from where the smoke bomb/gas trap/whatever was triggered.
In response to Crispy
I had done something like this a while back for a series of smoke screen spells that created an item that spawned smoke.

obj
smoke_gen2
var/count=0
var/number=5
New()
spawn() src.gen()
proc/gen()
if(src.count>=src.number) del src
else
new/obj/smoke(src.loc)
new/obj/smoke(src.loc)
src.count++
spawn(2) src.gen()
smoke
layer=MOB_LAYER+9999
icon='smokescreen.dmi'
New()
icon_state=pick(icon_states(icon))
spawn(3) walk2(src)
var/walkc=0
proc/walk2(obj/smoke/A)
if(A.walkc<=25)
A.walkc++
walk_rand(A,15)
spawn(15) walk2(A)
else del src
mob/verb/Smoke_Screen()
set category="Abilities"
new/obj/smoke(usr.loc)
new/obj/smoke(usr.loc)
new/obj/smoke(usr.loc)
new/obj/smoke(usr.loc)
new/obj/smoke(usr.loc)
new/obj/smoke(usr.loc)
new/obj/smoke(usr.loc)
new/obj/smoke(usr.loc)
new/obj/smoke(usr.loc)
new/obj/smoke(usr.loc)
var/obj/smoke_gen2/A=new(usr.loc)
A.number=15


In the smokescreen verb the extra smokes are there for added cosmetic effects. It works rather nicely (granted a while() loop is better, but at the time I didn't know that you could do things such as while(count-->number). Only problem it actually has, is the smokes will go through walls (which probably has a simple fix as someone is sure to point out)..
In response to Nick231
Nick231 wrote:
Only problem it actually has, is the smokes will go through walls (which probably has a simple fix as someone is sure to point out)..

Override the smoke's Move() proc, and stop it moving to dense turfs.