设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
搜索附件  
同能RPG制作大师 › 附件中心 › 同能RM技术讨论区 › RPG Maker XP 讨论区 › [RMXP] Item-Based Flashlight System-2.jpg

[RMXP] Item-Based Flashlight System-2.jpg

 

[RMXP] Item-Based Flashlight System:
This tutorial is how to make an item-based flashlight system, which allows the player to toggle the flashlight on and off from the item menu. No scripts. No huge amounts of parallel process events on each map. All common events. In order to start the tutorial, you need to download the two (2) attached images first.





I'm no coder, this is simply from about two hours’ worth of frustration and knowing how to make a picture follow you on the map. If you have any questions or get stuck, go ahead and badger me for answers.

~///~​

 ​

STEP ONE
THE SWITCHES


Possibly the easiest part of this tutorial. Head into the Event Commands panel and then select Control Switches. Next, you simply have to create a switch and call it Flashlight ON.



Aaaand that's it! No more switches to make. Onto the next step.

STEP TWO

CREATING THE COMMON EVENTS

To those who're new to RMXP, common events can seem daunting but trust me - they can save you a lot of time, effort and lag in your game. To start off, you need to make three (3) common events. Name however you'd like personally, but to help follow, name these Flashlight OBTAIN, Flashlight ON and Flashlight OFF.



Both Flashlight OBTAIN and Flashlight OFF need to be blank. That means they have no trigger and no condition switch.

However Flashlight ON needs to have a parallel trigger and the switch set to be flashlight ON.





Nothing more can be done until we next create the actual flashlight items.

STEP THREE
THE FLASHLIGHT(S)

In the Items section of the Database, you need to create two (2) separate flashlights. Doing this is crucial as it allows the ability to toggle the light on and off whilst making it still seem to be the same item to the player. Name them identically as Flashlight, and then change everything to look just like in the picture. In this tutorial, they will be listed as Flashlight 001 and Flashlight 002 for clarity. You don’t have to add a Menu Use SE, but I prefer to add one.





Two main things about the flashlights is that:


  • They can't be consumable. This means that when the player "uses" the flashlight, it appears whilst using them to be as if it's used up by having the amount value drop from one (1) to zero (0). This is incorrect as in reality, all the character is doing is flicking a switch on the torch.
  • Their common events are different. With Flashlight 001, the common event will be set to Flashlight GAIN whereas with Flashlight 002, the common event will be set to Flashlight OFF.
If both of your flashlights look like this, you’re set to go back to the Common Events.

STEP FOUR
THE COMMON EVENTS – REDUX


Go to Flashlight OBTAIN and create two events – one which will decrease (and remove) Flashlight 001 and then one which will increase (and add) Flashlight 002. This is so that when the player “turns on” the flashlight, the item which “turns on” the flashlight will be removed and replaced with the item that “turns off” the flashlight.



Finally underneath, add a control switch what will turn on flashlight ON, as well as the next common event, Flashlight ON.



Go to Flashlight ON now. Start by creating an Erase Picture event. Make sure that this picture is set to two (2) otherwise it won’t work. After this, select Change Screen Colour Tone and set it to how it is in the picture. You can have it your own way, but personally I think this one works well with the flashlight / darkness on screen pictures.



Next is the fiddly bit which will make the image that appears on screen actually follow your character. Select Control Variables and then create two (2) separate variables - Player X and Player Y. For now, only use Player X. Have the Operation to be Set and then have the Operand to be the Character's Screen X. Be careful that it is definitely SCREEN and not MAP, otherwise it won't follow you, which is a common mistake. Repeat the process again, but change everything from X to Y.



Finally to add the flashlight image. Select Show Picture and set it to number two (2). Use the flashlight graphic you downloaded from here. Make sure that the Variable is set to Player X for X and Player Y for Y. This means that the image will be recognised as the one that is going to be following you about.



When this is finished, you can now move onto the last common event!

Select Flashlight OFF. This common event is the easiest, as you've already put down everything you needed, it's now just a matter of copy-pasting with minor changes. Go back to Flashlight GAIN and copy-paste everything from there to Flashlight OFF.

Reverse everything. This now means that Flashlight 001 is increased, Flashlight 002 is decreased and the switch is turned off, as in the picture below.



Next, go back to Flashlight ON and once again, copy-paste everything over toFlashlight OFF. Like before, edits are needed. Though thankfully not much needs to be changed. Go to Erase Picture and change it to two (2) before simply changing the Show Picture to display the second picture you downloaded here - the completely black one. This means that when the flashlight is "turned off", it goes back to darkness.



If you do not want this to happen, simply delete the Control Variables and Show Picture section of Flashlight OFF, before setting the Change Screen Colour Tone back to default. This is handy if you have a flashlight that is simply a glow around the character.

I advise before playing about in RMXP to see if it worked to double check if you've got everything right! That might save you the trouble (and frustration) of thinking this doesn't work. If problems still appear, like I have stated before, go ahead and badger me! cc:


本贴来自国际rpgmaker官方论坛作者:b a c t e r i a处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/rmxp-item-based-flashlight-system.31971/
[RMXP] Item-Based Flashlight System-2.jpg
         同一主题附件:
    [RMXP] Item-Based Flashlight System-1.jpg
    [RMXP] Item-Based Flashlight System-2.jpg
简体中文
繁體中文
English(英语)
日本語(日语)
Deutsch(德语)
Русский язык(俄语)
بالعربية(阿拉伯语)
Türkçe(土耳其语)
Português(葡萄牙语)
ภาษาไทย(泰国语)
한어(朝鲜语/韩语)
Français(法语)
关闭

幸运抽奖

社区每日抽奖来袭,快来试试你是欧皇还是非酋~

立即查看

Loading...

QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

GMT+8, 2026-10-3 10:30 , Processed in 0.064004 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

返回顶部