Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Untitled on December 22, 2011, 02:09:17 am

Title: (RESOLVED)[XP]Guarding Actors Guard Before Others Act?
Post by: Untitled on December 22, 2011, 02:09:17 am
I always found it annoying how in RMXP, actors and enemies will Defend whenever their speed tells them to, but that the defending applies to the whole turn. I tried to fix this, but I don't even know how turn order is determined :^_^':

So my request is: Could someone make an edit to the default Scene_Battle4 script (or whatever else is necessary) to make actors using Defend act before any other actor?

Thanks!
Title: Re: [XP]Guarding Actors Guard Before Others Act?
Post by: Fantasist on December 22, 2011, 10:22:13 am
The method you're looking for is make_action_orders in Scene_Battle 4. Just do your sorting there and you'll be good.
Title: Re: [XP]Guarding Actors Guard Before Others Act?
Post by: Untitled on December 22, 2011, 04:59:15 pm
Yeah, I tried a few things with that. But how do I sort?

I think most of what I tried is similar to

    # Decide action speed for all
    for battler in @action_battlers
      battler.make_action_speed
    end
    #IMPORTANT PART STARTS HEEEEEERE
    if @active_battler.current_action.basic == 1
      battler.make_action_speed = battler.make_action_speed + 200
    end
    #MY FAIL EDITS END HEEEEEERE
    # Line up action speed in order from greatest to least
    @action_battlers.sort! {|a,b|
      b.current_action.speed - a.current_action.speed }
  end
Title: Re: [XP]Guarding Actors Guard Before Others Act?
Post by: Blizzard on December 22, 2011, 05:20:24 pm
Should be like this:

    for battler in @action_battlers
     if battler.current_action.basic == 1
       battler.current_action.speed += 1000
     end
   end


I pulled this out of my ass (aka I haven't tested it), but it should work.
Title: Re: [XP]Guarding Actors Guard Before Others Act?
Post by: Untitled on December 23, 2011, 02:30:09 am
Oh, so +=/-= do work? That's great to know.

But the script seems to work like a charm! I had to increase the value, but things make much more sense now. Now to find a good reason to make the player want to defend...

Thanks, though! I'm already crediting you for a bunch of stuff so there's nothing else I can say  :^_^':