ID:1077010
 
Keywords: client, horse, transform
(See the best response by Stephen001.)
Code:
client
var/player/old_mob

player
var/morphed = FALSE
proc
antelope_morph(player/p)
world << "<font color = red> called MORPH!"
client.old_mob = src //save_mob
client.mob = new /player/antelope_horse(src.loc) //become horse
morphed = TRUE

un_morph(player/p)
client.mob = client.old_mob //switch back
morphed = FALSE

antelope_horse
icon = 'ant_horse.dmi'

New()
world << "testing"
..()

///////////////////// Attack Trigger /////////////
combat
proc
ATTACK3(player/p)

antelope_warrior
ATTACK3(player/p)
if(p.morphed) p.un_morph(p) // morph toggle
else
p.meter = new /meter(p) // new meter
p.meter.load(1) // load_time
if(p.meter) //if meter isnt null
if( p.meter.finished == TRUE ) //if loading is finished
p.antelope_morph(p) //transform
del p.meter

///////////////////// Login Stuff /////////////
temporary
parent_type = /mob
Login() //When theres no game in progress
..()
loc = null
HOST_CHECK()
if(!game_started) src<<"<i>There is currently no game in progress!</i>"
else src<<"<i>There is a game in progress!</i>"

player
Login() //Joined game in progress
.=..()
loc = null
name = key

antelope_warrior
icon = 'antelope.dmi'
Login() //For picked Class
.=..()
CLASS_SELECTION(src)
hotbar = new;
hotbar.icon = 'hud1.png'
src.client.screen += hotbar;
world << "antelope test"
attack_scheme = a_warrior

mob/Logout()
del src
..()


Problem description:
I am trying to transform into a horse. Problem is my screen becomes black after execution. Rending me clueless. Heh, I guess byond client stuff is no joke >.>
Your Login proc sets you loc to null.
Best response
Problem description:
I am trying to transform into a horse.

This got into the summary text of the post also, and I won't lie, it gave me a good chuckle.

Basically it's as Jemai1 states, your Login() procedure is setting your location to null (off the map entirely, in mysts of BYOND), hence your map display is black. What might not be entirely obvious on first read, is why your procedure is doing this or why it's called. If you just looked at your code supplied, you'd be inclined to say "Well, nothing there sets my location to null, I don't have a Login() for antelope_horse", and in a way, you're right. However DM will call the parent version of procedure. In this case, it calls player/Login(), and in player/Login() we have:

player
Login() //Joined game in progress
.=..()
loc = null
name = key


Where, the location is set to null. So who-ever (in terms of clients / real people sat at a PC) is controlling the antelope is now off the map.

This whole process of calling Login() is triggered by:

client.mob = new /player/antelope_horse(src.loc)    //become horse


As setting client.mob to a new value will make that client call Login() on that new value, to set itself up after having gained control etc.

A solution would be to set the location of the horse after that line, like so:

client.mob = new /player/antelope_horse(src.loc)    //become horse
client.mob.loc = p.loc // Place us back where we were before.


A more preferable solution, would be to re-work your player/Login() procedure, as it should not need to force setting the player's location off the map. It's doing that in an attempt to override existing behaviour in mob/Login(), where things with no location (like newly connected clients) are placed into (1,1,1) of the map.

On initial login, your mob will not have a location set, as such:

player
Login() //Joined game in progress
var/atom/existing_loc = loc
..()
loc = existing_loc
name = key


And then, you don't need to set the location elsewhere, as shown above. Mobs such as the horse you've created, you give a location (src.loc) and so, when Login() is called, loc is set to a non-null value, and can be maintained. On an actual connection by a new player, it's null, and remains null.

At least, that's the idea.
This actually helped me with an issue I was having last night. Great job explaining, Stephen!
Awesome post Stephen. I used the last method. I actually had trouble trying to transform back into a human but i figured it out. (it only took me 2 hours >.> lol)