じ☆ve冰风 发表于 前天 09:33

[Tutorial] 姫HIME’s End Phase Trigger Script

Hello everyone,

Some of you might have stumbled across one of my previous thread thread about how I am unable to update the kill count for a quest. Took me awhile but I finally managed to figure out that the troops event gets ignored once the last monster dies in a battle. I tried A LOT of things and all I came across were roadblocks after roadblocks. I am so close to giving up and take the easy way out by having the quest mobs appear through event instead of random encounter. It was then I decided to give Tsukihime's End Phase Trigger script a go.

Some times RPG have their own unique battle system that is slightly/very different from the other RPG, and the developer wanted to help familiarize players to their game's unique battle system in the middle of an actual combat. We can simply program the event in the Troops page to do just that (from now on, we will refer to such event as "troops event"). There seems to be no limit to how we can customize the troops event. The only problem is that the troops event is completely ignored once the last monster is killed. This makes it impossible for developers to do things like customized item drop (without using scripts), or simply just to show a dialogue between the actors for the sake of roleplaying.

What is Tsukihime's End Phase Trigger Script?

Tsukihime's End Phase Trigger script checks all the troops event page when a victory/defeat condition has been met. The script allows the execution of troops event for when the last monster/the player is defeated instead of ignoring such events completely upon victory/defeat. Any event(s) that can be run during this phase will be executed before ending the battle.

How to install Tsukihime's End Phase Trigger Script?

All we need to do is to copy the script from Hime's website (click here), open the script editor (F11) and insert it under the "▼ Materials section" and above the "▼ Main Process section". That's all you need to do. Refer to the screenshots in the spoiler below if you are new to adding custom scripts.
 

Spoiler















That's all there is to it. Just a simple plug-and-play script.



 
What can I do now that I have installed the script?

Example 1 -- Simple Quest:
Let's say that we want to create a quest where we ask players to slay 3 Dragons and assuming that the only way we will come across these Dragons are through the random encounter event in the map. In order to do this, we need to program the troop event page (F9 > "Troops" tab) to check if the Dragon is slain, and then increase the kill count by 1. Assuming that we already have a troop that consists of two Dragons, what we need to do next is to check if the Dragon is slain (check if each dragons' HP is at 0% or less). If the Dragon has 0% or less than 0% HP, we will increase the variable "Dragon Kill Count" by 1.





Simple enough. So far we have only checked if Dragon #1 is dead. Now we need to do the same for Dragon #2, so we will click on the "New Event Page" button in order to create a second event page. Once we have created the second event page, we will be doing the same thing as we did in page 1--check to see if Dragon #2 is at 0% HP or less. If Dragon #2's HP is equal to or less than 0%, then increase the Dragon Kill Count variable by 1.









Normally this does not work because the troops event are completely ignored once the last monster is dead. However with Hime's script installed, you have nothing to worry about. Just do the same for Dragon #2's event and you are done. So whenever you kill a dragon, you will definitely get that +1 Kill credit.

Note:Truthfully, I would have added a few extra switches, such as one switch to check if the quest is active before increasing the kill count by +1 for each dragon kill, for my actual event. We don't need the variable to keep increasing while the quest is not active. I wanted a short, clean example without anything unnecessary. 

Example #2 -- Prevents player from getting killed:
Let's say that you don't want to get the player killed in certain battles. All we need to do is to check if the player's health is at 0% or below (you can set it as any value between 1-100% instead of 0%) and then use the Recover all method to restore player's health.

Normally this does not work if your HP reaches 0% or lower. You will be taken straight to the game over screen and your game will end. Now that you have Hime's script installed, the troops event will continue to process before a winner is determined, and the recover all method will heal your actor back to full health and the battle continues on.

There are endless other possibilities about what you can achieve with this script.

If you are having issues with things not working, I suggest that you take a look at TsukiHime's website (click here). Hime has a lot of other scripts available for many other things. Please take a minute to read through the terms of use for each script before using it on your own project. The terms of use can be found on the actual script page. Hime's scripts are free for non-commercial projects. For commercial projects, please contact Hime through the website to purchase a commercial license.

Edit: Fixed broken images


本贴来自国际rpgmaker官方论坛作者:Sinweaver处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/tutorial-himes-end-phase-trigger-script.44537/
页: [1]
查看完整版本: [Tutorial] 姫HIME’s End Phase Trigger Script