じ☆ve冰风 发表于 5 天前

Event Action Battle System [MV].

Firstly i want to say that english isn't my native language, but i want to share this method with people that want to create smth new

Alright, in the start I want to show you what are we gonna do:

Event System in Action:

https://www.youtube.com/embed/Hg7SYRvUEyE

Next, plugins and things that we must use:
Spoiler: PluginsYEP — Self Switches & Variables — http://www.yanfly.moe/wiki/Self_Switches_%26_Variables_(YEP)
(or its free analogue, like plugin from HimeWorks: https://himeworks.com/2015/12/self-variables/)
YEP — Keyboard Config — http://www.yanfly.moe/wiki/Keyboard_Config_(YEP) — optional, but usefull plugin. We'll use it to maker reload button not just "Page Up" button, but "R" button.
YEP — Button Common Event — http://www.yanfly.moe/wiki/Button_Common_Events_(YEP) — If you want to change "Page Up" button for other button, but I won't use it because I didn't buy Utility Pack for this moment.
RPG Maker MV, cause idk if analouges of this plugins exists for other versions.
Capable hands to improve this system, because this version is bare framework.
Starting.
On every map, where battles should exist we should create an event that would take info about player. Better to create a common event «Player Info» and use it in future.

We use variables in it:
Spoiler: VariablesPlayer X — variable, that takes X coordinate of player.
Player Y — variable, that takes Y coordinate of player.
Player Facing — takes a value of players directions. Values means:
2 — Player looks down; 4 — Player looks left; 6 — Player looks right; 8 — Player looks up.
Axels patrons — takes a value of item "Pistol Patrons" that player have.




Reload.
Another common event that would be responsible for reloading. In theory, we can complain Reload CE and Player INFO CE, but it would be better if we separate them, than we can complement/edit them separately.

First conditional branch is pressing button, I use PgUp button.
Second conditional branch —test if Player equipped the pistol.
Third — checking how many patrons player have by using variable Axels patrons. Then, if Player has ≥ 7 patrons, we turn on switchReload. After that we are creating movement route for this event, where we submit time of reload in frames. 1 second ≈ 60 frames.
Now we update Patrons in Pistol variable and set its value 7, because pistols magazine has 7 slots.
After that we remove 7 «Pistol patrons» items.
Now we switch Reload to «Off».

Now what we would do if player has < 7 patrons?
Firstly we use conditional branch "if Axels patrons < 7", and secondary if he has more then 0 patrons: Ifvariable Axels patrons > 0, then:
Repeat all actions while it's not changes of variable Patrons in Pistol: we equate it to variable Axels patrons.
After that we remove Axels patrons items of «Pistol patrons», and turn off Reload switch.






Enemy and shooting:
Initially I should say that this system is very, very workaround system. In every enemy would be used minimum one local switch, all enemies would work parallel that may load up PC. If you are ready for that and that you should fix this algorithm, we can continue.


Firstly we create common event «enemy» and 4 local variables in it (use plugins!!!):
Self Var X, that takes coordinate X of this event.
Self Var Y, that takes coordinate X of this event.
Self Var X Difference — variable, that would count X difference between player and enemy.
Self Var Y Difference — variable, that would count Y difference between player and enemy.





Now we take care of agglomerate of conditional branchs:


https://sun9-2.userapi.com/impg/ZRTCrN1D2Nxi2OiSo3vAwHMqmtUCXluVOQZVAw/1DU7i7MZCRA.jpg?size=0x0&quality=90&proxy=1&sign=6090f0d0280189d58a819e6df3113ee2



It looks kinda scary, yeah? Let's talk about how, what and why works here:
Spoiler: Conditional BranchesConditional Branch 1: If button «Ок» pressed — it's easy, just check of player want or don't want shoot in enemy.
Conditional Branch 2: If variable Patrons in pistol > 0 — just checking that player have (or not) patrons in pistol. Don't forget about «Else» branch!
Conditional Branch 3: If Player has equipped item «Pistol».
Conditional Branch 4: If switch Player hit is turned OFF.
Conditional Branch 5.1: if variables Self Var Y and Axels Y equals. If it's true — then player and enemy takes one Y axis therefore player would shoot by X axis.
Conditional Branch 6.1: If Self Var X Difference ≥ -5.
Conditional Branch 7: If Self Var X Difference < 0.
Conditional Branch 8: If variable Axels Facing = 6, then we start common Event "Enemy Hurted". We would make it after we finish with Shooting and enemy.

Conditional Branch 6.2: If Self Var X Difference ≤ 5.
Conditional Branch 7:If Self Var X Difference > 0.
Conditional Branch 8: If variable Axels Facing = 4, then we start common Event "Enemy Hurted".

Conditional Branch 5.1: if variables Self Var X and Axels X equals. If it's true — then player and enemy takes one X axis therefore player would shoot by Y axis.
Conditional Branch 6.3: If Self Var Y Difference ≥ -5.
Conditional Branch 7: If Self Var Y Difference < 0.
Conditional Branch 8: If variable Axels Facing = 2, then we start common Event "Enemy Hurted".

Conditional Branch 6.4: If Self Var Y Difference ≤ 5.
Conditional Branch 7: If Self Var Y Difference > 0.
Conditional Branch 8: If variable Axels Facing = 8, then we start common Event "Enemy Hurted".
Enemy Hurted Common Event:
1. We should show animation to this event, maybe like Physical punch or smth.
2. We deduct variable Patrons in pistol by 1.
3. We should deduct variable Self Var HP by 10.
4. Conditional branch if Self Var HP ≤ 0 then we turn off switch Player hit to off.
5.Turn ON switch Player Hit.
6. Set movement route for this event: wait 60 frames.
7. Turn OFF switch Player Hit.



https://sun9-8.userapi.com/impg/M7wN4oa6a5b2FW3Q8BHlI_fjwBveHbhM4zQdvA/SKnEyVmrRFw.jpg?size=0x0&quality=90&proxy=1&sign=90b86898f0ed2580de9136bc8309469d




Else (conditional branch 2.1): You can remind that we added else branch to check of Patrons in pistol. In it we should create conditional brach if switch Reload ON, then we should show smth. Don't forget to create «Else» banch! I would use ballooun Icon silence, if reload is going and exclamation if not.


https://sun9-3.userapi.com/impg/LdSNSasIArHPI3eRAo-XmwPVohVFAfpTDu3WDw/94l2heeVK3w.jpg?size=0x0&quality=90&proxy=1&sign=67ad9a28c3efb20567359e04bd05f9ca



Enemy attacks!
Creating common event «Enemy Attacks».

Conditional Branch 1: If variables Axels X and Self Var X.
Conditional Branch 2:IfSelf Var Y Difference ≤ 1
Conditional Branch 3: If Self Var Y Difference ≥ -1. This is check if player in distance of 1 of enemy.
If this all is true then we should deduct Self Var Damage variable from Players HP, after that we show animation and make wait this event for 60 frames.

Make the same thing for Y.


https://sun9-35.userapi.com/impg/N5j_w4OPF2wgW3NDlCoWq8BRCU05yqNaWpv8FQ/QZh3emNf_dA.jpg?size=0x0&quality=90&proxy=1&sign=eb73112d14cdb5624f85b6545ccb122d



Enemy event settings and final test.
First page:
We set graphic of this event, trigger is «autorun».
In contents we set variables Self Var HP and Self Var Damage, and use local switch А.

Second page:
Set its conditions to local switch A, trigger is «Parallel».
In contents we use common events «enemy» and «enemy attacks».
After that Conditional Branch if Self Var HP ≤ 0, then Erase event.






Pluses and minuses, result.
Pluses and minuses:
+ You should now only basis of programming.
+ System may take any vies, from fantazy to cybersteamultrahardcorepunk.

± System works more or less stable, with 71 enemy stable 60 fps.

— It's a workaround system.
— System must be improved.


https://sun9-24.userapi.com/impg/F8JxCHx6JeMQMm4iVtON2H12PzOeQR_tMJJoFA/jT4rzmDUOd4.jpg?size=807x454&quality=90&sign=11ff68de74f5a15ea1f7b14e4d7daa5f



In completing: This system works kinda okay, but it must be improved by every user who would use it.


Thanks for reading this. You can support me by listening to my GrindCore/NoiseCore band «Херувим Убил Иуду»(
«Cherub killed Judas»), or by crediting me in your project
.


本贴来自国际rpgmaker官方论坛作者:RusShm处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/event-action-battle-system-mv.129212/
页: [1]
查看完整版本: Event Action Battle System [MV].