じ☆ve冰风 发表于 前天 10:14

[Intermediate and Scriptless] How to make an inventory/menu with events only

This tutorial will show you how to make event based interface without requiring any scripting.

Disclamer: Willnot provide any graphic to base on.

Requirements: Paint.net (or any other image editor that supports transparency).

1. Preparations.
First before starting, you will need to have an idea of what you want in your inventory/menu, if your game is multi-language hardcoded, don't forget to take this into consideration. Also don't forget to disable the default menus via an event at fist occasion.

2. Interaction allowance.
You might want to prevent the player to accessing the menu during a specific moment during your game. Create a switch that if enabled, will prevent the menu to open, I personally called it 'menu_lock'. Create another one called 'inv_is_open'. Go in common event create one named 'menu.aviability' and insert the following and create empty common event if needed:
Spoiler                 Code:        
Triggered by: None
if B key is pressed
if switch 'inv_is_open' = off
   PlaySE {sound effect name here, if none ignore}
   Common event: 'inv.handler.open'
   Common event: 'inv.handler.cursor'
   Common event: 'inv.handler'
   Wait 10 frame
   Switch 'inv_is_open' = true
else
Common event: 'inv.handler.close'
end






Now create an event on any of your game map that you want and do the following:
Spoiler                 Code:        
Type: Parallel process
Content:
Call Common Event 'menu.aviability'
Note: Place the event either in void, in a collision or above
the player, also don't give it any charset.






Once done, copy the event to all maps that you want your menu to be accesible.

3. Menu background and text.
Create a background to go with your menu; include text in it if it is not flexible (cannot be affected in any way by the gamne state). If you didn't knew already, an RPG Maker VX Ace game default dimensions are 544 x 416. If you want to replicate the default RTP font follow the following steps:
This method is for Paint.net only.
1. Write in white in Verdana size:14.
2. Create a shadow under it. (Duplicate that is fully blackened with the saturation effect).
3. Photo glow with values: 1, -100 -100
4. Create 5 layer duplicate (with first, 6 layers shadow layer total)

Once you have designed your menu background, it is time for "flexible" text, create multiple images with the value changed, oif there is alot of possible values (like stats), consider creating base text (exemple: Your attack level is: ) and then create individuals image that contain the digit 0 to 9.

You will also need to create a cursor, there is two way of creating a cursor image: Eitheir you create a fixed image size and make the cursor move position in relation to the possble cursor slot or just makeone cursor picture (simpler - especially if you are going to go for a complex menu).

4. Graphic display.
Go to your 'inv.handler.open' common event and insert the following:
Spoiler                 Code:        
Triggered by: None
Set variable 'cursor.slot_id' to 0
Show picture n°50 (this your background)
Show picture n°51 (this the "non-flexible" text)
Common event 'inv.display_stats'
Set variable 'cursor.X' to (value you want want)
Set variable 'cursor.Y' to (value you want want)
Show picture n°53 at X Y (with aforementionned variables) (this you cursor default position)






Now in the common event 'inv.handler.cursor' this where you will need to set where the cursor will go for each selectable thing in your menu. Exemple:

Spoiler                 Code:        
Triggered by: None
if variable 'cursor.slot_id' = 1
Move picture n°53 at X Y
else
end






Create multiple conditonal branches according to your needs.

5. Cursor updating and button press.
Now we need to get the cursor to move and update its position. In the common event 'inv.handler' you will need to insert the player arrow keys input. Here's an example:
Spoiler                 Code:        
Triggered by: Parallel Process Conditional switch: 'inv_is_open'
if switch 'inv_preventing' = off
if right key is pressed
if variable 'cursor_slot_id'= 0
Play SE {sound effect name here, if none ignore}
Set variable 'cursor_slot_id' to 1
Common event 'inv.handler.cursor'
Wait 30 frame
Else

Else
Else
End
If C key pressed
If variable 'cursor_slot_id' = 1
Play SE {sound effect name here, if none ignore}

Else
End






If you want to make a save/load game function here some script call to help you:
Spoiler: Save game (script call)                 Code:        


DataManager.save_game(0)Spoiler: Load game (script call                 Code:        


if DataManager.load_game(0)
$game_system.on_after_load
SceneManager.goto(Scene_Map)
EndSpoiler: Check if savegame exist                 Code:        


If File.file?('Save01.rvdata2')

Else
End
6. Making the interface close
Go in 'inv.handler.close'and do the following:
Spoiler                 Code:        
If switch 'inv.close_prevent' = off
Set switch 'inv_preventing' = on
Delete image n°X (delete all the images you used in your menu)
Play SE {sound effect name here, if none ignore}
Set switch 'inv_is_open' = off
Set switch 'inv_preventing' = off






I hope this tutorial helped you to understand the basic on how to make event-based interfaces. If you have trouble making the player to stop while the interface is open, make a common event to change the tileset or get a script that allow you to prevent the player to walk if a switch is on.





本贴来自国际rpgmaker官方论坛作者:manpaint处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/intermediate-and-scriptless-how-to-make-an-inventory-menu-with-events-only.87971/
页: [1]
查看完整版本: [Intermediate and Scriptless] How to make an inventory/menu with events only