ID:143584
 
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