ID:142133
 
Code:
mob/demon/verb/Shapeshift(mob/X as mob|obj in oview(9))
set category = "Skills"
if(usr.Freeze==1)
usr<<"Your frozen, you can't use magic"
return
switch(alert(usr,"Shapesift into?","Shapeshift","Shapeshift","Revert"))
if("Shapeshift")
if(usr.Energy <= 0)
usr<<"You don't have the energy for this"
return
var/obj/ranked
if(X.ranked==1)
usr<<"You may not shapeshift into [X] [ranked]"
return
usr.icon = X.icon
usr.Exposing_Magic()
usr.icon_state = X.icon_state
usr<<"You shapeshifted into [X]"
usr.Energy -= 10
usr.name = X.name
if("Revert")
if(usr.Energy <= 0)
usr<<"You don't have the energy for this"
return
if(usr.rank=="The Source")
usr.icon = 'Goodwitchs.dmi'
usr.icon_state = "Source"
if(usr.rank=="Dark Force Cultist")
usr.icon = 'Goodwitchs.dmi'
usr.icon_state = "Source"
if(usr.rank=="Triad")
usr.icon = 'Goodwitchs.dmi'
usr.icon_state = "triad"
if(usr.rank=="Avatar")
usr.icon = 'Goodwitchs.dmi'
usr.icon_state = "Avatar"
return
else
usr.icon = original_icon
usr.name = "What do i put here?"
usr.Energy -= 5
usr.Exposing_Magic()


mob/whitelighter/verb/Glamor(mob/M in view(9))
set category = "Skills"
if(usr.Freeze==1)
usr<<"Your frozen, you can't use magic"
return
switch(alert(usr,"Glamor into?","Glamor","Glamor","Revert"))
if("Glamor")
if(usr.Energy <= 0)
usr<<"You don't have the energy for this"
return
if(M.containhollow==1)
usr.verbs -= new /mob/whitelighter/verb/Glamor
M.verbs += new /mob/whitelighter/verb/Glamor
view(9)<<"[M] has taken [usr]'s power using the hollow"
return
if(M.ranked==1)
usr<<"You may not glamor into [M]"
return
usr.icon = M.icon
usr.icon_state = M.icon_state
usr<<"You glamored into [M]"
usr.Energy -= 10
usr.Exposing_Magic()
if("Revert")
if(usr.Energy <= 0)
usr<<"You don't have the energy for this"
return
if(usr.rank=="Elder")
usr.icon = 'Goodwitchs.dmi'
usr.icon_state = "Elder3"
else
usr.icon = original_icon
usr.name = "WHat do i put here?"
usr.Energy -= 5
usr.Exposing_Magic()


Problem description:
When people change into another person and change back their names are blank. WHat should i put in the marked spot so they can get their original name when they revert?
You can create an original name var etc., or (might not work depending on your situation) use the initial proc.


I strongly suggest reading the DM guide (read the section on boolean vars twice!) and the article I wrote in my blog on modular programming, because frankly, that code is horrible.
In response to Jeff8500
Haha im reading it now

Here is an example that uses the && operator to ensure that both the poker and pokee are dense in a typical poking operation.
mob/verb/poke(mob/M) 
if(density && M.density)
view() << "[usr] pokes [M]!"
else view() << "[usr]'s finger passes through [M]!"

lmao It helped and i'll be using very shortly ^^ Thanks Jeff.
X.name
In response to Quiet Screams
lol Quiet
In response to Jeff8500
Jeff8500 wrote:
You can create an original name var etc., or (might not work depending on your situation) use the initial proc.

initial() won't work, as it sets the variable to its compile-time value. In this case that would be "demon" or "whitelighter".



Monti, if you allowed custom names, you need to create an original_name variable just like you have an original_icon variable. Then, before a player transforms into someone else, set their original_name variable to their name. If you didn't allow custom names, you can just set their name to client.key.