runtime error: Cannot read "Fire".Stype
proc name: Spellcast (/proc/Spellcast)
usr: Redslash (/mob/Person)
src: null
call stack:
Spellcast(Redslash (/mob/Person), Bear (/mob/Monster/Bear), "Fire")
spells(Redslash (/mob/Person), Bear (/mob/Monster/Bear))
Pattack(Redslash (/mob/Person), Bear (/mob/Monster/Bear))
encounter(Redslash (/mob/Person), Bear (/mob/Monster/Bear))
Attack grass (5,2,1) (/turf/Attack_grass): Entered(Redslash (/mob/Person), Attack grass (4,2,1) (/turf/Attack_grass))
i think its caused by the way i add the magic to the list
proc newspells(mob/P) if(P.Class=="Person" && P.lvl==2) if(!P.spells) P.spells = new P.spells+="Fire" P<<"You Learned Fire!" P.spellknown=1
if i change that code, then when i try to look at P.spells in a stat panel or call it in input, it messes up, anyone know why?
I call it with this code, which is bad and messy...
proc spells(mob/P, mob/E) if(P.spellknown>=1) var/spell=input("Which spell do you want to cast?") in P.spells call(/proc/Spellcast)(P,E,spell) else call(/proc/Pattack)(P,E) Spellcast(mob/P, mob/E, obj/spell) if(spell.Stype=="Hurt") if(P.MP>=spell.MP) var/damage=rand(P.DarkSkill*spell.damagelow,P.DarkSkill*spel l.damagehigh) E.HP-=damage P.Dark_exp+=1 call(/proc/Darklvlupcheck)(P) call(/proc/deathcheckMON)(P,E) else P<<"Not enough MP!" call(/proc/Pattack)(P,E) if(spell.Stype=="Heal") if(P.MP>=spell.MP) var/heal=rand(P.LightSkill*spell.heallow,P.LightSkill*spell. healhigh) P.HP+=heal P.Light_exp+=1 call(/proc/Lightlvlupcheck)(P) call(/proc/Eattack)(P,E) else P<<"Not enough MP!" call(/proc/Pattack)(P,E)
I also made sure P was the usr and E was the enemy.
The error is in the Spellcast proc and it can't read "Fire".Stype
What happend is that obj/spell was defines as a text string ("Fire" in this case) which aint a obj with a Stype var.
Look at the place where the call the proc and make sure you define the obj/spell var as the spell object and not as a (what it seems to me) Stype allready.
Hope it helps, Greetz Fint