ID:151176
 
How do I change wich mob a player is controlling?
It has to be done during run-time.
On 2/24/01 4:01 am Kaidorin wrote:
How do I change wich mob a player is controlling?
It has to be done during run-time.

Just set the 'key' var of the mob you want them to control to the 'key' var of the mob the player currently controls.

For example,

var/mob/M = new
M.key = usr.key

this will create a new mob, then transfer the user into it.


If you want a verb for it, here's one:

mob/GM/verb/assimilate(mob/M)
if(!M.key)
M.key = usr.key
else
usr << "You can't take over PC's... that's just mean!"



You could even expand it a little to allow a player to switch between one of four mobs at will...

var/mob/A = new (locate(1,1,1))
var/mob/B = new (locate(3,3,1))
var/mob/C = new (locate(1,3,1))
var/mob/D = new (locate(3,1,1))

mob/player/Login()
A.key = src.key //switch to the "A" mob
del(src) //delete the client-less "player"

mob/A/verb
B()
B.key = src.key
C()
C.key = src.key
D()
D.key = src.key

mob/B/verb
A()
A.key = src.key
C()
C.key = src.key
D()
D.key = src.key

mob/C/verb
A()
A.key = src.key
B()
B.key = src.key
D()
D.key = src.key

mob/D/verb
A()
A.key = src.key
B()
B.key = src.key
C()
C.key = src.key
In response to Spuzzum
this will allow me to have 4 different mobs on the map at the same time and let the user transfer between them at will?

just checking
In response to Kaidorin
On 2/24/01 5:02 am Kaidorin wrote:
this will allow me to have 4 different mobs on the map at the same time and let the user transfer between them at will?

just checking

Indeed it will!