ID:175902
 
I want it so when you die you goto location 1,1,1 but when i die i log out but my bro edited that now its screwed up help me fix it and so you dont kill yourself when you attack someone heres the coding







world
area = /area/BG
name = "Tides of Destiny"
view = 5
#include
client
base_num_characters_allowed = 5
client


world
mob = /mob/create_character
mob/create_character
var/mob/character

Login()
var/charactername = input("Please write your name here.","Name?",src.key)
switch(input("Who do you want to be?.","Charaters?") in list("Male","Female"))
if ("Male")
character = new /mob/characters/Male()
if ("Female")
character = new /mob/characters/Female()
character.name = charactername
src.client.mob = character




mob/characters/Male
icon = 'boy.dmi'
icon_state="walking"


mob/characters/Female
icon = 'girl.dmi'
icon_state="walking"

mob/characters/Male
icon = 'boy.dmi'
icon_state="walking"
health = 10
maxhealth = 10
exp = 0
level = 0
defense = 5
attack = 5
expgive = 4
maxmagic = 10
magic = 10
magicstrenght = 5
magicdefense = 1
magicstrenght = 5
maxexp = 8

mob/characters/Female
icon = 'girl.dmi'
icon_state="walking"
health = 10
maxhealth = 10
exp = 0
level = 0
defense = 5
attack = 5
expgive = 4
maxmagic = 10
magic = 10
magicstrenght = 5
magicdefense = 1
magicstrenght = 5
maxexp = 8

mob/Login()
usr << sound("BoFT2.mid",1)
usr.loc = locate(1,1,1)
world<< "[usr] Logs in"


mob/Logout()
world<< "[usr] Logs out"
del(src)









mob/verb/attack(mob/M in oview(1))
flick("attack",usr)
damage = usr.attack
damage -= M.defense
if(istype(M,/mob/npc)||istype(M,/mob/npc))
return
if(istype(M,/obj/AirshipF)||istype(M,/obj/AirshipF))
return
if(damage<1) damage = 1
M.health -= damage
usr << "You hit [M] for [damage] damage"
if(M.health <= 0)
if(M.monster == 1)
usr.exp += M.expgive
var/obj/gold/gp = new(M.loc)
gp.amount = M.goldgive
usr.levelup()
del(M)
else
usr.exp += M.expgive
var/obj/gold/gp = new(M.loc)
gp.amount = M.goldgive
usr.levelup()
usr.loc = locate(1,1,1)
mob/var/monster = 0
mob
Skeleton
icon = 'enemies.dmi'
icon_state = "skeleton"
monster = 1
attack = 5
defense = 15
health = 25
expgive = 2
magicdefense = 4
goldgive = 5

mob
Desert_Snake
icon = 'enemies.dmi'
icon_state = "Desert Snake"
monster = 1
attack = 20
defense = 40
health = 70
expgive = 10
magicdefense = 15
goldgive = 20

mob
Snake
icon = 'enemies.dmi'
icon_state = "Snake"
monster = 1
attack = 50
defense = 100
health = 300
expgive = 50
magicdefense = 50
goldgive = 100

mob
Poison_Snake
icon = 'enemies.dmi'
icon_state = "Poison Snake"
monster = 1
attack = 100
defense = 70
health = 150
expgive = 25
magicdefense = 30
goldgive = 50





var/damage
mob
var
health = 0
maxhealth = 0
attack = 0
defense = 0
exp = 0
maxexp = 0
expgive = 0
goldgive = 0
level = 0
magic = 0
maxmagic = 00
magicdefense = 0
magicstrenght = 0
equiped
equiped2
equiped3
equiped4
obj
var
attackadd
equiped
defadd
equiped2
ring
equiped3
hpadd
magicadd
maxmagicadd
mob/proc/Death()
if(src.health<= 0)
src << "You died"
src.health = src.maxhealth
src.loc = locate(1,1,1)
else ..()
mob/proc/levelup()
if(src.exp >= src.maxexp)
usr << "LEVEL UP!"
src.maxexp = round(maxexp*1.5)
src.attack += 3
src.defense += 3
src.maxhealth += 5
src.level += 1
src.expgive += 2
src.magic += 5
src.maxmagic +=5
src.magicdefense += 1
src.magicstrenght += 1

//then after every thing is done
levelup() // this will call it back to see if it need another level
else
..()
mob
Stat()
..()
statpanel("Stats")
stat("Health","[health]/[maxhealth]")
stat("Magic","[magic]/[maxmagic]")
stat("Strength","[attack]")
stat("Defense","[defense]")
stat("Magic Strenght","[magicstrenght]")
stat("Magic Defense","[magicdefense]")
stat("Exp","[exp]/[maxexp]")
stat("Level","[level]")
stat("Gold:",gold)
statpanel("Items",contents)











</1>
</<>
This is way too much code for one post, particularly when you just need one little thing. And don't expect people to code your game for you; in fact what you asked for is simple enough that you ought to be able to find it by searching the forum yourself.

And don't put usr in procs.

Lummox JR
In response to Lummox JR
I know its simple but for some reason if i edit it my game wont work. Thats why I posted so much there's something in the coding affecting the login code!
In response to Sonder
Sonder wrote:
I know its simple but for some reason if i edit it my game wont work. Thats why I posted so much there's something in the coding affecting the login code!

Then why didn't you just post the login code?

Actually the problem (well, one problem; maybe not the only one) in your login is quite easy to see: As I told you, don't put usr in procs.

In Login(), usr is semi-safe at best. It's safe only if the proc is only ever called directly by a client when a player first joins the game. Thus in mob/create_character/Login(), usr is all right. But then it assigns a new mob to the client, which means mob/Login() is called for the new mob, and it has the same value of usr it did before--which means usr is the old mob.

This is why you should use src in Login().

Lummox JR
In response to Lummox JR
Thanks for your help, it is fixed now.