Full Code:
//This is a test world created by Gameiro on the 20 of february of 2015.
/*
These are simple defaults for your project.
*/
world
fps = 25 // 25 frames per second
icon_size = 32 // 32x32 icon size by default
view = 6 // show up to 6 tiles outward from center (13x13 view)
name="Tutorial"
mob=/mob/Player
mob/Player
icon='person.dmi'
icon_state="male"
// Make objects move 8 pixels per tick when walking
mob
step_size = 8
obj
step_size = 8
mob
mob/Enemies
Red_Guy
icon='Enemy1.dmi'
Level=1
Exp=5
MaxHP=100
Str=10
Def=5
Green_Guy
icon='Enemy2.dmi'
Level=2
Exp=10
MaxHP=150
Str=11
Def=6
mob/Enemies/New()
src.HP=src.MaxHP
spawn(-1) src.CombatAI()
return ..()
Nexp=100
mob/Enemies/proc/CombatAI()
while(src)
for(var/mob/Player/M in oview())
if(get_dist(src,M)<=1)
src.dir=get_dir(src,M)
src.Attack()
else
step_to(src,M)
break
sleep(rand(4,8))
mob/Stat()
statpanel("[src]'s Stats")
stat("Level:","[src.Level]")
stat("EXP:","[src.Exp]/[src.Nexp]")
stat("Health:","[src.HP]/[src.MaxHP]")
stat("Strength:","[src.Str]")
stat("Defense:","[src.Def]")
statpanel("Another Tab")
stat("???")
mob/proc/SaveProc()
var/FileName="Players/[ckey(src.key)].sav"
if(fexists(FileName)) fdel(FileName)
var/savefile/F=new(FileName)
F["Level"]<<src.Level
F["Exp"]<<src.Exp
F["Nexp"]<<src.Nexp
F["HP"]<<src.HP
F["MaxHP"]<<src.MaxHP
F["Str"]<<src.Str
F["Def"]<<src.Def
F["LastX"]<<src.x
F["LastY"]<<src.y
F["LastZ"]<<src.z
src<<"Character Saved..."
mob/proc/LoadProc()
var/FileName="Players/[ckey(src.key)].sav"
if(fexists(FileName))
var/savefile/F=new(FileName)
F["Level"]>>src.Level
F["Exp"]>>src.Exp
F["Nexp"]>>src.Nexp
F["HP"]>>src.HP
F["MaxHP"]>>src.MaxHP
F["Str"]>>src.Str
F["Def"]>>src.Def
src.loc=locate(F["LastX"],F["LastY"],F["LastZ"])
src<<"Character Loaded..."
return 1
var
HP=100
MaxHP=100
Str=10
Def=5
Wealth = 0
Level=1
Exp=0
Del() //create a new obj from the gold blueprint
obj/gold/G = new(loc)
G.amount = rand(1,100) //set its amount variable randomly
..() //call the parent
Login()
if(src.LoadProc())
world<<"[src] has Returned"
else
src.loc=locate(1,1,1)
world << "[usr] has logged in!" //tells the world someone logged in
Logout()
world<<"[src] has logged out"
src.SaveProc()
del src
proc
LevelCheck()
if(src.Exp>=src.Nexp)
src.Exp=0
src.Nexp+=10
src.Level+=1
src.MaxHP+=rand(1,5)
src.Str+=1
src.Def+=1
src<<"You are now Level [src.Level]"
TakeDamage(var/Damage,var/mob/Attacker)
src.HP-=Damage
src.DeathCheck(Attacker)
DeathCheck(var/mob/Killer)
if(src.HP<=0)
if(src.client)
world<<"[Killer] Killed [src]!"
src.HP=src.MaxHP
src.loc=locate(1,1,1)
else
Killer<<"<b>You Killed [src] for [src.Exp] Exp"
Killer.Exp+=src.Exp
Killer.LevelCheck()
del src
verb
Attack()
flick("Attack",src)
for(var/mob/M in get_step(src,src.dir))
var/Damage=max(0,src.Str-M.Def)
view(M)<<"[src] hit [M] for [Damage] Damage!"
M.TakeDamage(Damage,src)
Test_Leveling()
usr.Exp+=100
usr.LevelCheck()
Your_Wealth()
usr << "You have [usr.wealth] gold"
Say(msg as text) //what the usr says is passed into "msg" as text
world << "[usr]: [msg]" //the world sees chatroom-like output
Save()
src.SaveProc()
obj
gold
icon = 'gold.dmi'
var
amount = 0
verb
Get() //obj/gold/verb/get()
set src in view(1) //src must be close
usr << "You pick up [amount] gold."
usr.wealth += amount //add to usr.wealth
del(src) //delete the gold
turf
grass //define a "grass" prototype, which is a kind of turf...
icon = 'grass.dmi' //that has an icon named 'grass.dmi'. In single quotes!
tree
icon = 'tree.dmi'
density=1
opacity=1
areiachao
icon = 'areiachao.dmi'
world //set one of our world's characteristics:
turf = /turf/grass //its default turf is the grass turf.
The problem i'm having is
TestingWorld.dm:117:error: proc definition not allowed inside another proc
Line 117 is "obj/gold/G = new(loc)"
so yeah, i need help.