ID:146271
 
Code:
world
name = ("Dragonball Blitz")
view = 6
loop_checks=0
hub = "CYN.DragonballBlitzRevamped "

client
script = "<STYLE>BODY {background: black; color: white}</STYLE>"

world
mob = /mob/create_character
mob/create_character
var/mob/character
Login()
var/charactername = input("What do you want to be called?","Character Name:",src.key)
switch(input("What race do you wish to be?","Race?") in list("Saiyan","Human"))
if ("Saiyan")
character = new /mob/characters/Saiyan()
if ("Human")
character = new /mob/characters/Human()
character.name = charactername
src.client.mob = character
var/turf/first_location = locate(1,1,1)
src.loc = first_location
del(src)
..()

mob/characters/Saiyan
icon = 'SaiyanBase.dmi'
icon_state = "Norm"

mob/characters/Human
icon = 'SaiyanBase.dmi'
icon_state = "Norm"

mob
verb
Say(msg as text)
set category = "Communication"
view(6) << "<font color = blue><B><i>[usr]:</i></B></font><font color = white><i>[msg]"
World_Say(msg as text)
set category = "Communication"
world << "<font color = green><b><i>OOC</font><font color = yellow><b><i> [usr]:</font></b><i><font color = green> [msg]"
mob
verb
Attack(mob/M as mob in oview(1))
var/damage = usr.Strength*2 - M.Defense*3
if(damage <= 0)
usr << "[M] easily dodges your attack!"
M << "You easily dodge [usr]'s attack."
sleep(20)
else
M.PL -= damage
view() << "[usr] attacks [M] for [damage] HP!"
M:deathcheck()

mob
proc
deathcheck()
if(src.PL <= 0)
view() << "[src] dies!"
src.PL = MaxPL
src.Move(locate(5,5,1))

mob/Logout()
del(src)

client/proc/SaveMob()
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")
var/char_ckey = cKey(src.mob.name)
F["/[ckey]/[char_ckey]"]<<src.mob

client/proc/LoadMob(char_ckey)
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")
F["/[ckey]/[char_ckey]"]>>src.mob

client/Del()
if (istype(src.mob, /mob/create_character))
return ..()

src.SaveMob()
return ..()

mob
Login()
..()
if (!istype(src, /mob/create_character))
sample_report()
world << "<B><font color = yellow>Event:</font><font color = green> [src] has logged in!"
if(src.PL > src.MaxPL)
src.PL = src.MaxPL

Write(savefile/F)
..()

F["last_x"] << x
F["last_y"] << y
F["last_z"] << z

Read(savefile/F)
..()

var/last_x
var/last_y
var/last_z
F["last_x"] >> last_x
F["last_y"] >> last_y
F["last_z"] >> last_z
loc = locate(last_x, last_y, last_z)
proc
sample_report()
src << browse("<font face=Courier><Center><STYLE>BODY {background: black; color: yellow}</STYLE><B>Welcome to Dragonball Blitz Revamped!</b>
client
verb
Save()
set category = "Communication"
SaveMob()
usr << "Saving Character..."
sleep(10)
usr << "Save Complete"

mob
Stat()
statpanel("Stats")
stat("[src]")
stat("Powerlevel:","[PL]/[MaxPL]")
stat("Ki:","[Ki]/[MaxKi]")
stat("Stamina:","[Stamina]%")
stat("Strength:","[Strength]")
stat("Defense:","[Defense]")
stat("Zenni:","[Zenni]")

mob
var
PL = 100
MaxPL = 100
Ki = 10
MaxKi = 10
Strength = 50
Defense = 25
Stamina = 100
Zenni = 0
MaxStamina = 100


Problem description: I cant get it to save the characters i create

At the Save() verb, instead of SaveMob(), do src.client.SaveMob(). That might help you.

Like This:

client
verb
Save()
set category = "Communication"
src.client.SaveMob()
usr << "Saving Character..."
sleep(10)
usr << "Save Complete"
In response to Killerdragon
i just tried that and got this error login.dm:120:error:src.client.SaveMob:undefined var
In response to CYN
Okay, then change the src to usr. It should look like this:

usr.client.SaveMob()

If that doesn't work, then I am very, very sorry and I hope that somebody else can help you out.
In response to Killerdragon
well now it compiles smoothly but doesn't save


and i just realized a new problem, when i log in it doesnt take me to the turf i specified.
In response to Killerdragon
Killerdragon wrote:
At the Save() verb, instead of SaveMob(), do src.client.SaveMob(). That might help you.

Like This:

> client
> verb
> Save()
> set category = "Communication"
> src.client.SaveMob()
> usr << "Saving Character..."
> sleep(10)
> usr << "Save Complete"
>
clients dont have a client variable
so..
<dm>
src.client.Savemob

is wrong.