ID:140265
 
Code:
mob/Trainer
verb
Send_Out_Pokemon(mob/Pokemon/M in Pokemon)
set category = "Trainer"
usr<<"You send out [M]."
client.mob = M
M.loc = locate(usr.x,usr.y,usr.z)
return


Problem description:
Ok, the problem here is that, whenever I press the verb, It sends out the Pokemon, but it thinks it just logged in and takes it to the Start Screen along with the "Login()"

M.loc = locate(usr.x,usr.y,usr.z)

isn't working either...

This is because Login() is called when a client is given a mob. Similarly, Logout() is called when a client loses control of a mob. This is intended (and documented) behavior.

The actual proc that's only called when a player connects is client/New(), and when they disconnect it calls client/Del().
In response to Garthor
How would you intend to do that?
In response to Toushiroa
I'm going out on a whim here. I am going to guess you have your code structured somewhat similar to this:

mob
Pokemon
Pikachu
name = "Pikapi!"
var
list/Pokemon = list("Pokemon 1","Pokemon 2","Pokemon 3")
mob/Trainer
verb
Send_Out_Pokemon(mob/Pokemon/M in Pokemon)
set category = "Trainer"
usr<<"You send out [M]."
client.mob = M
M.loc = locate(usr.x,usr.y,usr.z)
return



Now, assuming this, your verb would have to have a few tweaks. Though I already know Garthor has some kind of comment to make on my sloppy coding. :P jk, Garth.

mob/Trainer
verb
Send_Pokemon(mob/Pokemon/M in Pokemon)
set category = "Trainer"
usr<<"You send out [M]."
//client.mob = M // This line is erroring you out (I think.)
M.loc = locate(usr.x,usr.y,usr.z)
return ..() // let it do it's thing, yo.

// Now, if you get a cannot send
// null.Pokemon error or something
// in Dream Seeker, make sure when
// you catch your pokemon you add
// it to the list, like so:

Catch_Pokemon(mob/Pokemon/P)
set category = "Trainer"
usr.Pokemon.Add(P) // some people might object to this because using usr
// with a list looks ugly, but Pokemon isn't a global var.


Now the client.mob = M line. If I'm correct, that means that you are making M the Trainer, which we don't want. So comment that out, and you should be fine.
In response to Kirone
Please stop trying to provide help.
In response to Kirone
Actually, it's the other way around...I'm making the Trainer [M]...

It sends the pokemon out perfectly with no errors, All I need to know is how to make the Trainer become M
In response to Toushiroa
You already have it right: change client.mob to M.

The issue is that, by doing that, you break the common (and bad) conventions of using Login() for when a player connects and Logout() for when a player disconnects, as they are ACTUALLY called whenever a client changes mobs, which is what you are doing here. To fix your problem, you need to stop using Login() and Logout() as if they are for something they are not.

This is, of course, just repeating what I said earlier.
In response to Garthor
Ok, So I fixed up the Sending out and you becoming the pokemon, but now, it deletes the trainer so...I cant return my Pokemon...please help
In response to Toushiroa
Just pretend I repeated myself again, here.
In response to Garthor
Ok well, I fixed that a bit after I posted the message...The only thing still messed up is that, I cant use the verb anymore >_<

mob
verb
Return_Pokemon(mob/M in Sentt_Out)
set cat = "Trainer"
M.Pokemon += usr
M.Sent_Out = 0
M.Sentt_Out -= usr
M.Controlled=1
usr.Controlled=1
client.mob = M
usr<<"You return [usr]"
sleep(10)
M.Controlled=0
usr.Controlled=0
return

mob/Trainer
verb
Send_Out_Pokemon(mob/Pokemon/M in Pokemon)
set cat = "Trainer"
usr<<"Test"
if(usr.Sent_Out==0)
usr<<"You send out [M]."
M.loc = locate(usr.x,usr.y,usr.z)
usr.Sent_Out=1
M.Controlled=1
M.Sentt_Out += usr
usr.Sentt_Out += M
client.mob = M
return
else
usr<<"A Pokemon is already sent out!"
return
In response to Toushiroa
^bump^