Status
Not open for further replies.

Bricabrac

The Storyteller
Veteran
Joined
May 24, 2016
Messages
113
Reaction score
218
First Language
Italian
Primarily Uses
RMMV
Hello! I am fighting with a small, maddening issue.
I am using the "Select Key Item" script call ($gameMessage.setItemChoice(var, n)) in a common event. And it works well!

upload_2018-9-12_21-57-58.png
My issue: the event runs the second script before I have selected an item in my window, and therefore throws me a "hey, this is undefined" error. I can't figure out how to make RPG Maker wait before running the rest of my code.

I believe this is happening because when you use the command instead of the script call, Game_Interpreter sets a wait mode, while my code doesn't:

upload_2018-9-12_22-5-41.png

I can't, however, find a function to manually set the wait mode myself.
Any advice? Even hackey solutions are welcome. I just want this to work.

Do you really need to use the script call instead of an event command?
Yes!
I made a custom category that shows me only certain items based on a variable. Can't really do this in any other way :V
 

Attachments

  • upload_2018-9-12_22-5-12.png
    upload_2018-9-12_22-5-12.png
    31 KB · Views: 5

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,143
First Language
English
Primarily Uses
RMMV
You've pretty much answered your own question - When you execute code from the Script Event Command, the value of "this" is actually the instance of the Game_Interpreter that is interpreting the event commands. So in the same script command as $gameMessage.setItemChoice you can execute:
Code:
this.setWaitMode('message');
 

Bricabrac

The Storyteller
Veteran
Joined
May 24, 2016
Messages
113
Reaction score
218
First Language
Italian
Primarily Uses
RMMV
When you execute code from the Script Event Command, the value of "this" is actually the instance of the Game_Interpreter that is interpreting the event commands
Oh! I am still a n00b scripter and had no idea about this.
Works beautifully, thanks a lot!
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
8,923
Reaction score
5,848
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

 …I think I might need to switch from standard ATK/DEF up/down buffs to parameter altering states. I just had an actor whose usual attack against an enemy does ~25 do a buffed attack against a debuffed enemy for ~600…
just saw that titan quest is free on steam until the 23rd
Zombie status is now complete. I didn't have to do much in the way of changing how healing is applied to undead targets, was just a simple 3 line code. I thought I had to overhaul Game_Action lol. Everything else was doable by events. So.. Zombie: You turn undead. Your element changes to darkness. You're weak to light, you're strong to physical attacks and healing hurts you and revival items will kill you.
My Overworld might be a mix of inspiration from 2D Final Fantasy games, Breath of Fire, Battlechasers: Nightwar, Super Mario World, and Pillars of Eternity. If I can make it more in-depth than just walking from point A to point B, that might do a lot for the gameplay experience. Hmm...

Forum statistics

Threads
115,226
Messages
1,088,224
Members
149,818
Latest member
JetWentworth
Top