Xina

Veteran
Veteran
Joined
Feb 23, 2019
Messages
37
Reaction score
6
First Language
English
Primarily Uses
RMMV
I've been using variables and switches to have a weight functionality in my game. It's been working well up until I decided I wanted an evented way for the player to discard an item. Then I run into the problem of how to retrieve the item weight. After searching the internet for plugins and not finding anything that quite matched my needs, I decided to use an item's "price" as the item's weight. Since there will be no shops in the game, this should work except that I can't quite get the code to retrieve the price to work!

The event has the player select an item, which is assigned to variable 8 (Item ID).
The Control Variables function sets variable 28 (Item Price) equal to the script:
$dataItems[$gameVariables.value(8)].Price;

I've tried several variations of this code but nothing returns the correct price. What am I doing wrong?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,896
Reaction score
6,700
First Language
English
Primarily Uses
RMMV
There's no property Price with a capital "P", it's just "price". If you replace that letter, the assignment should work correctly.
 

Xina

Veteran
Veteran
Joined
Feb 23, 2019
Messages
37
Reaction score
6
First Language
English
Primarily Uses
RMMV
There's no property Price with a capital "P", it's just "price". If you replace that letter, the assignment should work correctly.
Oh my gosh!! *slaps head* THANK YOU!!! I knew it had to be something tiny and dumb that I was missing. Thank you so much. That was driving me nuts.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,228
Reaction score
11,235
First Language
Czech
Primarily Uses
RMMV
Pro tip. Next time you can open the dev console with f9 and type $dataItems there. This will display the exact member variable names of an object.
 

Latest Threads

Latest Profile Posts

This could probably be an entire thread, but it’s really interesting how replaying a game several years later can change how you relate to a character. I think Tidus from FFX got such a bad rap. I getchu. Completely different reaction as an adult now.
As you see, I still enjoy writing tutorials. Is there anything specific you want to see? (I know mapping and editing/resource making is usually popular, but those are very broad topics)
Well, I wanted to expand player battlers visually and now have 3 sheets and counting for each of my players party.
1. Regular sheet
2. The character has turned stone sheet.
3. Using potions sheet.

Technically the main hero has 4 since he starts with a wooden sword, and I felt that the battler should reflect that until he gets a metal one.

Right back to the RM game dev grind in about 15 minutes. :LZSexcite:
Days ago I gave someone the sage advice not to steer away from your main project or take up another one to abandon the first. After figuring a way that would save me years of development, I am forced to redo a lot of stuff on my own turf, near to remake half of what I have already made.
Somewhere down the line I must have crossed paths with bad karma.
:kaomad2:

Forum statistics

Threads
131,733
Messages
1,222,764
Members
173,485
Latest member
taquing
Top