ID:1368380
 
(See the best response by Kaiochao.)
Code:
mob
Move()
for(var/f in usr.overlays)
if(findtextEx("[f]","Weights",1))
for(var/k in usr.Inventory)
if(findtextEx("[k]","Weights",1))
if(usr.stamina<=0) return
usr.exp+=0.27*(usr.er)
usr.stamina-=1
if(prob(20)) {usr<<"You gain more taijutsu.";usr.taijutsu+=rand(1,5)*(usr.er)}
else if(prob(20)) {usr<<"You gain more hp.";usr.maxhp+=rand(1,2.5)*(usr.er)}
if(prob(40)) {usr<<"You gain a little bit more experience.";usr.exp+=rand(0.2,3.5)*(usr.er)}
else if(prob(20)) {usr<<"You gain alot more experience.";usr.exp+=rand(0.5,5)*(usr.er)}
..()


Problem description: so my problem today comes in the form of i don't know why it isn't working, it looks all fine and dandy, but when i move, that's all that happens, i move, no stamina lose, no exp gain, no random gains, nothing, just moving.
after working on movement before i know something in this has too be off, but i cant put my finger on it.


Best response
The overlays list is special (tedious) and can't be looped through normally. You'll have to keep a separate list of weights to loop through instead.

I also suggest that you don't use usr there. It's better to use src (or implied src, ie "src.variable" can be written "variable") because usr is not always src in Move().
well, if i remember correctly, thats basically how it was set up initially, and still nothing

EDIT: i dont rememebr though, so im going to try it and see what happens

EDIT2: yep, still nothing
so, i 'fixed' the problem, by removing the lines involving the Overlays list, however now it causes the weights to work regardless of whether they're equipped or not.

any suggestions?
Bloody m wrote:
so, i 'fixed' the problem, by removing the lines involving the Overlays list, however now it causes the weights to work regardless of whether they're equipped or not.

any suggestions?

Make it check to see whether or not the weights are equipped before doing anything.

Example being:

for(var/obj/weight_path/weights in usr.Inventory)
if(!weights.equipped) continue
do stuff

well, after some major fiddling on my own, i found the real source of the problem in a proc called by a proc called by a verb that handled the equipping process, and fixed it...

thx anyway for the help