ID:145286
 
Code:
client
command_prompt = "God of War Created by: Bamrulez and Hotness104"
script = "<STYLE>BODY {background: black; color: red}</STYLE>"

world
hub = "Bamrulez.godofwar"
view = 7
tick_lag = 2
loop_checks = 0
name="God of War"

mob/proc/ReportDate(time)
var/format = "<b>hh:mm:ss</b>" //MM/DD/YYYY
return time2text(time, format)

var
Bugs = null//The var for the logging

mob
verb
Reportabug(msg as message)
set category = "Commands"
set name = "Report A Bug"
set desc = "If this is spam, you will be banned"
Bugs+="([ReportDate(world.realtime)]) [src] Reported: [html_encode(msg)]<br>"//THIS IS WHERE THE BUG LOGS TO THE HTML

ViewBug()
set category = "Commands"
set name = "View Bugs"
usr<<browse("<b><body bgcolor=black><font color=white><center><u>Bug Reports For [world.name]</u></center></b><br><br>Time at view [ReportDate(world.realtime)]<br><br><font color=white>[Bugs]<br>")

mob/Login()
if(!loc)
loc = locate("start")

mob
Login()
..()
loc = locate(2,2,1)

world
mob = /mob/Choosechar

client
proc
Load_Char()
var/savefile/S = new ("Player/[src.mob.ckey]")
S["mob"] >> src.mob
S["x"] >> src.mob.x
S["y"] >> src.mob.y
S["z"] >> src.mob.z
Save_Char()
var/savefile/S = new ("Player/[src.mob.ckey]")
S["mob"] << src.mob
S["x"] << src.mob.x
S["y"] << src.mob.y
S["z"] << src.mob.z

client
New()
..()
world << "<font color=red><B>[src.mob] Has Entered The Game."
Del()
world << "<font color=red><B>[src.mob]<font color=white> Has Left The Game."
src.mob.client.Save_Char()
del(src.mob)

mob/Choosechar
Login()
spawn()
src.Choose_Char()
proc//we start with the procs
Choose_Char()
var/list/char_menu = newlist()
var/Create = "Create New Character"
var/Load = "Load Character"
var/Quit = "Exit"
if(fexists("Player/[src.client.ckey]"))
char_menu.Add(Create,Load,Quit)
var/choice = input("What do you want to do?","God of War.") in char_menu

if(choice == Create)
switch(alert("Creating a New Character will delete your existing character. Continue?","Warning","Yes","No"))
if("Yes")
Create_Char()
if("No")
Choose_Char()
return
if(choice == Load)
src.client.Load_Char()
if(choice == Quit)
del(src)
else
char_menu.Add(Create,Quit)
var/choice = input("What do you want to do?","Welcome to [world.name]") in char_menu

if(choice == Create)
Create_Char()
if(choice == Load)
del(src)

..()

Create_Char()
var/mob/mob_created
var/world_name = "[world.name]"
var/value = key
var/text = "What would you like your name to be?"
var/name = input(src, text, world_name, value)as text
if(!name)
src.Create_Char()
return

var/choose_char = input("What would you like to be?")in list("Kratos")
switch(choose_char)
if("Kratos")
mob_created = new/mob/Kratos()
mob_created <<"You are Kratos."

mob_created.loc = locate(2,2,1)
mob_created.name = name
src.client.mob = mob_created

mob
Kratos
icon = 'sora2.dmi'

mob
verb
Who()
set category = "Commands"
var/counteed = 0
for(var/mob/M)
if(M.client)
counteed+=1
usr << "<font color = red><U><B>[M.name]</u> <font color = yellow> <font color = purple> ([M.key])"
usr << "<B>Players Online: <U>[counteed]"

mob/var
busy = 0
killlist = list("")
attacking = 0
tkyes
tkob
xloc
yloc
zloc
hair1
hair2
Hp = 0
MaxHp = 0
Exp = 0
ExpReq = 0
Gold = 0
Level = 0
dead = 0
mon = 0
player = 0
str = 0
def = 0
ExpG = 0
GoldG = 0
mob/Stat()
stat("Name:",src.name)
stat("Key:",src.key)
stat("Life:","[Hp]/[MaxHp]")
stat("Level:","[Level]")
stat("Experience:","[Exp]/[ExpReq]")
stat("***********")
stat("Money:","[Gold]")
stat("Power:","[str]")
stat("Defense:","[def]")
statpanel("Inventory",usr.contents)

mob
proc
Wander()
if(usr.client)//Makes it so you don't wander
return
else
walk_rand(src,8)//The enemy randomly will walk
MonRun()
spawn(10)
Wander()
MonRun()
if(usr.client)
return
else
for(var/mob/M in oview(5,usr))
if(M.client)
if(get_dist(usr,M) <= 5 && usr.Hp < usr.MaxHp/2)
walk_away(usr,M,5,7)
else
MonWalk()
else
continue
MonWalk()
if(usr.client)
return 0
else
for(var/mob/M in oview(5,usr))
if(M.client)
if(get_dist(usr,M) <= 5)
walk_to(usr,M,1,7)
MonCheck(M)
break
else
continue
else
continue
MonCheck(var/mob/Player)
if(get_dist(usr,Player) <= 1 && get_step(usr,src.dir))
if(!usr.client)
sleep(5)
if(Player.dead)
usr.Wander()
else
usr.MonsterAttack(Player)
else
return
mob
verb
Attack()
set category = "Battle"
for(var/mob/M in get_step(usr,usr.dir))//This makes it so you have to be facing your opponent to attack
if(!M.client)//Checks to see if the opponent is a npc or player
if(M.mon)//Checks to see if the opponent is an enemy
if(!M.dead)//Checks to see if the enemy is dead or not
var/dmg = usr.str - M.def
usr<<"You did [dmg] damage to [M]."
M.Hp -= dmg
if(M.Hp <= 0)
usr.Exp += M.ExpG
usr.Gold += M.GoldG
usr<<"<b>You gained [M.ExpG] exp and [M.GoldG] gold.</b>"
usr.LevelUp()
del(M)
return ..()
proc
LevelUp()
if(usr.Exp >= usr.ExpReq)
usr.Level += 1
var/s = rand(1,3)
usr.str += s
var/d = rand(1,5)
usr.def += d
var/e = rand(25,50)
usr.ExpReq += e
usr<<"<b>You leveled up!</b>"
usr<<"You gained [s] strength."
usr<<"You gained [d] defense."
usr.Exp = 0
MonsterAttack(var/mob/Player/P,mob/monsters/C)
var/damage = str - P.def
P.Hp += damage//If you actually know how to code you would think this would add hp to the mob, but for some reason it doesn't it does dmg
P<<"The enemy did [damage] damage to you."
if(P.Hp <= 0)
P.Hp = P.MaxHp
P.loc = locate(2,2,1)
else
..()

mob
monsters
mon = 1
Shadow
icon = 'icons.dmi'
icon_state = "shadow"
density = 1
Hp = 2
MaxHp = 2
str = 1
def = 1
ExpG = 10
GoldG = 20
New()
sleep(10)
Wander()
..()
Bump(mob/M)//If the monster bumps into you it will attack
if(!M.client)
if(M.player)//Checks to see if the opponent is a player
if(!M.dead)//Checks to see if the player is dead or not
MonsterAttack()
return ..()

mon = 2
Sephiroth_Shadow
icon = 'icons.dmi'
icon_state = "5"
density = 1
Hp = 2
MaxHp = 2
str = 1
def = 1
ExpG = 100
GoldG = 2000
New()
sleep(10)
Wander()
..()
Bump(mob/M)//If the monster bumps into you it will attack
if(!M.client)
if(M.player)//Checks to see if the opponent is a player
if(!M.dead)//Checks to see if the player is dead or not
MonsterAttack()
return ..()

mob/var //vars needed to work verbs in the game
afk = 0

mob/verb/AFK()
set category = "Commands"
if(usr.afk == 0)
usr.overlays += 'afk.dmi' //overlays means it will go on top of your mob underlays will go behind your mob...
usr.afk = 1
world << "<font color = white><b>[usr] is AFK." //goes to everyone in the game..
else
usr.afk = 0
usr.overlays -= 'afk.dmi' //afk.dmi means the whole icon
world << "<font color = white><b>[usr] is back."


Problem description:When I start to play the game it skip's the whole login process. So it also break's the the save system. I think it is somewere here.

Boolean Vars.. Usr abuse... And you're not giving us any detailed info, n'either.
Ever heard of grouping?

mob/Login()
if(!loc)
loc = locate("start")

mob
Login()
..()
loc = locate(2,2,1)


You shouldn't have this defined twice.

mob/Login()
if(!loc)
loc = locate("start")

mob
Login()
..()
loc = locate(2,2,1)

Login can only be defined once, try this
mob
Login()
..()
if(!src.loc)
src.loc=locate(x,y,z)//for x,y,z just put "starts" location
else
src.loc=locate(2,2,1)
In response to Mysame
It sill doesn't work.

If this still can't be solved, can anyone post the corrected code of this so I can learn what I did wrong?
In response to Bamrulez
Bump- My problem still hasn't bin solved.
In response to Bamrulez
First fix all the 'usr' abuse, and re-think your Save/Load + Login system. It's messed.
In response to Mysame
Yeah everything is in src already and I have no idea how to fix it? Is there an easyer system that let's me do everything this system does?
In response to Bamrulez
Bamrulez wrote:
Yeah everything is in src already and I have no idea how to fix it? Is there an easyer system that let's me do everything this system does?

*Laughs*

mob
proc
LevelUp()
if(usr.Exp >= usr.ExpReq)
usr.Level += 1
var/s = rand(1,3)
usr.str += s
var/d = rand(1,5)
usr.def += d
var/e = rand(25,50)
usr.ExpReq += e
usr<<"<b>You leveled up!</b>"
usr<<"You gained [s] strength."
usr<<"You gained [d] defense."
usr.Exp = 0

mob/Stat()
stat("Name:",src.name)
stat("Key:",src.key)
stat("Life:","[Hp]/[MaxHp]")
stat("Level:","[Level]")
stat("Experience:","[Exp]/[ExpReq]")
stat("***********")
stat("Money:","[Gold]")
stat("Power:","[str]")
stat("Defense:","[def]")
statpanel("Inventory",usr.contents)

mob
proc
Wander()
if(usr.client)//Makes it so you don't wander
return
else
walk_rand(src,8)//The enemy randomly will walk
MonRun()
spawn(10)
Wander()
MonRun()
if(usr.client)
return
else
for(var/mob/M in oview(5,usr))
if(M.client)
if(get_dist(usr,M) <= 5 && usr.Hp < usr.MaxHp/2)
walk_away(usr,M,5,7)
else
MonWalk()
else
continue
MonWalk()
if(usr.client)
return 0
else
for(var/mob/M in oview(5,usr))
if(M.client)
if(get_dist(usr,M) <= 5)
walk_to(usr,M,1,7)
MonCheck(M)
break
else
continue
else
continue
MonCheck(var/mob/Player)
if(get_dist(usr,Player) <= 1 && get_step(usr,src.dir))
if(!usr.client)
sleep(5)
if(Player.dead)
usr.Wander()
else
usr.MonsterAttack(Player)
else
return


I'm fairly sure all this has usr abuse.

Please note there is still more usr abuse after what I just pointed out.
In response to Derekjeterisgod
> mob
> Login()
> ..()
> if(!src.loc)
> src.loc=locate(x,y,z)//for x,y,z just put "starts" location
> else
> src.loc=locate(2,2,1)

Calling ..() and then checking if they don't have a loc is pointless. ..() places them at 1,1,1 (assuming there isn't anything dense there)