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: Plugins
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: Variables
Player 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 w
orkaround 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:
It looks kinda scary, yeah? Let's talk about how, what and why works here:
Spoiler: Conditional Branches
Conditional 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.
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.
Enemy attacks!
Creating
common event «Enemy Attacks».
Conditional Branch 1: If
variables Axels X and Self Var X.
Conditional Branch 2:If
Self 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.
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.
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/