ID:272944
 
How do i make a mob switch code like in Pokemon
You're going to have to give us a better idea of what you mean than that.

If I had to guess, you're probably referring to swapping Pokemon to and from your team.

There's many ways to go about it, but the easiest is probably to .Move() the mobs in and out of the player contents list.

Then you'd probably have something in the code of the Pokemon (or whatever) to make sure they don't don't do anything while they're in a player content list. Something like:
mob
proc/MobAI()
while (loc != null && !(istype(loc,/mob/player)) && IsConscious())
sleep(10)
if (istype(loc,/mob/player))
continue
// Actual AI code goes here.

Otherwise they'd be doing weird things like trying to move or attack while they're riding around inside the player mob.
In response to Geldonyetich
Geldonyetich wrote:
If I had to guess, you're probably referring to swapping Pokemon to and from your team.
Want i need is to send the mob on the battle field to the team's box & send a new mob from the team's box to the battle field
In response to Prf X
Prf X wrote:
Geldonyetich wrote:
If I had to guess, you're probably referring to swapping Pokemon to and from your team.
Want i need is to send the mob on the battle field to the team's box & send a new mob from the team's box to the battle field

.Move() should be able to do this for you.
In response to Geldonyetich
Geldonyetich wrote:
Prf X wrote:
Geldonyetich wrote:
If I had to guess, you're probably referring to swapping Pokemon to and from your team.
Want i need is to send the mob on the battle field to the team's box & send a new mob from the team's box to the battle field

.Move() should be able to do this for you.

Is this right?
mob/proc
Switch_Mob()
input("Which mob now?","Game") in usr.mobs//usr.mobs is =to pokeballs
Move(usr.loc)

because it not working
In response to Prf X
I can see two things wrong with that code.

First, input needs to assign its response to something, otherwise it does nothing.

Second, Move() is a proc attached to atoms. It doesn't take the atom you're moving, that's implied by which mob you're invoking the proc off of. Rather, it takes the destination as an argument. So your code should look more like this:

mob/proc
Switch_Mob()
var/mob/thisMob = input("Which mob now?","Game") in usr.mobs //usr.mobs is =to pokeballs
thisMob.Move(usr.loc)


When in doubt, use the F1 key reference in Dream Maker and look up each command you're trying to use. The reference would have both clarified how input() works and how .Move() works.
In response to Geldonyetich
Here my mob switch codes & only parts of it works:
mob/proc
Switch_Mob()
var/mob/P=input("Which mob now?","Game") in usr.mobs
var
ux = usr.x
uy = usr.y
uz = usr.z
P.name=usr.name
src.loc=locate(usr.mobs)
P.mobs=usr.mobs-P
P.MOB=usr.MOB
P.numofmob=usr.numofmob
P.numofmobs=usr.numofmobs
P.contents=usr.contents
P.verbs+=/mob/proc/Switch_Mob
P.verbs+=/mob/proc/Switch_Mob2
P.verbs+=/mob/proc/Switch_Mob3
P.verbs+=/mob/proc/Switch_Mob4
P.loc = locate(ux,uy,uz)
P.key = usr.key
Switch_Mob2()
var/mob/P=input("Which mob now?","Game") in usr.mobs
var
ux = usr.x
uy = usr.y
uz = usr.z
P.name=usr.name
P.mobs=usr.mobs-P
P.MOB=usr.MOB
P.numofmob=usr.numofmob
P.numofmobs=usr.numofmobs
P.contents=usr.contents
P.verbs+=/mob/proc/Switch_Mob
P.verbs+=/mob/proc/Switch_Mob2
P.verbs+=/mob/proc/Switch_Mob3
P.verbs+=/mob/proc/Switch_Mob4
src.loc=locate(P.mobs)
P.loc = locate(ux,uy,uz)
P.key = usr.key
Switch_Mob3()
var/mob/P=input("Which mob now?","Game") in usr.mobs
var
ux = usr.x
uy = usr.y
uz = usr.z
P.name=usr.name
P.mobs=usr.mobs-P
P.MOB=usr.MOB
P.numofmob=usr.numofmob
P.numofmobs=usr.numofmobs
P.contents=usr.contents
P.verbs+=/mob/proc/Switch_Mob
P.verbs+=/mob/proc/Switch_Mob2
P.verbs+=/mob/proc/Switch_Mob3
P.verbs+=/mob/proc/Switch_Mob4
src.Move(locate(P.mobs))
P.loc = locate(ux,uy,uz)
P.key = usr.key
Switch_Mob4()
var/mob/P=input("Which mob now?","Game") in usr.mobs
var
ux = usr.x
uy = usr.y
uz = usr.z
P.name=usr.name
src.Move(locate(usr.mobs))
P.mobs=usr.mobs-P
P.MOB=usr.MOB
P.numofmob=usr.numofmob
P.numofmobs=usr.numofmobs
P.contents=usr.contents
P.verbs+=/mob/proc/Switch_Mob
P.verbs+=/mob/proc/Switch_Mob2
P.verbs+=/mob/proc/Switch_Mob3
P.verbs+=/mob/proc/Switch_Mob4
P.loc = locate(ux,uy,uz)
P.key = usr.key

they all send P to the field & give P all the stat but will not send the mob on the field to the mobs var,
it seems to del the mob,
Do not need all 4 edit, only need 1 edit,
& here my make mobs code & it works:
mob/verb/Make_Mobs()
f(usr.MOB==0)
P.name=usr.name
var
ux = usr.x
uy = usr.y
uz = usr.z
P.loc = locate(ux,uy,uz)
src.client.mob = P
P.MOB = 1
P.numofmobs += 1
del(src)
else
if(usr.MOB == 1)
usr.verbs+=/mob/proc/Switch_Mob
usr.verbs+=/mob/proc/Switch_Mob2
usr.verbs+=/mob/proc/Switch_Mob3
usr.verbs+=/mob/proc/Switch_Mob4
usr.MOB = 2
usr.mobs += P
usr.numofmobs += 1
else
if(usr.numofmobs == usr.numofmob)
var/DEL=input("Del who?","The Game") in usr.mobs+P
if(DEL==null)del(P)
else
del(DEL)
usr.mobs += P
else
usr.mobs += P
usr.numofmobs += 1

<BIG>Thank you</BIG>
In response to Prf X
I think the problem is right here:
src.Move(locate(usr.mobs))

I'm pretty sure you can't .Move a mob to a variable you defined. You have to move it to an actual location as defined by by BYOND infrastructure. Like inside turf, mob, or obj.

If you really want to use your own data structure for storing these mobs, you can, but what you're essentially going to have to do is create and destroy the mobs while saving their information somewhere else, such as a datum you defined.
In response to Geldonyetich
To be more precise, you can Move() into any atom. Assuming usr.mobs is a list, you can't Move() into it.

Speaking of which, don't use usr in procs, original poster.
In response to Geldonyetich
Geldonyetich wrote:
I think the problem is right here:
> src.Move(locate(usr.mobs))
>

I'm pretty sure you can't .Move a mob to a variable you defined. You have to move it to an actual location as defined by by BYOND infrastructure. Like inside turf, mob, or obj.

If you really want to use your own data structure for storing these mobs, you can, but what you're essentially going to have to do is create and destroy the mobs while saving their information somewhere else, such as a datum you defined.

How?
In response to Prf X
Prf X wrote:
How?

Here's the information on how to create datums.

Once you know that, consider assigning the important stats to a datum and then del the mobs when you recall them while doing a new to create mobs based off of information stored in datums.