ID:261705
 
Hi. I want this cloud to make the mob stay On it but it won't let me. Anybody know how to do that? Please fit it into this code:

obj/items/Cloud
icon = 'turfs.dmi'
icon_state = "cloud"
density = 1
Click()
src.Moving()
proc/Moving()
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1
sleep(10)
src.x -= 1 /// 17 times
sleep(10)
src.x += 1 // start adding
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
src.x += 1
sleep(10)
Moving()
I tried my best, I don't know if this would work or not, it's just a theory.
<code> obj items Cloud icon = 'turfs.dmi' icon_state = "cloud" density = 1 var/number = 0 var/what = "subtracting" Click() src.Moving() proc/Moving() start: // "start" if(what == "subtracting") // if it's subtracting if(number != 17) // and if it hasn't moved 17 spaces. src.x-- // subtract from X number++ // add to number src.CheckTop() //Check to see if there's a mob on top. goto start // go to start. else // if it has moved 17 spaces number = 0 // reset 'number' what = "adding" // set 'what' to adding, to let you know what it's doing else // if it's not subtracting (it must be adding) if(number != 17)// and if it hasn't moved 17 spaces. src.x++ // add to X number++ // add to number src.CheckTop() // Check to see if there's a mob on top. goto start // go to start. else // if it has moved 17 spaces number = 0 // reset number back to 0 what = "subtracting" // make it subtract again proc/CheckTop() for(var/mob/M in oview(1)) // For every mob that is within one space.. if(get_dir(src,M)==NORTH) // If a mob is directly north of the cloud.. if(what == "subtracting") // and if it's subtracting.. M.x-- // subtract one from X else // if it's not subtracting (It must be adding) M.x++ // add one to X </code>

Please let me know if this works.

Hope I helped you out.

~>Volte
In response to Volte
Or, you can try something like:

var
movement = 17
direction

while(movement && direction == "west")
step(src,WEST)
movement--
direction = "east"

while(movement != 17 && direction == "east")
step(src,EAST)
movement++

Move()
..()
for(var/mob/M in src.contents)
M.Move(src)


You should know what to do with this.
I'd really like to know why your proc has the same code repeated about a hundred times when you could more easily use a loop.
var/n
for(n in 1 to 17)
--x
sleep(10)
for(n in 1 to 17)
++x
sleep(10)
There's really no reason to unroll that here.

Lummox JR
In response to Lummox JR
Thanks Lummox JR! I really needed a looping thing.