ID:145270
 
mob
Login()
..()
src.spells += new /obj/spell/HPHeal()

verb/Spells()
src.currentSpell = input("Which spell would you like to cast?","Select Spell") in spells
if(!src.currentSpell.needsTarget)
src.currentSpell.Cast(src)

var
Level = 1
Exp = 0
MExp = 50
HP = 10 //health
MHP = 10 //max health
MP = 10 //mana
MMP = 10 // max mana
Wealth = 0 //your gold
Attack = 1 //attack level
MAttack = 1 //max attack level
Strength = 1
MStrength = 1
Defense = 1
MDefense = 1
strength
defense
var/list/spells[0]
var/obj/spell/currentSpell = "None"
mob
enemy
bug
icon = 'bug.dmi'
HP = 25
Wealth = 50
Login()
icon = 'person.dmi'
loc = locate(1,1,1)
..()

proc
DeathCheck() //check to see if they are dead
if (HP <= 0) //if the defender's HP is low enough...
world << "[src] dies!" //give the death messaging
del src

Levelup()
if(src.Exp >= src.MExp)//If your exp equals, or passes your maxexp var
src.Level += 1//Add to your level
src.Exp = 0//resets your exp to 0
src.MExp *= 2//makes your maxexp double
src.Attack += 1
src.MAttack += 1
src.Defense += 1
src.MDefense += 1
src.Strength += 1
src.MStrength += 1
src.MHP += 16
src.HP = src.MHP
src.MMP += 12
src.MP = src.MMP
src << "You gained a level!"
src.Stat()

verb
Attack(mob/M as mob in oview(1))
if (M.HP <= 0)
usr << "[M] is already dead!"
else
usr << "You attack [M]!"
oview() << "[usr] attacks [M]!"
var/damage = rand(1,20) //random dmg 1-20
world << "[damage] damage!"
M.HP -= damage
M.DeathCheck()

Say(msg as text)
world << "[usr]: [msg]"

obj
gold
icon = 'gold.dmi'
var
amount
verb
Get() //get the gold
set src in view(1) //src must be close
var/A = rand(1,100)
usr << "You find [A] gold!"
usr.Wealth += A //add to usr.wealth
del(src) //delete the gold
potion
icon = 'potion.dmi'
verb
Get()
set src in view(1)
usr << "You find small Mana Potion"
del(src)
Use()
usr.MP +=20


turf
Dungonlevel1
floors
icon ='dungonlevel1.dmi'
grass
icon_state = "grass"
darkness
icon_state = "darkness"
walkway
icon_state = "walkway"

world
turf = /turf/Dungonlevel1/floors/grass //default turf

mob/Stat()
..()
statpanel("Inventory",src.contents)
mob/Stat()
statpanel("Character")
stat("Level [Level]")
stat("Exp [Exp]/[MExp]")
stat("Health [HP]/[MHP]")
stat("Mana [MP]/[MMP]")
stat("Attack [Attack]/[MAttack]")
stat("Strength [Strength]/[MStrength]")
stat("Defense [Defense]/[MDefense]")
stat("Wealth [Wealth]")
stat(usr.contents)

turf/mobs.male
icon = 'person.dmi'
icon_state = "male"
Click()
usr.HP = 50
usr.MHP = 50
usr.icon = 'person.dmi'
usr.icon_state = "male"
usr.MP = 25
usr.MMP = 25
usr.start()

turf/mobs.female
icon = 'person.dmi'
icon_state = "female"
Click()
usr.HP = 50
usr.MHP = 50
usr.icon = 'person.dmi'
usr.icon_state = "female"
usr.MP = 25
usr.MMP = 25
usr.start() //Activates that proc

mob
proc
start()
loc =locate(1,1,2)

obj
spell
icon = 'demo.dmi'
icon_state = "spell"
var/needsTarget = 0
proc
Cast(var/mob/caster)

HPHeal
needsTarget = 0
Cast(var/mob/caster)
caster << "You cast HP Heal on yourself!"
usr.HP += 25
usr.MP -= 5


Problem description: OK, i dont get an error or anything.. but when i load up the game and i play it.. i cant see my inventory where my potion is.. and i also cant use my HP Heal spell. All help appreciated.

Please dont just post saying usr abuse.. cause i know it is :P


Grim


Kinda of topic but, better watch out for Mysame. She/He intends on correcting people about that. But it is true. She/He is just trying to make you a better coder.
USR ABUSE!!

Actually, not so bad. Look through and decide where you can switch away from usr, though. For example, you could have the heal spell do Cast(mob/caster,mob/target) and do caster << message, target += HP, caster -= MP. That way, you won't have the wierdness with usr when Joe Healer tries to cast Heal on Bob the Fighter.

You wrote: i cant see my inventory where my potion is..

I found:
stat(usr.contents)

That won't work. Change it.

You wrote: and i also cant use my HP Heal spell

I noticed: you define spells as "spells[0]". I wonder whether that means that you can only fit 0 elements into the list, thereby making it so that the Heal spell is never put into place. In any case, I always define my lists as var/list/l = new

Other than that, I can't see why the spell wouldn't be working.

I comment: you posted way too much code for us there, bro. Try cutting out the code that's really irrelevant.
In response to PirateHead
PirateHead wrote:
USR ABUSE!!

Actually, not so bad. Look through and decide where you can switch away from usr, though. For example, you could have the heal spell do Cast(mob/caster,mob/target) and do caster << message, target += HP, caster -= MP. That way, you won't have the wierdness with usr when Joe Healer tries to cast Heal on Bob the Fighter.

You wrote: i cant see my inventory where my potion is..

I found:
stat(usr.contents)

That won't work. Change it.

You wrote: and i also cant use my HP Heal spell

I noticed: you define spells as "spells[0]". I wonder whether that means that you can only fit 0 elements into the list, thereby making it so that the Heal spell is never put into place. In any case, I always define my lists as var/list/l = new

Other than that, I can't see why the spell wouldn't be working.

I comment: you posted way too much code for us there, bro. Try cutting out the code that's really irrelevant.

Yeah i wasnt sure how much code would be needed.. i didnt want you guys to ask for more -.- lol, but anyway thanks, for the "spells[0]" that is just saying that i can only use the spell on myself, not on anyone else. Ill try to change the usr abuse :P