Add item with variable

adder

Villager
Member
Joined
Apr 1, 2016
Messages
5
Reaction score
1
First Language
spain
Primarily Uses
Hi, I would like to know if it would be possible to add an object based on one variable and the quantity based on another variable, I am trying to do it through the script call

$ gameParty.gainItem ($ dataItems [itemId], n);

But I don't know how to add in variable 1 in "itemId" and in variable 2 in "n". Would it be possible to do this?

I work with the RPG Maker MV in case that changes anything.

Thanks in advance.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,059
Reaction score
1,483
First Language
EN
Primarily Uses
RMMZ
Try this in a Script command:
JavaScript:
var itemId = $gameVariables.value(1);
var count = $gameVariables.value(2);
$gameParty.gainItem($dataItems[itemId], count);
:)
 

Rubescen

Veteran
Veteran
Joined
Jan 4, 2016
Messages
156
Reaction score
174
First Language
English
Primarily Uses
RMMV
$gameVariables.value() is the reference you want.

JavaScript:
$gameParty.gainItem($dataItems[$gameVariables.value(1)], $gameVariables.value(2));
edit: caethyril in before me by seconds with a slightly different variant! :D
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts


My only regret is the portal mirror effect is too subtle to show up in these GIFs. It probably just needs more sparkles. :LZSwink:
Microsoft: Hey, let's waste money advertising the Xbox Series X when nobody has any in stock, we don't seem to be making more, we aren't taking preorders and you can't get on a waiting list. BEST. IDEA. EVER.
So I'm practicing ITC with a spirit box, and decide to try to contact my deceased soulmate. It actually gave me multiple identifiers. Me, still a bit skeptical, asked aloud "Fine but does he still love me?" and the box spoke and printed the word "Forever" at the same time. Been a mess of tears since. :kaocry:
Been scratching away at my game and making progress, but just had a revelation. I'm working in full screen and adjusting all my pictures accordingly, but will they resize if someone's screen is smaller?? I hope this doesn't turn out to be a problem later.

Forum statistics

Threads
105,636
Messages
1,015,185
Members
137,310
Latest member
MistysKarma
Top