DUNGEONDEVDUDE'S PROFILE

You can call me “D3”. I’m just a guy who makes games as a hobby. Not always good at it, but I always have fun!

Search

Filter

[RMVX ACE] Check if an actor has evaded an attack?

Thanks guys! I’ve leveled up a bit, but it’s back to the grind.

[RMVX ACE] Check if an actor has evaded an attack?

Hey Marrend,

I think you may be on to something here...

but your original snippet had me looking at this from another angle. Instead of having the actor check if he dodged, I can check to see if the enemy skill simply missed the actor. I mean, from the player's end the result is the same right?

So instead, I used Yanfly's Lunatic Objects, and created a code on the enemy attacks where if the target was missed or evaded, they would get a state... I used pretty much the same code above, and that worked.

Not sure why it works this way, and not the other way, but I'll take it!

Thanks Unity and Marrend for helping me think this out!

su_battle1.png

author=Sgt M
Shark Teeth and :3 Mouths is about all I know lol


Honestly, that's all you need because it works and it's cute. :3

[RMVX ACE] Check if an actor has evaded an attack?

author=unity
When you've got it copied, I'll edit it out so people won't have to scroll forever.


You're good to go! Thank you!

Now to keep working at this. :P

[RMVX ACE] Check if an actor has evaded an attack?

Whoops!

Well, thanks for sending! :D

I'm going to take a look at this and play with Marrend's snippet and see if I can come up with something.

[RMVX ACE] Check if an actor has evaded an attack?

author=Marrend
Not sure how much this helps, but, the default processing for the evasion check seems to be in Game_Battler?

class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Calculate Evasion Rate for Skill/Item
  #--------------------------------------------------------------------------
  def item_eva(user, item)
    return eva if item.physical?    # Return evasion if physical attack
    return mev if item.magical?     # Return magic evasion if magic attack
    return 0
  end
  #--------------------------------------------------------------------------
  # * Apply Effect of Skill/Item
  #--------------------------------------------------------------------------
  def item_apply(user, item)
    @result.clear
    @result.used = item_test(user, item)
    @result.missed = (@result.used && rand >= item_hit(user, item))
    @result.evaded = (!@result.missed && rand < item_eva(user, item))
    if @result.hit?
      unless item.damage.none?
        @result.critical = (rand < item_cri(user, item))
        make_damage_value(user, item)
        execute_damage(user)
      end
      item.effects.each {|effect| item_effect_apply(user, item, effect) }
      item_user_effect(user, item)
    end
  end
end


*Edit: Maybe as a test-run, insert a new code-block with something like...

class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Apply Effect of Skill/Item
  #--------------------------------------------------------------------------
  def item_apply(user, item)
    @result.clear
    @result.used = item_test(user, item)
    @result.missed = (@result.used && rand >= item_hit(user, item))
    @result.evaded = (!@result.missed && rand < item_eva(user, item))
    if @result.hit?
      unless item.damage.none?
        @result.critical = (rand < item_cri(user, item))
        make_damage_value(user, item)
        execute_damage(user)
      end
      item.effects.each {|effect| item_effect_apply(user, item, effect) }
      item_user_effect(user, item)
    elsif @result.evaded
      user.add_state(44)
    end
  end
end


...this, and observe if the state is applied after a successful evasion? Might not hurt to set a character's (or enemy's) EVA to, like, 90% or 100% for the purposes of testing too.


Well, that snippet worked, but when the actor dodged it added the state to the enemy. So now, I guess the next step would be to change it so the "target" gets the state, and only when a specific actor is targeted.


I could make an equipment tag that says if the target's notebox contains this tag, add the state.

[RMVX ACE] Check if an actor has evaded an attack?

author=unity
I don't know a thing about coding, but I have a script Craze made called Regrowth Options that does something like this. It has options for "when a character evades" but it seems to mainly do things like restoring HP, TP, or MP, but maybe it'd give you a clue, if nothing else?

I'd link you to it on his old blog, but it just 404s, so I can paste it here if you like!



That's actually a great idea!

I think I may have a copy of that script somewhere in my super old VX Ace failures...

Can you link it here, just in case :P

[RMVX ACE] Check if an actor has evaded an attack?

I'm trying to using Yanfly's Lunatic States Found Here in order to create an effect where if a character evades an attack, they receive a buff to their stats.

However, I'm running into trouble forming the check to see if the User has properly evaded the attack.

I figure this is stored somewhere in the game_results or game action_results, as I was able to create a state that granted bonus on hitting a critical using similar methods.

So far, I have a passive state applied to said character. I'm using a "react effect" on that state that says the following:


when "EVADEBONUS"
if @result.evaded
user.add_state(44)
end


I've also tried "if user.result.evaded" and "state_origin.result.evaded" but whenever the actor dodges, nothing happens. That state(44) is a bonus state that has the actual bonuses.

Am I just completely off? Thanks for taking the time to read this :).

Dev log #1 : Power and Support Roles

Reminds me a little of FF13, to be honest, where each character has access to a specific role, but their take on that role was a little different depending on each character.

I like it, and interested in seeing they ways that you’ll make it even more interesting than it was in Soma Spirits.

Heros_Realm_seaside_castle.png

It’s so good to look at. You guys are doing great!