Change Hero graphics depending on equipment
This tutorial will show you step by step how to change your Hero's sprites (in-battle as well as overworld) and facesets depending on what equipment they currently wear.1.GRAPHICS
First of all, you need to have graphics of your Hero's sprites and facesets wearing different kind of suits, and import them into your project. Make sure your graphics have the correct dimensions and are 256 colour PNG files.
2. DATABASE
Open your Database, under the Actors tab set your Hero's starting equipment and graphics. Go to the Classes tab and create entries for each of your Hero's suits. Go to the Animations 2 tab and create entries for each of your Hero's suits.
Also, under the Item tab, create entries for all the suits you want your Hero to be able to equip.
3. COMMON EVENTS
In the Database under the Common Events tab, create entries called Update Sprites, Store Hero Data and Call Hero Data.
4. UPDATE SPRITES
Set the common event called Update Sprites trigger to a Parallel Process.
Event Command -> Call Event
Call Common Events: Store Hero Data.
Event command -> Conditional Branch
Variable: If Hero Suit is not equal to Current Hero Suit
Create entries for both these variables; they will be set later in the tutorial.
Event command -> Conditional Branch -> Tab 2
If Hero has Suit 1 equipped... and check Execute Custom Handler if Condition Not Met.
Event Command -> Change Actor Class
Set Hero's class to the class corresponding to the equipped suit you selected in the Conditional Branch, and have no change occur to anything since we're only updating graphics.
Event Command -> Change Actor Graphic
Select your Hero and its correct sprite.
Event Command -> Change Actor Faceset
Select your Hero and its correct faceset.
Event Command -> Change Equipment
Select your Hero and make him change into the equipped suit.
Branch End.
Event Command: Control Variables
Set Current Hero Suit equal to variable Hero Suit.
Event Command -> Call Event
Call Common Events: Call Hero Data.
Event Command -> Wait
Set Time 0x0.1 seconds to prevent lag.
Under the Else of your Conditional Branch you put the same line of events for other suits for your Hero. This is an example of what it would look like for a Hero that has graphics for 2 different suits and 1 for if he isn't wearing any suit:
http://i.imgur.com/Pi9Hcxe.png
5. STORE HERO DATA
Set the common event called Store Hero Data trigger to None.
Event Command -> Variable Operations
Open Single Variable for the variables list. Next, make entries for all the variables you're going to need for this part:
-Weapon
-Shield
-Helm
-Accessory
-EXP
-Max HP
-HP
-MP
Create variables events for each of these categories set equal to your Hero's individual stats and equipment pieces.
Event Command -> Change HP
Decrease your Hero's HP by variable Hero HP.
Event Command -> Change MP
Decrease your Hero's MP by variable Hero MP.
Event Command -> Change EXP
Decrease your Hero's EXP by variable Hero EXP.
6. CALL HERO DATA
Set the common event called Call Hero Data trigger to None.
Event command -> Conditional Branch
Variable: If Hero's equipment piece (do this for each piece of equipment) is not equal to 0.
Event Command -> Change Equipment
Change your Hero's equipment to the pieces you stored in each variable in step #5.
Branch End.
Event Command -> Change HP
Increase your Hero's HP by variable Hero HP.
Event Command -> Change MP
Increase your Hero's HP by variable Hero MP.
Event Command -> Change EXP
Increase your Hero's HP by variable Hero EXP.
Event command -> Conditional Branch
Variable: If Hero's max HP is not equal to Hero's current HP.
Event command -> Conditional Branch
Variable: If Hero's current HP is not equal to 1.
Event command -> Change HP
Decrease your Hero's HP by 1.
Branch End.
7. TEST
If you followed these steps correctly, it should be working now. If not, feel free to ask questions.
本贴来自国际rpgmaker官方论坛作者:Milennin处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/change-hero-graphics-depending-on-equipment.39350/
页:
[1]