CrystalB
var/obj/items/equippable/CrystalB/cha=0
name="Dark Moon Blood Crystal"
icon='CrystalB.dmi'
proc
Use()
if(usr.henge)return
Click()Use()
verb
Drop()
loc=locate(usr.x,usr.y,usr.z)
Pick_Up()
set src in oview(1)
loc=usr
usr<<"You picked up a [src]."
FeedChakra()
prejutsu()
if(swim||dead||stun||resting||caught||seals||busy)return
handseals(50,5,50)
if(!sealpass)return
view(8)<< output("<font color=cyan><b>[usr]: Grow STRONGER!","output2")
for(var/obj/items/equippable/CrystalB in orange(4, src))
CrystalB.cha+=1000
if(CrystalB.cha==1000)
overlays+='blacklightningaura.dmi'
return
Problem description: The first snippet is a new obj in required.dm file, that I am using as a catalyst for a new jutsu...
I defined a cha(kra) var to it, as to be able to put a chakra in it from players.
The second snippet is a test verb, that will turn into said jutsu, and uses tries to add 1000 chakra (for test purposes).
I get a var undefined, and it's probably super simple, but I have had this problem before, and I couldn't fix it then either. Simply overlooking stuff is a problematic habit of mine, until I give in...
The variable in question is the CrystalB.cha.
It's bound to the /obj/items/equippable/CrystalB type simply because of where it is in the code.
2. for(var/obj/items/equippable/CrystalB in orange(4, src)) defines a variable called "CrystalB" with the type /obj/items/equippable. It's not declared as an /obj/items/equippable/CrystalB, so you can't use it to access variables of /obj/items/equippable/CrystalB.
3. The above two problems hint at a fundamental misunderstanding on how variables are declared. Try the DM Guide?
4. Using usr even in procs you call from Click() should be avoided. Use this pattern instead: