设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
搜索附件  
同能RPG制作大师 › 附件中心 › 同能RM技术讨论区 › RPG Maker MV 讨论区 › Custom battle results without plugins: Custom battle results without plugins-3.jpg

Custom battle results without plugins: Custom battle results without plugins-3.jpg

 

Custom battle results without plugins:
Introduction:
This tutorial shows a method to control random encounters using a common event, so you can customize the results of the battles, for example, transfer the player to the respawn point.

What do you need?
1. a parallel common event
2. a switch to turn on/off this common event
Here's a screenshot and text of the common event. You can use it directly, or read on.




◆If:Script:SceneManager._scene.isSceneChangeOk() && !SceneManager.isSceneChanging() && !$gameMap.isEventRunning() && $gamePlayer._encounterCount <= 0
  ◆Script:$gamePlayer.makeEncounterCount();
  ◆Battle Processing:Same as Random Encounter
  :If Win
    ◆Comment:Insert commands here
    ◆
  :If Escape
    ◆Comment:Insert commands here
    ◆
  :If Lose
    ◆Comment:Insert commands here, simple gameover or not.
    ◆
  :End
  ◆
:End

Explain:
This common event should work both on MV and MZ. So I only use MV for example, because they are pretty much the same.
The engine uses several classes to control its random encounters.
1. System settings. There's a event command you can turn random encounters on/off.
2. Game player. The player has a count down value _encounterCount, that decreases over time, to check if a random encounter needs to occur.
3. Game party. There are two traits, half encounter and no encounter.
4. Game map. There are several properties, like encounter list(troops, weight, regions, etc), encounter steps, the later is used to generate game player's _encounterCount.
5. Scene map. Here's the control center, there are several update functions check random encounters and execute them.

So we only need to simulate the steps, and 'intercept' the encounter before scene map triggers it.
Fortunately, the common event runs before the scene's encounter update function, so we have this solution.

Check the source code of the engine, we can find those conditions:

rpg_scenes.js
line 715: !SceneManager.isSceneChanging()
line 590: SceneManager._scene.isSceneChangeOk()
rpg_objects.js
line 7599: !$gameMap.isEventRunning() && $gamePlayer._encounterCount <= 0

After the condtions are checked, we need to reset $gamePlayer._encounterCount,
so we use the code from line 7600: $gamePlayer.makeEncounterCount()

After that we just need to start the battle. There's already an event command battle processing, so we use it.



Make sure to check those options, and you are done.
Notice: If there're no random encounters on the map, nothing will happen but the event command will still continue, so be careful if you put any commands after the battle.





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

幸运抽奖

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

立即查看

Loading...

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

GMT+8, 2026-10-3 12:27 , Processed in 0.096226 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

返回顶部