ID:147471
 
when they click on this in the loading screen, they become the character/mob, but none of the attributes or anything work, why is it doing this?


mob/Mage
icon = 'Mage.dmi'
Click()
usr.icon = 'Mage.dmi'
usr.race = "Magic-User"
usr.loc = locate(1,1,1)
HP = 60
Max_HP = 60
strength = 9
exp = 0
exp_give = 0
verb
Attack(mob/M in oview(1,src))
if(M != null)
var/damage = rand(1,strength)
src << "You attack [M]!"
src << "[damage] damage!"
M << "[src] attacks you!"
M << "[damage] damage!"
M.HP -= damage
characterDeath()
> mob/Mage
> icon = 'Mage.dmi'
> Click()
> usr.icon = 'Mage.dmi'
> usr.race = "Magic-User"
> usr.loc = locate(1,1,1)
> HP = 60
> Max_HP = 60
> strength = 9
> exp = 0
> exp_give = 0
I'm gonna assume that by clicking this Mage, you assign the player's stats, and by making that assumption, I see a few problems.

First, when no reference is made, it automatically defaults to src, which in this case is the character itself and not the player. This would work:
>       usr.icon = 'Mage.dmi'
because there is a reference to a player, usr. This however:
>       HP = 60
assigns 60 HP to src, which is the character itself, because usr is not specified.

Also, why make a different "Attack" verb for every character, as I've assume you've done by looking at this one snippet?

I also see another problem; It looks as if you're defining the playable character Mage as well as attempting to assign variables to usr at the same time.
<dm>
mob
Mage
icon = 'Mage.dmi'
race = "Magic-User"
HP = 60
Max_HP = 60
strength = 9
exp = 0
exp_give = 0
Click()
AssignStats(usr,src)
verb
Attack(mob/M in oview(1,src))
if(M != null)
var/damage = rand(1,strength)
src << "You attack [M]!"
src << "[damage] damage!"
M << "[src] attacks you!"
M << "[damage] damage!"
M.HP -= damage
characterDeath()
proc
AssignStats(var/mob/player,var/mob/character)
player.icon = character.icon
player.icon_state = character.icon_state
player.race = character.race
player.HP = character.HP
player.Max_HP = character.Max_HP
player.strength = character.strength
player.exp = character.exp
player.exp_give = character.exp_give
player.loc = locate(1,1,1)
In response to Enigmaster2002 (#1)
thank you so much but when i try to use the same code that is for the necro on other characters(what rpg has 1 character) it tells me i have a duplicate definition