making something happen if You miss

● ARCHIVED · READ-ONLY
Started by Dragon Brother 14 posts View original ↗
  1. 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.
  2. 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.
  3. 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.
  4. @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)
  5. @ksjp17: You are correct, but to me that still counts as requesting/writing a script, even if it is a small one.
  6. 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?
  7. 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.
  8. 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
  9. 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.
  10. 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
  11. Try removing the . at the end. That might still work. If not, then yes, it will need a script.
  12. Unfortunately that didn't work.

    Screenshot_5.png
  13. Well it was a great try everyone, I will request that script momentarily, on the script request page ofcourse.