ID:1969499
 
(See the best response by Konlet.)
mob
var
Tumbleweed=0

mob
proc
Tumbleweed()
if(src.Tumbleweed)
walk_rand(src,1)
spawn(1)
Tumbleweed()

mob
Tumbleweed
name= "Tumbleweed"
icon = 'Turfs.dmi'
icon_state="dustball"
Tumbleweed=1




The dm tag is love.

The dm tag is life.
Please specify some more;

What is it you need help with?

Also, like @Kats said, put your code in <dm></dm>, it'll be nicely formatted.
Sorry. this is the first time I've had to ask for help using this. im not so familiar. I just want the tumbleweed to step around randomly or wander. As to resemble a real tumbleweed.

mob
var
Tumbleweed=0

mob
proc
Tumbleweed()
if(src.Tumbleweed)
walk_rand(src,1)
spawn(1)
Tumbleweed()

mob
Tumbleweed
name= "Tumbleweed"
icon = 'Turfs.dmi'
icon_state="dustball"
Tumbleweed=1
In response to Nothing2Gein
Well a "real tumbleweed" doesn't usually move in random directions, it's usually moving with the wind.

If random movement is what you want, you could do something like this:

step(src, pick(NORTH, NORTHEAST, NORTHWEST, SOUTH, SOUTHEAST, SOUTHWEST, EAST, WEST))


Additionally, instead of using spawn() the way you are in Tumbleweed(), you'd be better off doing this:

mob
Tumbleweed
New()
..()
tumble()

proc
tumble()
set waitfor = 0
while(loc)
step(src, pick(NORTH, NORTHEAST, NORTHWEST, SOUTH, SOUTHEAST, SOUTHWEST, EAST, WEST))
sleep(1)


This also gets rid of the need of the unnecessary Tumbleweed variable, as there's no reason the proc to move Tumbleweed mobs should be under mobs that aren't tumbleweeds.
In response to FKI
Best response
The while loop is redundant, that's what walk is for. It'll move a static direction rather than randomly, like a more normal tumbleweed behavior.

EDIT: Yeah, and Kaiochao's example shows how to to the same thing FKI created but correct.
mob/Tumbleweed
New()
..()
walk_rand(src)
Nothing2Gein said:
I just want the tumbleweed to step around randomly or wander.

Konlet said:
The while loop is redundant, that's what walk is for. It'll move a static direction rather than randomly, like a more normal tumbleweed behavior.

He asked for random movement, so that's what I gave him. I also mentioned in my response that tumbleweeds don't just move randomly, so yeah, I don't agree with you or the person who gave you a vote.

@Kaiochao: I don't use walk_rand() because in my experience, it's not random at all. I've always noticed the mobs moving in one constant direction after a while and just generally favoring one direction (usually EAST), ending up stuck at the end of the map.
I wanted random movement because if I make it move in one directions it will just be stuck at the end of the map after a minute. I'm fairly new to coding and I can't even begin to think how to code the tumble weed so it deletes at the end of the map and then respawns. I mean that would be the most realistic tumbleweed IMO but it takes a great deal of time learning to code.
In response to Nothing2Gein
Nothing2Gein wrote:
I wanted random movement because if I make it move in one directions it will just be stuck at the end of the map after a minute. I'm fairly new to coding and I can't even begin to think how to code the tumble weed so it deletes at the end of the map and then respawns. I mean that would be the most realistic tumbleweed IMO but it takes a great deal of time learning to code.

For starters, you could use get_step() prior (or after-- I'd go with the former though) to a Move() attempt to see if a turf exists where the tumbleweed is going. If not, you can respawn it, reset its location, or whatever it is you want to do.