Menu Is Closing *SOLVED*

Started by Seltzer Cole, December 02, 2013, 03:13:38 pm

Previous topic - Next topic

Seltzer Cole

December 02, 2013, 03:13:38 pm Last Edit: December 10, 2013, 06:49:16 pm by Seltzer Cole
.

When I go into my inventory and use an item, it uses it but automatically closes my inventory. How do I change this so that the inventory remains open until I decide to cancel out?

Quote from: gameus on May 06, 2013, 09:33:23 pm
Go into Scene_Item, line 71. Change this:
$scene = Scene_Menu.new(0)

to this
$scene = Scene_Map.new


Then to open the item menu through your events, use a Script Call:
$scene = Scene_Item.new



I am currently using the above method to call my inventory. Not sure if it is causing the issue or not but figured I would let you all know in case it is. Thanks.

.
You know you play video games to much when you put sunglasses on and whisper "Plus 10 Appearance"

If at first you don't succeed, call it version 1.0

KK20

Are you talking about items that call common events?

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

ForeverZer0

As KK20 has said, your item being used must have a common event it is calling when used, or you are using a custom menu system, in which case you would need to post the script up so someone can look at it.  The default system only closes the window if the item being used has a common event attached to its use.

If you simply want to do away with this happening, find the "update_target" method in Scene_Item, and find this section:
        # If common event ID is valid
        if @item.common_event_id > 0
          # Common event call reservation
          $game_temp.common_event_id = @item.common_event_id
          # Switch to map screen
          $scene = Scene_Map.new
          return
        end


Make it look like this:
        # If common event ID is valid
        if @item.common_event_id > 0
          # Common event call reservation
          $game_temp.common_event_id = @item.common_event_id
        end


Beware that this could cause issues depending on what common events are doing when an item is used.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Seltzer Cole

Quote from: ForeverZer0 on December 02, 2013, 07:26:24 pm


Yeah the item I am using is calling a common event to be used but it is closing the inventory screen. I am not using a menu script of any kind. I just have the main menu disabled and a parallel process that runs so when you open the menu it instead takes you to your inventory and not the main menu.

Apparently the common event thing is what is closing the menu. I doubt I will edit the Scene_Item anymore since I don't want issues happening lol.

Why does the game close your inventory if an item used calls a common event? That doesn't make sense. Why not keep it open?
You know you play video games to much when you put sunglasses on and whisper "Plus 10 Appearance"

If at first you don't succeed, call it version 1.0

Sase

@Seltzer Cole
Common events can do so much different things, like teleport the player to another map, cause some dialogue, move events around etc. so it's only logical this happens.

ForeverZer0

Making the edit will cause issues if your common events do things as Sase mentioned above.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Zexion

Have you tried adding a script call at the end of your common event? Just add $scene = Scene_Item.new

KK20

Not to mention, the only scenes that can execute a common event are Scene_Map and Scene_Battle. Zexion's solution is pretty much the closest thing you can get to what you want without causing errors.

if $scene.is_a?(Scene_Map)
$scene = Scene_Item.new
end

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Seltzer Cole

Quote from: Zexion on December 03, 2013, 03:38:08 pm
Have you tried adding a script call at the end of your common event? Just add $scene = Scene_Item.new


I have the menu disabled as in my original post states. I have a parallel process in a common event that will open your inventory screen (not the main menu, just the inventory screen that displays your items) using $scene = Scene_Item.new.

My question was, why when I use for example, some item of any kind while the inventory screen is open, that is set to call upon a common event to do whatever purpose I have given it, my inventory screen will cancel out? Doesn't the inventory screen remain open at all times until you tell the game to cancel out? Why does it automatically do so and is there a way to fix that.

EDIT : Unless however, you meant add the script call in the common event that the item is calling o.o LIGHT BULB!!
You know you play video games to much when you put sunglasses on and whisper "Plus 10 Appearance"

If at first you don't succeed, call it version 1.0

ForeverZer0

It is supposed to close if the item calls a common event, this is the desired behavior.
Traditionally, normal menu-use items do not call common events, as it is usually reserved for "special" items and what-not, but as in your case, this isn't always true.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

KK20

It's almost like you ignored my post completely.
Quote from: KK20 on December 03, 2013, 04:23:16 pm
Not to mention, the only scenes that can execute a common event are Scene_Map and Scene_Battle.

If you were to stay in Scene_Item when using an item that calls a common event, it wouldn't do anything. And as F0 posted earlier:
Code: Scene_Item class

        # If common event ID is valid
        if @item.common_event_id > 0        #<======= Basically says if the item you selected calls a common event
          # Common event call reservation
          $game_temp.common_event_id = @item.common_event_id   #<=== Common event stored in memory so that when you return to Scene_Map, it will execute the common event
          # Switch to map screen
          $scene = Scene_Map.new  #<======= Effectively closes out of your Scene_Item
          return
        end

It's not just you. If we use an item to call upon a common event, we would get the exact same experience as you. This is not a bug. This is not a flaw. This is how it is supposed to work because doing it any other way would cause more problems.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Seltzer Cole

Quote from: KK20 on December 03, 2013, 11:57:04 pm
It's almost like you ignored my post completely.
Quote from: KK20 on December 03, 2013, 04:23:16 pm
Not to mention, the only scenes that can execute a common event are Scene_Map and Scene_Battle.

If you were to stay in Scene_Item when using an item that calls a common event, it wouldn't do anything. And as F0 posted earlier:
Code: Scene_Item class

        # If common event ID is valid
        if @item.common_event_id > 0        #<======= Basically says if the item you selected calls a common event
          # Common event call reservation
          $game_temp.common_event_id = @item.common_event_id   #<=== Common event stored in memory so that when you return to Scene_Map, it will execute the common event
          # Switch to map screen
          $scene = Scene_Map.new  #<======= Effectively closes out of your Scene_Item
          return
        end

It's not just you. If we use an item to call upon a common event, we would get the exact same experience as you. This is not a bug. This is not a flaw. This is how it is supposed to work because doing it any other way would cause more problems.


I never said it was a bug, just asked why it has to be like that. But I actually stuck in $scene = Scene_Item.new into the common event the item calls so the second your inventory closes, it opens right back up lmao. There is a slight second where you see the map but it works...kind of. I will probably end up making my own menu in the near future.
You know you play video games to much when you put sunglasses on and whisper "Plus 10 Appearance"

If at first you don't succeed, call it version 1.0

Zexion

You could just make the item play some kind of animation before returning to the menu. That would make it seem like it was supposed to do that all along lol
E.g.
ITEMS STUFF HERE
Play Animation
Wait x frames (equal to animation + 20ish)
scene_item

Seltzer Cole

Quote from: Zexion on December 05, 2013, 10:13:18 am
You could just make the item play some kind of animation before returning to the menu. That would make it seem like it was supposed to do that all along lol
E.g.
ITEMS STUFF HERE
Play Animation
Wait x frames (equal to animation + 20ish)
scene_item


Good idea. I will test this out. Some kind of item animation would definitely make it more appealing than a quick flash to the map and your inventory randomly reopening.  :)
You know you play video games to much when you put sunglasses on and whisper "Plus 10 Appearance"

If at first you don't succeed, call it version 1.0

ForeverZer0

What exactly does the common event do? 
I personally don't think the idea of the menu closing, playing an animation, and reopening sound appealing. Now this is simply my opinion, but I would be annoyed at such a thing happening when I used an item.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Seltzer Cole

December 08, 2013, 10:30:33 am #15 Last Edit: December 08, 2013, 10:32:15 am by Seltzer Cole
Quote from: ForeverZer0 on December 06, 2013, 04:58:17 pm
What exactly does the common event do?  
I personally don't think the idea of the menu closing, playing an animation, and reopening sound appealing. Now this is simply my opinion, but I would be annoyed at such a thing happening when I used an item.


I am not using the menu that comes with the game because I am eventing my own ABS game. The menu the game comes with is completely unecessary as it contains a ton of crap I will not be using. So I disabled it and have a parallel process where you can manually call your item menu and equip menu.   :^_^':

When you use an item, for example a healing item, it calls a common event to use so it can change the variable which is your HP. Basically any item you will be using will close the item menu lol. I can probably stop this by making my own custom menu which I have done before (tons of eventing...) but idk yet. The fact that all of you have pointed out, that the menu will not close during the map or battle scene, sucks for me. Even if I added in my own custom menu through events, such as 2 boxes on your screen which is keyed to X and Z for example, in order to stick items in those 2 slots you would still have to go to your inventory screen, which would close it out on you.

No matter what, when you use a healing item it calls your HP common event so I would need a way for the game to call upon that common event. Which means the item would have to call it, therefore closing the inventory menu.

Basically, I am shafted all ways unless I just stick someones script in my game, which I am trying to avoid atm.
You know you play video games to much when you put sunglasses on and whisper "Plus 10 Appearance"

If at first you don't succeed, call it version 1.0

ForeverZer0

I am curious why would you would need a common event to change the HP of the character, since this would be done automatically through the Scene_Item when the item is used. If you are trying to avoid the using menus at all when items are used, and using the boxes as you described above, it would make more sense. Other than that, if you don't want to make the little edit to the script, it's going to be tricky just using events.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

KK20

Quote from: ForeverZer0 on December 08, 2013, 12:34:37 pm
I am curious why would you would need a common event to change the HP of the character, since this would be done automatically through the Scene_Item when the item is used.

This.

Generally people make items call common events for the following:
- Open a new scene (e.g. Journal, Map)
- Effect is only visible on map (e.g. Escape Rope, Repel)
- Activate switches (e.g. "You used the Pokeflute. Snorlax woke up!")

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

G_G

He did say he was making his own abs. Maybe he has the characters health as a separate variable rather than using the built in functions to keep track of the actors actual health.

Seltzer Cole

Quote from: gameus on December 09, 2013, 12:31:03 am
He did say he was making his own abs. Maybe he has the characters health as a separate variable rather than using the built in functions to keep track of the actors actual health.


Yeah I am using a variable to keep track of it. It also displays your health on the screen by seeing what the variable is at so it knows how much to display. I would just use the regular commands like "Change HP" or "Change Parameters" to give you more HP or Heal you at save points but I realized that there is nothing relating towards your HP in Conditional Branches... Which means when it calls the common event to check how much HP you have to display it on screen, it couldn't. Also since I am using the equipment screen, I like how it displays your level. So I kept that feature and I don't want the game levels messing with your HP or me having to add in a hp curve to your level. It is just easier for me to use a variable.

But hey, thanks everyone for giving me some insight and explaining how the script of the inventory screen works when calling a common event. I will just end up adding two small boxes on your screen keyed to two keys so you can add whatever 2 items you want to those 2 boxes. Would be better that way so you wouldn't have to open your inventory screen constantly to heal...just to have it close on you.  :O.o:
You know you play video games to much when you put sunglasses on and whisper "Plus 10 Appearance"

If at first you don't succeed, call it version 1.0