making something happen if You miss

Dragon Brother

Survive, Adapt, Infest.
Veteran
Joined
Dec 30, 2015
Messages
102
Reaction score
133
First Language
English
Primarily Uses
RMVXA
Greetings, RPGM forums


I have quite the conundrum on My hands, I am looking to create an event for hits and misses during battle, I have scoured the Ruby index in the contents on program, the master lists and script call database but I cannot find anything pertaining to a script call, as (to my knowledge anyway) script calls really are just code that pertains to the system at large I would imagine there would be something in there, I've tried to do this in variables but nothing takes.


in short I would like to know how to add Hit/Miss/Critical to conditional branches or formulae to allow for other effects!


I eagerly await reply.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
I once re-wrote the damage formula to allow me to better control to hit and how it worked, and from what I saw I think you'll need a full on script to allow this, as there is no way I know of to access that data in a conditional branch. Instead, you would need a script written that did your extra effects for when a critical occurred, a miss occurred, and when a hit occurs.


Edit: The code within the damage formula is as follows, if you can get it to work, great. But I don't think it will somehow just due to when the conditional branch runs:


For a critical: @result.critical


For a miss: @result.missed


For evaded: @result.evaded


For hit: @result.hit?


However, note that the variable @result is part of a class, and you will probably have to access the class it is part of. From what I can tell it is part of the battler class, which means it MIGHT work if you did:


a.result.critical


to see if the result of the recent action is a critical hit. If not though, I have no idea and think it will take a full on script to do it internally.
 
Last edited by a moderator:

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
The item_apply method in Game_Battler handles hits, misses, and critical hits.


It really depends on what exactly you're trying to accomplish, but eventing probably


won't do you much good here.


Victor has a script that allows you to write custom hit formulas, and ensuring critical hits


is often as simple as: @result.critical = true in damage formulas.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
@Rinobi I don't think the OP wants to ensure critical hits, but to have certain actions happen if a critical hit occurs.  For example, if a critical hit, then add poison would be


if b.result.critical; b.add_state(2); end;a.atk * 4 - b.def * 2


@bgillisp Would it need a full-on script?  Would it not be possible to do this using this scriptlet to get round the limited length of the damage formula?


class Game_Battler < Game_BattlerBase
def custom_formula_name(a, b, v)
#here you can add as much as you want
end
end


so that all you need put in the damage formula box would be


custom_formula_name(a, b, v)
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
@ksjp17: You are correct, but to me that still counts as requesting/writing a script, even if it is a small one.
 
  • Like
Reactions: Kes

Dragon Brother

Survive, Adapt, Infest.
Veteran
Joined
Dec 30, 2015
Messages
102
Reaction score
133
First Language
English
Primarily Uses
RMVXA
I forgot to mention I wanted to know if I could do it a Common event linked to an ability, all of these will work in common events?
 
Last edited by a moderator:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Probably not. I think you'd be better off with ether a script that did this, or the script snippet posted in this thread. Like I said, you MIGHT be able to use a common event to check those, but it will run after the event is done, which might cause timing problems.
 

Dragon Brother

Survive, Adapt, Infest.
Veteran
Joined
Dec 30, 2015
Messages
102
Reaction score
133
First Language
English
Primarily Uses
RMVXA
No avail, it gave Me an error, but then if I was a scripter or even knew half as much as any of You about ruby, I wouldn't have this issue


I admit this was a half-effort try but I know nothing about what I am doing.

Screenshot_4.png
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
b didn't hit a hit. (A is the attacker, b is the target). Try a.result.hit. If that fails, you'll need to request a script for what you want, and you will have to detail out exactly what you want to happen for the scripter to be able to do it.
 
Last edited by a moderator:

Dragon Brother

Survive, Adapt, Infest.
Veteran
Joined
Dec 30, 2015
Messages
102
Reaction score
133
First Language
English
Primarily Uses
RMVXA
It appears the common event isn't communicating well, You all did Me a service today, I guess I'll be requesting a script after all.

Thank You for replying so swiftly.

Screenshot_1.png
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Try removing the . at the end. That might still work. If not, then yes, it will need a script.
 

Dragon Brother

Survive, Adapt, Infest.
Veteran
Joined
Dec 30, 2015
Messages
102
Reaction score
133
First Language
English
Primarily Uses
RMVXA
Unfortunately that didn't work.

Screenshot_5.png
 

Dragon Brother

Survive, Adapt, Infest.
Veteran
Joined
Dec 30, 2015
Messages
102
Reaction score
133
First Language
English
Primarily Uses
RMVXA
Well it was a great try everyone, I will request that script momentarily, on the script request page ofcourse.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,085
Members
137,585
Latest member
Reversinator
Top