Scripting Help - Random Items Awarded not showing name of Item in text box

Kiros_Skye

Warper
Member
Joined
Sep 29, 2020
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMMZ
So I am having a weird issue with random items being awarded when an event is triggered.

What I want to happen is:
Actor opens a chest
The engine randomly cycles through possibilities of items to be given
Engine picks an Item
Game text tells what Item you have gotten
Appropriate Item appears in inventory

So I got everything to work except for it to tell me the appropriate item.
It just gives me the variable but not the actual item.
The item does appear in inventory like it should but the name of the item does not show up in the message box.

The code I am using is here

1601399632270.png

And here is what I normally get
1601399997098.png

The part of the code that awards money works fine. Its just the items that I am having an issue with.
I appreciate any help I receive from this.
 

Daalaff

Villager
Member
Joined
Jun 2, 2014
Messages
10
Reaction score
2
First Language
German
Primarily Uses
RMMV
you cannot write [\v[2]], it only works \v[2]
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,936
Reaction score
1,386
First Language
EN
Primarily Uses
RMMZ
Try adding this line to the end of your Script command:
JavaScript:
$gameVariables.setValue(3, $dataWeapons[rWep].name);
...then change your Show Text command to:
  • You've obtained a \v[3]!
The extra line of script says "store the weapon's name in game variable 3". The value of that variable (now a string of text) is shown to the player in a message. :kaopride:

Also, to clarify: you can nest text codes, e.g. \v[\v[2]] becomes "the value of the variable with ID equal to the value of variable 2" (so if variable 2 equals 5, it shows the value of variable 5). However, by default the engine does not have a text code for "weapon name".
 

Kiros_Skye

Warper
Member
Joined
Sep 29, 2020
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMMZ
Thanks everyone.

Caethyril's solution saved the day!
 

SpookyOn3

Villager
Member
Joined
Sep 29, 2020
Messages
22
Reaction score
2
First Language
English
Primarily Uses
Other
lol I did same thing put extra ] and was like ITS not WORKING!!!
 

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

Latest Threads

Latest Profile Posts

I worked a lot more today and I am thinking about Youtube videos to make to my channel, but I am still looking for some content :D

But I am happy to be back at work :D
Update... no scam calls all day. I think they learned their lesson. And I'm working on a fake anti-piracy video, featuring a fan game I'm making in MV. If I had the permission to make the game a licensed game that I could sell (rather than having it totally free like fan games are required to be), I'd use a really cool anti-piracy screen...
People2_1 added! ( with alternative hairstyle )

Hey there fellow makers!

just looking for an excuse to post this, really... :kaoslp:

Forum statistics

Threads
104,356
Messages
1,005,798
Members
135,868
Latest member
LuxRae
Top