ID:140873
 
Okay, let me explain things fitst.. When you send out your pokemon, you take on the pokemons icon, and your pokemon takes on your icon (if it makes more sense: You become the pokemon)

Now, at the bottom of the coding for each pokemon I have this run:

    New()       //The built in proc that is called when you make a new mob.
..() //..() tells it to do the normal new stuff.
spawn(50)//After 5 tenths of a second "spawn" the following stuff.
AI()//Call the mobs AI proc.


And the AI proc does this:
mob
proc
AI()
if(src.rank=="Pokemon")
step_rand(src)
sleep(20)
step_rand(src)
sleep(20)
step_rand(src)
sleep(20)
step_rand(src)
sleep(20)
step_rand(src)
sleep(20)
src.AI()
else
return


Now here's the problem.. When you send out the pokemon, after it takes on your icon, it does the AI proc.
Obviously, this should happen, except on the SendOut verb I do this:
M.rank="Player"


So, your pokemon (that has your icon) shouldn't move at all.. but for some reason it still does, and it looks really weird to have what looks like your trainer randomly wander.

Anyone know what I did wrong?
NOTE: It stops wandering after a few steps.
EDIT: Also, if I return it, then send it out again, it works fine, no random wandering.
I think your problem is that you don't check before every step if i got it right,cause it finishes all steps,returns to the beginning and then the check blocks it.
In response to Destrojer
No, it doesn't finish every step.. It does a few, normally 1-3
In response to Xyphon101
Because you are not checking the status of the variable every step, only every five steps. If it is on step three, it will take two more steps before stopping.

Aside from that, your AI proc is junk. Recursively calling the proc like that (calling AI() from within AI()) leads to a stack overflow which crashes the proc. You need to use a while() loop instead:

while(rank == "player")
step_rand(src)
sleep(20)
In response to Garthor
Thanks! I also did the while thing, thanks =]