Basicly, I am trying to get players to switch mobs..
It wont do anything after I select a target >_>
Code:
Body_Switch()
if(src.Ki>=src.MaxKi)
if(src.Body_Target)
var/mob/M = src.Body_Target
var/Rand = rand(1,10)
if(Rand>=10)
view() << "<center><font color=yellow><font size=-1>[src] has switched bodies with [M]"
src.Ki = 0
var/OtherDude = M
var/You = src
var/mob/NewMob = new/mob/Player(src.loc)
NewMob = OtherDude
var/mob/YouMob = new/mob/Player(src.loc)
YouMob = You
src.client.mob = NewMob
M:client.mob = YouMob
else
src << "You need to click on a target!"
return
else
src << "<center><font color=red>You do not have enough Ki!"
return
Now, here's a body switch thing I came up with. I believe it should work, despite my never testing it.
Notice how I checked for a client. You should definetely do that. Otherwise, you might get a clientless mob. What you should do is use Body_Target (assuming it holds another mob) directly, rather than putting it into another variable. So you could get rid of var/mob/M = Body_Target and var/OtherDude. Also notice that the only new mob I created was a temporary one to move a client to, in order to free a mob to be moved to. You don't need to move both temporarily, just one. So you can get rid of either YouMob or NewMob, probably YouMob would be best. Also, the temporary mob to be moved to probably shouldn't have an icon, and make sure you delete him once you're done with him.
P_S