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,875
Reaction score
6,677
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

imgur sure is getting weird, one day I lose gradually all my images, the other I get them back randomly and then again they disappear again.
Despite OPT2 praise it still has some strange stories in it. Lady Mikka is trying to work herself to death because of guilt. Guilt over what? ¯\_(ツ)_/¯ So instead of finding a NPC to have a heart to heart with her they decide the cure is a new kimono. So when she drops dead she'll at least be well dressed. I haven't even got to the strange part yet.
Did so much work on the game today. I wish I could post it all in this status update but there is a character limit of course haha. I thought about making a topic for updates, though... maybe.
The most recent sign that I am old. I have done martial arts for over 4 decades. Never HAD to stretch out. Good, of course, but never required. Was doing some kicks in the kitchen because, why not, and I felt a pop in the back of my thigh. Now I am limping around. Gotta love getting old.
One of the biggest perks of being fluent in English is how many new and interesting recipes I am able to find and try out that I would have hardly come across if I just spoke my mothertounge :3

Forum statistics

Threads
131,683
Messages
1,222,227
Members
173,435
Latest member
TheAmplifier
Top