ID:166117
 
how do i make it so when ur a character of a certain class dies you spawn but as a different class
add usr.Death() proc to the verb that kills him

then add a Death Proc

mob
proc
Death()
switch(input("Choose new class Bitch?","?Ho?",text) in list ("Ninja","Bitch","Ho"))
if("Ninja")
usr.class = "Ninja"
usr.icon = 'Ninja.dmi'
usr.loc=locate(/turf/ninjastart/)
if("Bitch")
usr.class = "Bitch"
usr.icon = 'Bitch.dmi'
usr.loc=locate(/turf/bitchstart/)
if("Ho")
usr.class = "Ho"
usr.icon = 'Ho.dmi'
usr.loc=locate(/turf/Hostart/)
else
return
In response to Black Ice Inc.
lol funny classes
In response to Tim49ers
should use src instead of usr <.<
In response to Black Ice Inc.
1. You should use the <DM> tags; they help.
2. Assume it's implemented like this. What happens if the player logs out? The procedure will return, the mob (probably) gone. Might cause some havoc when the player logs back in later and finds his character is semi-dead.
3. Consider not putting curse words in your code (unless it's a swear filter. =P), as they're disallowed on these forums.
mob
proc
DeathClass()
src.random=rand(1,3)
if(src.random == 1)
src<<"You are now race here"
if(src.random == 2)
src<<"Moo cow"
if(src.random == 3)
src<<"Baaaa"
In response to Rickoshay
mob/proc/DeathClass()
ASSERT(client) //crash if there's no client; we need one to switch mobs
switch(rand(1,3))
if(1)
client.mob=new/mob/human
if(2)
client.mob=new/mob/slave
if(3)
client.mob=new/mob/alien/elvis
else CRASH("rand() is malfunctioning in DeathClass() on [__FILE__]:[__LINE__]") //I don't know if the macros are spelled correctly
del src
In response to Android Data
Gah! <_<

I thought for sure you'd break the if() switches. Simply use a list to record all of the classes minus the class the person just was, and use that list for a random class picking.

mob/proc/DeathClass()
ASSERT(client) //I'd have taken this out, but hey, you shouldn't \
be sending mobs with no client to this anyway

var/list/L=list(/mob/class/Elf,/mob/class/Genie)
if(src.type in L) L-=src.type
var/typ = pick(arglist(L)) //Just in case pick() doesn't accept lists, \
use arglist It's been a while.

ASSERT(ispath(typ)) //We have a problem here if typ is not a valid path.
client.mob=new pick(arglist(L))


To make it even easier to use, and more robust I might add, you can make typesof(/mob/class)-/mob/class the value of L so you don't have to retype something into the list everytime you add a class. I use -/mob/class at the end of it because typesof() includes the path you specify and every path under it.