- Joined
- Apr 19, 2019
- Messages
- 7
- Reaction score
- 0
- First Language
- Chinese
- Primarily Uses
- RMVXA
I am trying to make a system where each item has its own weight, and when the characters cannot carry all their stuff, they cannot move and have to throw away their stuff.
The main focus for help:
Here is the code in the scripts:
Code in common events:
The thing is, it breaks on the 1st line after "else" in the common event with a " "weight" not found for nil:nilClass "
how do I define "weight" properly?
The main focus for help:
Here is the code in the scripts:
class RPG::Item
def weight
if @weight.nil?
weight_checker
return @weight
else
return @weight
end
end
def weight_checker
@weight = self.note =~ /<Weight: (.*)>/i ? $1 : 0
end
end
def weight
if @weight.nil?
weight_checker
return @weight
else
return @weight
end
end
def weight_checker
@weight = self.note =~ /<Weight: (.*)>/i ? $1 : 0
end
end
Code in common events:
The thing is, it breaks on the 1st line after "else" in the common event with a " "weight" not found for nil:nilClass "
how do I define "weight" properly?


