ID:261737
 
Ok, my first problem is that I have created a mob, that walks randomly around the map, or at least is supposed to. You see, there are no errors, and the code has come from the blue book, but when I log in, the randomly moving mob moves way way to fast, any ideas on how to slow it down? Heres the code...

mob
var/wander
New()
if(wander) walk_rand(src)
..()

mob/test
icon = 'test.dmi'
wander = 1 // I set the wander to 1 so as to make the mob wander around, setting it to zero will or should freeze the mob

Here is my second problem, I know why it occurs, but not how to fix it, you see when I log into the world, I have a title page, when I click on the start button, it logs the user in as it is supposed to, but it leaves gold, as it deletes the invisable character when looking at the title screen. Below are my gold and title screen codes... Please note that I have not supplied the statpanel and character selection codes as I think they are not needed in this case, but if they are really needed, I shall supply them if asked for...

Del()
var/obj/Gold/G = new(loc)
G.amount = rand(1,20)
..()
obj
Gold
icon = 'gold.dmi'
var
amount
verb
Pick_Up_Gold()


set src in view(1)
usr << "You pick up [amount] gold."
usr.gold += amount
del(src)
// Now for the title screen code

mob/spectator
icon = null
Move()

New()
..()
loc = locate("title_screen")
Logout()
..()
del(src)
world
mob = /mob/spectator


turf/start_button
icon = 'startbutton.dmi'
Click()
if(istype(usr,/mob/spectator))
usr.client.mob = new/mob/create_character()

//Thanks for any help granted, The Conjuror
mob
var/wander
New()
if(wander) walk_rand(10,src)
..()

You need to put a lag on it...try it now
In response to Goku72
Sorry, but now that the lag is on, the mob doesn't move at all! Got any ideas?
In response to The Conjuror
mob
New()
while(src) // when its there
step_rand(src) // step the mob randomly
sleep(5) // waits, then repeats it
..()


That will make it step randomly when it is created.

~~Dragon Lord~~
In response to Unknown Person
But that's not a good idea, since New() will never return, and thus, you can't create a reference to the mob (var/mob/wander/M = new() won't assign a value to M). You're better off putting the step_rand() stuff in a new proc, and calling it through spawn() Wander().
In response to The Conjuror
I'm betting you forgot to set <code>wander</code> to true. =P