ID:143580
 
Code:Level Up and Spell Level Up
> > mob
> > var/list/spells
> > ...
> > New()
> > ..()
> > spells=list() // this is a list of spells you can learn at different levels
> > var/list/level_learned_spells=list(
> > "Wind"=3, // learn "Heal" at level 3
> > "Water"=5, // learn "Fire" at level 5
> > "Earth"=10) // learn "Maim" at level 10
> > ...
> > proc/LevelUp()
> > ++level
> > src << "Welcome to level [level]."
> > for(var/thespell in level_learned_spells)
> > if(level>=level_learned_spells[thespell])
> > if(!(thespell in spells))
> > src << "You learn the [thespell] spell."
> > spells+=thespell
> >
> >
> > mob
> > proc
> > Levelup()
> > if(src.exp>=src.maxexp)//If your exp var equals, or passes your maxexp var
> > src.level++//Add to your level
> > src.exp=0//resets your exp to 0
> > src.maxexp*=2//makes your maxexp double
> > src<<"You gained a level!"
> > src.Statup()
> > else
> > ..()//defaults if the if() doesn't return it's arguments
> > mob
> > proc
> > Statup()
> > src.maxhealth+=20//adds to your health
> > src.health=src.maxhealth
> > src<<"Your stats increase!"//Outputs a message telling you that you gained stats
> >
> > var
> > health = 100//Makes a var called health and gives it the value 100
> > maxhealth = 100
> > exp = 0
> > maxexp = 1000
> > level = 1
> >
> > mob
> > Stat()//Calls the stat proc.
> > ..()
> > statpanel("Stats")//Makes a new statpanel called "Stats"
> > stat("Health","[health]/[maxhealth]")
> > stat("Experience","[exp]/[maxexp]")//Creates a new stat called "Experience" and gives it the value of "exp/maxexp"
> > stat("Level",level)
> > stat("Magic level",level)
> > statpanel("Equipment")
> > statpanel("Inventory",contents)
> > statpanel("Spells",contents)
> >
> > mob/proc/attack(mob/M)//This will be used to make the demo challenging
> > var/damage = rand(1,15)//a bit of damage never hurt..wait, yes it does!
> > M<<"[src] attacked you for [damage] damage!"
> > if(src.client)
> > src<<"You attacked [M] for [damage] damage!"
> > M.health-=damage
> > src.deathcheck(M)
> > if(src.client)//Only players can gain levels
> > src.exp+=rand(50,300)//adds random exp points
> > src.Levelup()//calls the levelup proc
> > else
> > return..()//normal action
> > mob/proc/deathcheck(mob/M as mob)//handles death
> > if(M.health<=0)//checks health
> > if(M.client)//if is a player
> > M.loc = locate(1,1,1)//restarts
> > M.health = M.maxhealth//resets health
> > M<<"[src] killed you!"//tells you, you were killed.
> >
> > else//not a player
> > src<<"You killed [M]!"//Tells you who you killed
> > M.loc = locate(rand(1,world.maxx),rand(1,world.maxy),rand(1,world.maxz))
> > //random location after death
> >
> >
> > mob/NPC//Defines a /mob/NPC
> > icon = 'icons.dmi'
> > icon_state = "npc"
> > health = 200//different health than the main mob
> > Click()//When clicked
> > usr.attack(src)//attack!
> > proc/move()//Now, this proc handles NPC movement
> > for(var/mob/M in oview())//loops over all mobs in view
> > if(get_step_away(src,M,3))//checks distance
> > if(!M.client)//Not a player
> > continue//continues through the loop
> > else//Player
> > walk_to(src,M,1,2)//Move to the person
> > else//4-or-more spaces away
> > continue
> > spawn(20) move()//loops the proc after 2 seconds
> >
> > proc/attackplayer()//Handles attacking
> > for(var/mob/M in oview(1))//Within one space this time
> > if(get_step_away(src,M,1))
> > if(!M.client)
> > continue
> > else
> > src.attack(M)//Calls the attack proc
> > else
> > return..()
> > spawn(20) attackplayer()
> >
> > New()//When created
> > attackplayer()//Calls the procs for it
> > move()
> >


Problem description:I can't get the spells to come up in the spell tab


Your problem lies in this section of your code
mob
Stat()//Calls the stat proc.
..()
statpanel("Stats")//Makes a new statpanel called "Stats"
stat("Health","[health]/[maxhealth]")
stat("Experience","[exp]/[maxexp]")//Creates a new stat called "Experience" and gives it the value of "exp/maxexp"
stat("Level",level)
stat("Magic level",level)
statpanel("Equipment")
statpanel("Inventory",contents)
statpanel("Spells",contents)


replace
statpanel("Spells",contents)
with
statpanel("Spells",spells)
In response to Tails5
Tails5 wrote:
Your problem lies in this section of your code
mob
> Stat()//Calls the stat proc.
> ..()
> statpanel("Stats")//Makes a new statpanel called "Stats"
> stat("Health","[health]/[maxhealth]")
> stat("Experience","[exp]/[maxexp]")//Creates a new stat called "Experience" and gives it the value of "exp/maxexp"
> stat("Level",level)
> stat("Magic level",level)
> statpanel("Equipment")
> statpanel("Inventory",contents)
> statpanel("Spells",contents)
>

replace
statpanel("Spells",contents)
with
statpanel("Spells",spells)


Thanks now how do I get the spells to show up? In the spell tab
is there a reason for the 2 level up procs??
also your calling the wrong proc for leveling up in your attack proc, thats the reason its not adding to spells list.

this code is a little more advanced than i know but it looks like your LevelUp doesnt get called at all, and thats what defines you spells var.
In response to Swift19
    var/list/spells
...
New()
..()
spells=list() // this is a list of spells you can learn at different levels
var/list/level_learned_spells=list(
"Wind"=1, // learn "Heal" at level 3
"Water"=5, // learn "Fire" at level 5
"Earth"=10) // learn "Maim" at level 10
...
proc/LevelUp()
++level
src << "Welcome to level [level]."
for(var/thespell in level_learned_spells)
if(level>=level_learned_spells[thespell])
if(!(thespell in spells))
src << "You learn the [thespell] spell."
spells+=thespell

proc
Levelup()
if(src.exp>=src.maxexp)//If your exp var equals, or passes your maxexp var
src.level++//Add to your level
src.exp=0//resets your exp to 0
src.maxexp*=2//makes your maxexp double
src<<"You gained a level!"
src.Statup()
else
..()//defaults if the if() doesn't return it's arguments

proc
Statup()
src.maxhealth+=20//adds to your health
src.health=src.maxhealth
src<<"Your stats increase!"//Outputs a message telling you that you gained stats

var
health = 100//Makes a var called health and gives it the value 100
maxhealth = 100
exp = 0
maxexp = 1000
level = 1

mob
Stat()//Calls the stat proc.
..()
statpanel("Stats")//Makes a new statpanel called "Stats"
stat("Health","[health]/[maxhealth]")
stat("Experience","[exp]/[maxexp]")//Creates a new stat called "Experience" and gives it the value of "exp/maxexp"
stat("Level",level)
stat("Magic level",level)
stat("Strength level",level)
stat("Attack level",level)
stat("Defense level",level)
stat("Range level",level)
stat("Ninjutsu level",level)
stat("Genjutsu level",level)
stat("Taijutsu level",level)
stat("Prayer level",level)
statpanel("Equipment")
statpanel("Inventory",contents)
statpanel("Spells",spells)

proc
attack(mob/M)//This will be used to make the demo challenging
var/damage = rand(1,15)//a bit of damage never hurt..wait, yes it does!
M<<"[src] attacked you for [damage] damage!"
if(src.client)
src<<"You attacked [M] for [damage] damage!"
M.health-=damage
src.deathcheck(M)
if(src.client)//Only players can gain levels
src.exp+=rand(50,300)//adds random exp points
src.Levelup()//calls the levelup proc
else
return..()//normal action

proc
deathcheck(mob/M as mob)//handles death
if(M.health<=0)//checks health
if(M.client)//if is a player
M.loc = locate(1,1,1)//restarts
M.health = M.maxhealth//resets health
M<<"[src] killed you!"//tells you, you were killed.
else//not a player
src<<"You killed [M]!"//Tells you who you killed
M.loc = locate(rand(1,world.maxx),rand(1,world.maxy),rand(1,world.maxz))
//random location after death

mob/NPC//Defines a /mob/NPC
icon = 'Characters.dmi'
icon_state = "NPC"
health = 200//different health than the main mob
Click()//When clicked
usr.attack(src)//attack!
proc/move()//Now, this proc handles NPC movement
for(var/mob/M in oview())//loops over all mobs in view
if(get_step_away(src,M,3))//checks distance
if(!M.client)//Not a player
continue//continues through the loop
else//Player
walk_to(src,M,1,2)//Move to the person
else//4-or-more spaces away
continue
spawn(20) move()//loops the proc after 2 seconds

proc/attackplayer()//Handles attacking
for(var/mob/M in oview(1))//Within one space this time
if(get_step_away(src,M,1))
if(!M.client)
continue
else
src.attack(M)//Calls the attack proc
else
return..()
spawn(20) attackplayer()

New()//When created
attackplayer()//Calls the procs for it
move()


This is my Level Up codes and Mob/NPC attack code
In response to Merick12
yes i know thats you levelup code but if you notice, there are 2 level up procs and only one of them is called, its not the one you want.

in your attack proc it calls Levelup() when it needs to be calling LevelUp()
In response to Merick12
Merick12 wrote:
Tails5 wrote:
Your problem lies in this section of your code
mob
> > Stat()//Calls the stat proc.
> > ..()
> > statpanel("Stats")//Makes a new statpanel called "Stats"
> > stat("Health","[health]/[maxhealth]")
> > stat("Experience","[exp]/[maxexp]")//Creates a new stat called "Experience" and gives it the value of "exp/maxexp"
> > stat("Level",level)
> > stat("Magic level",level)
> > statpanel("Equipment")
> > statpanel("Inventory",contents)
> > statpanel("Spells",contents)
> >

replace
statpanel("Spells",contents)
with
statpanel("Spells",spells)

Thanks now how do I get the spells to show up? In the spell tab

He just told you how to do it o.o
Replace the line
statpanel("Spells",contents)
with
statpanel("Spells",Name of the List the spells are added to")
In response to Narmanb
Narmanb wrote:
He just told you how to do it o.o
Replace the line
statpanel("Spells",contents)
with
statpanel("Spells",Name of the List the spells are added to")

you guys dont seem to notice that the spells var has nothing in it unless he calls the LevelUp proc which he isnt so this wont work until he fixes that.
In response to Swift19
mob
var/list/spells
...
New()
..()
spells=list() // this is a list of spells you can learn at different levels
var/list/level_learned_spells=list(
"Wind"=3, // learn "Heal" at level 3
"Water"=5, // learn "Fire" at level 5
"Earth"=10) // learn "Maim" at level 10
...
proc/LevelUp()
++level
src << "Welcome to level [level]."
for(var/thespell in level_learned_spells)
if(level>=level_learned_spells[thespell])
if(!(thespell in spells))
src << "You learn the [thespell] spell."
spells+=thespell


mob
proc
Levelup()
if(src.exp>=src.maxexp)//If your exp var equals, or passes your maxexp var
src.level++//Add to your level
src.exp=0//resets your exp to 0
src.maxexp*=2//makes your maxexp double
src<<"You gained a level!"
src.Statup()
else
..()//defaults if the if() doesn't return it's arguments


all you're really doing is adding the text "Wind" "Earth" etc. into the spells list. You arent specifing the verb or the object. If you haven't made them yet, you need to do so. But if you did...

if(level>=level_learned_spells[thespell])
if(!(thespell in spells))
src << "You learn the [thespell] spell."
spells+=text2path("/obj/spells/[thespell]")//adds the object to the spells proc


and as for showing them..
statpanel("Spells")
for(var/obj/P in contents)//checks each object in mob's contents
if(istype(P,/obj/spells/))//if it is a spell
stat("Spells",P)//shows the spell


Now this is just an example but this is how it *would* work. One more thing..
mob
LevelUp()// remove "proc/" from this since it is already user defined.
++level
src << "Welcome to level [level]."
for(var/thespell in level_learned_spells)
if(level>=level_learned_spells[thespell])
if(!(thespell in spells))
src << "You learn the [thespell] spell."
spells+=thespell
.=..()//this will return to the user defined parent proc and execute what is in there.


TO Swift19: He has the levelup proc being called in his attack verb.
In response to Axerob
This is what will not work:
    Stat()//Calls the stat proc.
..()
statpanel("Stats")//Makes a new statpanel called "Stats"
stat("Health","[health]/[maxhealth]")
stat("Experience","[exp]/[maxexp]")//Creates a new stat called "Experience" and gives it the value of "exp/maxexp"
stat("Level",level)
stat("Magic level",level)
stat("Strength level",level)
stat("Attack level",level)
stat("Defense level",level)
stat("Range level",level)
stat("Ninjutsu level",level)
stat("Genjutsu level",level)
stat("Taijutsu level",level)
stat("Prayer level",level)
statpanel("Equipment")
statpanel("Inventory",contents)
statpanel("Spells")
for(var/obj/P in contents)//checks each object in mob's contents
if(istype(P,/obj/spells/))//if it is a spell
stat("Spells",P)//shows the spell


var/list/spells
...
New()
..()
spells=list() // this is a list of spells you can learn at different levels
var/list/level_learned_spells=list(
"Wind"=1, // learn "Heal" at level 3
"Water"=5, // learn "Fire" at level 5
"Earth"=10) // learn "Maim" at level 10
...
proc/LevelUp()
++level
src << "Welcome to level [level]."
for(var/thespell in level_learned_spells)
if(level>=level_learned_spells[thespell])
if(!(thespell in spells))
src << "You learn the [thespell] spell."
spells+=thespell
.=..()//this will return to the user defined parent proc and execute what is in there.


proc
Levelup()
if(src.exp>=src.maxexp)//If your exp var equals, or passes your maxexp var
src.level++//Add to your level
src.exp=0//resets your exp to 0
src.maxexp*=2//makes your maxexp double
src<<"You gained a level!"
src.Statup()
else
..()//defaults if the if() doesn't return it's arguments

proc
Statup()
src.maxhealth+=20//adds to your health
src.health=src.maxhealth
src<<"Your stats increase!"//Outputs a message telling you that you gained stats

var
health = 100//Makes a var called health and gives it the value 100
maxhealth = 100
exp = 0
maxexp = 1000
level = 1

proc
attack(mob/M)//This will be used to make the demo challenging
var/damage = rand(1,15)//a bit of damage never hurt..wait, yes it does!
M<<"[src] attacked you for [damage] damage!"
if(src.client)
src<<"You attacked [M] for [damage] damage!"
M.health-=damage
src.deathcheck(M)
if(src.client)//Only players can gain levels
src.exp+=rand(50,300)//adds random exp points
src.Levelup()//calls the levelup proc
else
return..()//normal action

proc
deathcheck(mob/M as mob)//handles death
if(M.health<=0)//checks health
if(M.client)//if is a player
M.loc = locate(1,1,1)//restarts
M.health = M.maxhealth//resets health
M<<"[src] killed you!"//tells you, you were killed.
else//not a player
src<<"You killed [M]!"//Tells you who you killed
M.loc = locate(rand(1,world.maxx),rand(1,world.maxy),rand(1,world.maxz))
//random location after death

mob/NPC//Defines a /mob/NPC
icon = 'Characters.dmi'
icon_state = "NPC"
health = 200//different health than the main mob
Click()//When clicked
usr.attack(src)//attack!
proc/move()//Now, this proc handles NPC movement
for(var/mob/M in oview())//loops over all mobs in view
if(get_step_away(src,M,3))//checks distance
if(!M.client)//Not a player
continue//continues through the loop
else//Player
walk_to(src,M,1,2)//Move to the person
else//4-or-more spaces away
continue
spawn(20) move()//loops the proc after 2 seconds

proc/attackplayer()//Handles attacking
for(var/mob/M in oview(1))//Within one space this time
if(get_step_away(src,M,1))
if(!M.client)
continue
else
src.attack(M)//Calls the attack proc
else
return..()
spawn(20) attackplayer()

New()//When created
attackplayer()//Calls the procs for it
move()

Del()
var/obj/Gold/G = new(loc)
G.amount = rand(1,100)
..()

obj
spells
icon = 'spells.dmi'
Wind
icon_state = "Wind"
Water
icon_state = "Water"
Earth
icon_state = "Earth"

Why is this not working? The spells don't show Up in the spell tabs at all
In response to Merick12
:O you should feel stupid. IF your making a naruto game do not call it spells, jebuz. Its jutsu :O or Techniques, or Ninjutsu. lol
In response to Masterdan
Masterdan, have you ever thought that maybe he doesn't want English garbled with Japanese in his game..?
In response to Masterdan
Im not making a Naruto Game its something that is going to be better than that.
In response to SpikeNeedle
I think the problem is because I have two LevelUp() procs, and I need to combined them. But how would I do that?

Also with both codes in the game when attacking my dummy all the levels grow add I don't want that. I want it so that atacking the dummy only my str, def, and atk grow but if I use a spell(not working still) my magic lvl grows and so on.
    Stat()//Calls the stat proc.
..()
statpanel("Stats")//Makes a new statpanel called "Stats"
stat("Health","[health]/[maxhealth]")
stat("Experience","[exp]/[maxexp]")//Creates a new stat called "Experience" and gives it the value of "exp/maxexp"
stat("Level",level)
stat("Magic level",level)
stat("Strength level",level)
stat("Attack level",level)
stat("Defense level",level)
stat("Range level",level)
stat("Ninjutsu level",level)
stat("Genjutsu level",level)
stat("Taijutsu level",level)
stat("Prayer level",level)
statpanel("Equipment")
statpanel("Inventory",contents)
statpanel("Spells")
for(var/obj/P in contents)//checks each object in mob's contents
if(istype(P,/obj/spells/))//if it is a spell
stat("Spells",P)//shows the spell
statpanel("Ninjutsu")
statpanel("Genjutsu")
statpanel("Taijutsu")
statpanel("Prayer")

var/list/spells
...
New()
..()
spells=list() // this is a list of spells you can learn at different levels
var/list/level_learned_spells=list(
"Wind"=1, // learn "Wind" at level 1
"Water"=3, // learn "Water" at level 2
"Earth"=7, // learn "Earth" at level 7
"Fire"=12, // learn "Fire" at level 12
"Trap"=18) // learn "Trap" at level 18
...
proc
LevelUp()
++level
src << "Welcome to level [level]."
for(var/thespell in level_learned_spells)
if(level>=level_learned_spells[thespell])
if(!(thespell in spells))
src << "You learn the [thespell] spell."
spells+=thespell
.=..()//this will return to the user defined parent proc and execute what is in there.

    proc
Levelup()
if(src.exp>=src.maxexp)//If your exp var equals, or passes your maxexp var
src.level++//Add to your level
src.exp=0//resets your exp to 0
src.maxexp*=2//makes your maxexp double
src<<"You gained a level!"
src.Statup()
else
..()//defaults if the if() doesn't return it's arguments

proc
Statup()
src.maxhealth+=20//adds to your health
src.health=src.maxhealth
src<<"Your stats increase!"//Outputs a message telling you that you gained stats

var
health = 100//Makes a var called health and gives it the value 100
maxhealth = 100
exp = 0
maxexp = 1000
level = 1

proc
attack(mob/M)//This will be used to make the demo challenging
var/damage = rand(1,15)//a bit of damage never hurt..wait, yes it does!
M<<"[src] attacked you for [damage] damage!"
if(src.client)
src<<"You attacked [M] for [damage] damage!"
M.health-=damage
src.deathcheck(M)
if(src.client)//Only players can gain levels
src.exp+=rand(50,300)//adds random exp points
src.Levelup()//calls the levelup proc
else
return..()//normal action

proc
deathcheck(mob/M as mob)//handles death
if(M.health<=0)//checks health
if(M.client)//if is a player
M.loc = locate(1,1,1)//restarts
M.health = M.maxhealth//resets health
M<<"[src] killed you!"//tells you, you were killed.
else//not a player
src<<"You killed [M]!"//Tells you who you killed
M.loc = locate(rand(1,world.maxx),rand(1,world.maxy),rand(1,world.maxz))
//random location after death

mob/NPC//Defines a /mob/NPC
icon = 'Characters.dmi'
icon_state = "NPC"
health = 200//different health than the main mob
Click()//When clicked
usr.attack(src)//attack!
proc/move()//Now, this proc handles NPC movement
for(var/mob/M in oview())//loops over all mobs in view
if(get_step_away(src,M,3))//checks distance
if(!M.client)//Not a player
continue//continues through the loop
else//Player
walk_to(src,M,1,2)//Move to the person
else//4-or-more spaces away
continue
spawn(20) move()//loops the proc after 2 seconds

proc/attackplayer()//Handles attacking
for(var/mob/M in oview(1))//Within one space this time
if(get_step_away(src,M,1))
if(!M.client)
continue
else
src.attack(M)//Calls the attack proc
else
return..()
spawn(20) attackplayer()

New()//When created
attackplayer()//Calls the procs for it
move()

Del()
var/obj/Gold/G = new(loc)
G.amount = rand(1,100)
..()

obj
spells
icon = 'spells.dmi'
Wind
icon_state = "Wind"
Water
icon_state = "Water"
Earth
icon_state = "Earth"
Fire
icon_state = "Fire"
In response to Merick12
Merick12 wrote:
This is what will not work:
>   Stat()//Calls the stat proc.
> ..()
> statpanel("Stats")//Makes a new statpanel called "Stats"
> stat("Health","[health]/[maxhealth]")
> stat("Experience","[exp]/[maxexp]")//Creates a new stat called "Experience" and gives it the value of "exp/maxexp"
> stat("Level",level)
> stat("Magic level",level)
> stat("Strength level",level)
> stat("Attack level",level)
> stat("Defense level",level)
> stat("Range level",level)
> stat("Ninjutsu level",level)
> stat("Genjutsu level",level)
> stat("Taijutsu level",level)
> stat("Prayer level",level)
> statpanel("Equipment")
> statpanel("Inventory",contents)
> statpanel("Spells")
> for(var/obj/P in contents)//checks each object in mob's contents
> if(istype(P,/obj/spells/))//if it is a spell
> stat("Spells",P)//shows the spell
>
>
> var/list/spells
> ...
> New()
> ..()
> spells=list() // this is a list of spells you can learn at different levels
> var/list/level_learned_spells=list(
> "Wind"=1, // learn "Heal" at level 3
> "Water"=5, // learn "Fire" at level 5
> "Earth"=10) // learn "Maim" at level 10
> ...
> proc/LevelUp()
> ++level
> src << "Welcome to level [level]."
> for(var/thespell in level_learned_spells)
> if(level>=level_learned_spells[thespell])
> if(!(thespell in spells))
> src << "You learn the [thespell] spell."
> spells+=thespell
> .=..()//this will return to the user defined parent proc and execute what is in there.
>
>
> proc
> Levelup()
> if(src.exp>=src.maxexp)//If your exp var equals, or passes your maxexp var
> src.level++//Add to your level
> src.exp=0//resets your exp to 0
> src.maxexp*=2//makes your maxexp double
> src<<"You gained a level!"
> src.Statup()
> else
> ..()//defaults if the if() doesn't return it's arguments
>
> proc
> Statup()
> src.maxhealth+=20//adds to your health
> src.health=src.maxhealth
> src<<"Your stats increase!"//Outputs a message telling you that you gained stats
>
> var
> health = 100//Makes a var called health and gives it the value 100
> maxhealth = 100
> exp = 0
> maxexp = 1000
> level = 1
>
> proc
> attack(mob/M)//This will be used to make the demo challenging
> var/damage = rand(1,15)//a bit of damage never hurt..wait, yes it does!
> M<<"[src] attacked you for [damage] damage!"
> if(src.client)
> src<<"You attacked [M] for [damage] damage!"
> M.health-=damage
> src.deathcheck(M)
> if(src.client)//Only players can gain levels
> src.exp+=rand(50,300)//adds random exp points
> src.Levelup()//calls the levelup proc
> else
> return..()//normal action
>
> proc
> deathcheck(mob/M as mob)//handles death
> if(M.health<=0)//checks health
> if(M.client)//if is a player
> M.loc = locate(1,1,1)//restarts
> M.health = M.maxhealth//resets health
> M<<"[src] killed you!"//tells you, you were killed.
> else//not a player
> src<<"You killed [M]!"//Tells you who you killed
> M.loc = locate(rand(1,world.maxx),rand(1,world.maxy),rand(1,world.maxz))
> //random location after death
>
> mob/NPC//Defines a /mob/NPC
> icon = 'Characters.dmi'
> icon_state = "NPC"
> health = 200//different health than the main mob
> Click()//When clicked
> usr.attack(src)//attack!
> proc/move()//Now, this proc handles NPC movement
> for(var/mob/M in oview())//loops over all mobs in view
> if(get_step_away(src,M,3))//checks distance
> if(!M.client)//Not a player
> continue//continues through the loop
> else//Player
> walk_to(src,M,1,2)//Move to the person
> else//4-or-more spaces away
> continue
> spawn(20) move()//loops the proc after 2 seconds
>
> proc/attackplayer()//Handles attacking
> for(var/mob/M in oview(1))//Within one space this time
> if(get_step_away(src,M,1))
> if(!M.client)
> continue
> else
> src.attack(M)//Calls the attack proc
> else
> return..()
> spawn(20) attackplayer()
>
> New()//When created
> attackplayer()//Calls the procs for it
> move()
>
> Del()
> var/obj/Gold/G = new(loc)
> G.amount = rand(1,100)
> ..()
>
> obj
> spells
> icon = 'spells.dmi'
> Wind
> icon_state = "Wind"
> Water
> icon_state = "Water"
> Earth
> icon_state = "Earth"
>

Why is this not working? The spells don't show Up in the spell tabs at all

Because you're adding a Text String to spells instead of the object path.
In response to Axerob
What?
In response to Merick12
Merick12 wrote:
What?

okay...i've already told you how to fix it. I'll repost it again...

if(level>=level_learned_spells[thespell])
if(!(thespell in spells))
src << "You learn the [thespell] spell."
spells+=text2path("/obj/spells/[thespell]")//adds the object to the spells proc



and as for showing them..
statpanel("Spells")
for(var/obj/P in contents)//checks each object in mob's contents
if(istype(P,/obj/spells/))//if it is a spell
stat("Spells",P)//shows the spell



Now this is just an example but this is how it *would* work. One more thing..
mob
LevelUp()// remove "proc/" from this since it is already user defined.
++level
src << "Welcome to level [level]."
for(var/thespell in level_learned_spells)
if(level>=level_learned_spells[thespell])
if(!(thespell in spells))
src << "You learn the [thespell] spell."
spells+=thespell
.=..()//this will return to the user defined parent proc and execute what is in there.



In response to Axerob
Thanks I have added what you said but the spells are still not showing up in the spell tab.

See:
    Stat()//Calls the stat proc.
..()
statpanel("Stats")//Makes a new statpanel called "Stats"
stat("Health","[health]/[maxhealth]")
stat("Experience","[exp]/[maxexp]")//Creates a new stat called "Experience" and gives it the value of "exp/maxexp"
stat("Level",level)
stat("Magic level",level)
stat("Strength level",level)
stat("Attack level",level)
stat("Defense level",level)
stat("Range level",level)
stat("Ninjutsu level",level)
stat("Genjutsu level",level)
stat("Taijutsu level",level)
stat("Prayer level",level)
statpanel("Equipment")
statpanel("Inventory",contents)
statpanel("Spells",spells)
for(var/obj/P in contents)//checks each object in mob's contents
if(istype(P,/obj/spells/))//if it is a spell
stat("Spells",P)//shows the spell
statpanel("Ninjutsu")
statpanel("Genjutsu")
statpanel("Taijutsu")
statpanel("Prayer")

var/list/spells
...
New()
..()
spells=list() // this is a list of spells you can learn at different levels
var/list/level_learned_spells=list(
"Wind"=1, // learn "Wind" at level 1
"Water"=3, // learn "Water" at level 2
"Earth"=7, // learn "Earth" at level 7
"Fire"=12, // learn "Fire" at level 12
"Trap"=18) // learn "Trap" at level 18
...
proc
LevelUp()
++level
src << "Welcome to level [level]."
for(var/thespell in level_learned_spells)
if(level>=level_learned_spells[thespell])
if(!(thespell in spells))
src << "You learn the [thespell] spell."
spells+=text2path("/obj/spells/[thespell]")//adds the object to the spells proc
.=..()//this will return to the user defined parent proc and execute what is in there.

proc
Levelup()
if(src.exp>=src.maxexp)//If your exp var equals, or passes your maxexp var
src.level++//Add to your level
src.exp=0//resets your exp to 0
src.maxexp*=2//makes your maxexp double
src<<"You gained a level!"
src.Statup()
else
..()//defaults if the if() doesn't return it's arguments

proc
Statup()
src.maxhealth+=20//adds to your health
src.health=src.maxhealth
src<<"Your stats increase!"//Outputs a message telling you that you gained stats

var
health = 100//Makes a var called health and gives it the value 100
maxhealth = 100
exp = 0
maxexp = 1000
level = 1

proc
attack(mob/M)//This will be used to make the demo challenging
var/damage = rand(1,15)//a bit of damage never hurt..wait, yes it does!
M<<"[src] attacked you for [damage] damage!"
if(src.client)
src<<"You attacked [M] for [damage] damage!"
M.health-=damage
src.deathcheck(M)
if(src.client)//Only players can gain levels
src.exp+=rand(50,300)//adds random exp points
src.Levelup()//calls the levelup proc
else
return..()//normal action

proc
deathcheck(mob/M as mob)//handles death
if(M.health<=0)//checks health
if(M.client)//if is a player
M.loc = locate(1,1,1)//restarts
M.health = M.maxhealth//resets health
M<<"[src] killed you!"//tells you, you were killed.
else//not a player
src<<"You killed [M]!"//Tells you who you killed
M.loc = locate(rand(105,world.maxx),rand(127,world.maxy),rand(1,world.maxz))
//random location after death

mob/NPC//Defines a /mob/NPC
icon = 'Characters.dmi'
icon_state = "NPC"
health = 200//different health than the main mob
Click()//When clicked
usr.attack(src)//attack!
proc/move()//Now, this proc handles NPC movement
for(var/mob/M in oview())//loops over all mobs in view
if(get_step_away(src,M,3))//checks distance
if(!M.client)//Not a player
continue//continues through the loop
else//Player
walk_to(src,M,1,2)//Move to the person
else//4-or-more spaces away
continue
spawn(20) move()//loops the proc after 2 seconds

proc/attackplayer()//Handles attacking
for(var/mob/M in oview(1))//Within one space this time
if(get_step_away(src,M,1))
if(!M.client)
continue
else
src.attack(M)//Calls the attack proc
else
return..()
spawn(20) attackplayer()

New()//When created
attackplayer()//Calls the procs for it
move()

Del()
var/obj/Gold/G = new(loc)
G.amount = rand(1,100)
..()

obj
spells
icon = 'spells.dmi'
Wind
icon_state = "Wind"
Water
icon_state = "Water"
Earth
icon_state = "Earth"
In response to Merick12
well that code shouldnt even COMPILE. You have 2 LevelUp procs, combine them
In response to Axerob
How?
Page: 1 2