Battler Graphic Translation

Hmm.. weird structure. that line just change the battler_in_motion variable inside game_temp class to false.

there's probably another update somewhere looking for that statement.

You said something about more than one "def update" right? The right one should be somewhere below "class Scene_Battle" in that script or module BattleManager, or Sprite_Battler.. hmmm.. quite a lot of possibilities 😛

Well, judging from the variable name.. that code might just work. The script probably check if battler_in_motion is true/false in another update somewhere and change the graphic if it's false. (Which seems to be a weird and laggy way to implement a script)

Try add that if statement behind the line 

$game_temp.battler_in_motion = false if !$game_switches[1]

And turn on switch 1 using troop event to see if it works. As battle goes and depending on where the update is called, the enemies might not stop moving right away but should stop moving on the next turn.
--------------------------------------------------------------------------

  # * Update

  #--------------------------------------------------------------------------

  alias mog_battler_motion_update update

  def update

      $game_temp.battler_in_motion = false if !$game_switches[1]

      mog_battler_motion_update

  end

 

So when a condition is met, turn on switch 1 and the movement should stop at least by the end of the turn. But the movement continued.

 

There are no 'def update' below 'class Scene_Battle'. All are above.

It's the same case with 'class Sprite_Battler'.
So nothing happen when you turn on switch 1 and end the turn in battle?

That means you still need to find the method MOG is using to update the graphic.

well.. probably somewhere in the script there's something like

def some_method_name

  something.x += number

  something.y += number

end

Then look for that some_method_name in "def update" somewhere... has to be update since the enemies kept moving in the battle right?

add if blahblahblah behind some_method_name under the update method and it should work.
Found some interesting pieces of code.

This one seems to deal with movement:

  #--------------------------------------------------------------------------

  # ● Update Position

  #--------------------------------------------------------------------------  

  alias mog_motion_animation_update_position update_position

  def update_position

      active_battler_motion      

      if @battler_motion_active

         update_motion_animation

         self.z = @battler.screen_z rescue nil

         self.z += 20 if @battler.bact_data[1] != nil and [email protected]_data[6]

         return

      end      

      mog_motion_animation_update_position

      self.z += 20 if @battler.bact_data[1] != nil and [email protected]_data[6]

  end

 

Then there are the ones I'm using for a hover effect. I believe that these pieces of code deal with that:

 

#--------------------------------------------------------------------------

  # ● Update Motion Float

  #--------------------------------------------------------------------------          

  def update_motion_float

      @motion_speed += 1

      return if @motion_speed < 5

      @motion_speed = 0

      case @battler.motion_stand[1]

           when 0

                self.y -= 1

                @battler.motion_bms[0] -= 1

                if self.y < @float_range[0]

                   self.y = @float_range[0]

                   @battler.motion_bms[0] += 1

                   @battler.motion_stand[1] = 1

                end   

           when 1  

                self.y += 1

                @battler.motion_bms[0] += 1

                if self.y > @float_range[1]

                   self.y = @float_range[1]

                   @battler.motion_bms[0] -= 1

                   @battler.motion_stand[1] = 0

                end                  

      end

  end    

 

And there is this one:

 

#--------------------------------------------------------------------------

  # ● Update Motion Side

  #--------------------------------------------------------------------------          

  def update_motion_side

      @motion_speed += 1

      return if @motion_speed < 5

      @motion_speed = 0

      case @battler.motion_stand[1]

           when 0

                self.x -= 1

                if self.x < @side_range[0]

                   self.x = @side_range[0]

                   @battler.motion_stand[1] = 1

                end   

           when 1  

                self.x += 1

                if self.x > @side_range[1]

                   self.x = @side_range[1]

                   @battler.motion_stand[1] = 0

                end                  

      end

  end     

  

end
there should be a sum up method that contains both

def some_method

  update_motion_float

  update_motion_side

end

You can add the if statement right behind those 2 lines there. Or find the final method that calls for that some_method somewhere and add the if line there.
Like this?

 

#--------------------------------------------------------------------------

  # ● Execute Motion Animation

  #--------------------------------------------------------------------------        

  def execute_motion_idle

      if !$game_switches[1]

      case @battler.motion_stand[0]

         when 0

             update_motion_breath

         when 1  

             update_motion_float

         when 2

             update_motion_side

      end        

  end
You will need to add another end below to get that to work.

Or find the method that calls execute_motion_idle somewhere and add the if behind that line.

Either will work.

Just turn on switch 1 in the battle using troop event to check if it's working. 😉
I added the 'end' and it worked now - the movement stopped.

I went back to try the previous pieces of code for the movement but nothing worked. Some crashed the test like before and others resulted in no effect. I even tried the ones that attempt to update the graphic.

Could it be that the graphic is still locked somehow?
This code isn't working?

$game_troop.members[0].screen_y = 120 if $game_troop.members[0].alive?Lecode said he checked and it works. So it has to be some other update that still hold onto the position update. Since you use a few of MOG scripts that modifies battle and battler.. the answer is yes, you will need to go through them all and add that switch control in all of them.

But then again... you don't have to do that.

Simply add that line of code to where you add the if statement. So when the switch is flipped it stops updating the movement but instead update the new position of troop X. 

add this above all 3 ends

if blahblahblah  MOG's codeelse  $game_troop.members[$game_variables[1]].screen_y = $game_variables[2] if $game_troop.members[$game_variables[1]].alive?So you should able to control the troop number using game variable 1 and the Y position using game variable 2

Well... the problem here is.. you are stopping all enemies movement just to enable the script call to move position? Won't it be weird when everyone in the battle stop moving and Monster A drops to the ground? :/

Remember that as soon as you flip the switch off, your grounded monster will pop back into the old position MOG script recorded.

Edit:

Well... actually... just realized that you might have already given enough information i need to add that new tag.

So, in the notetag of the enemy you have to type in something like xxxxx[1] for mode 1 and xxxxx[2] for mode 2?

And there's 3 modes?
My plan was to have the fallen enemy hover lower to the ground. I had no idea that it would pop back up to its original position. I figured that with I turned the switch off, the script would act from the new position.

I can't do it this way then. It may be that I'll have to scrap this idea entirely...

But you've really been a great help MeowFace. I appreciate the time you've spent here.
Well.. tell me what mode your floating/flying enemy uses. Just need a small tinker there to get it work 😉
Well Motion Standby has three modes: 0, 1, 2.

I'm using mode 1 for some flyers and mode 2 for other flyers.
This is just a quick work around and it will effect ALL the enemies in the screen using the float animation mode:

 

Add this line right below def update_motion_float and above @motion_speed += 1

return self.y = 120 if $game_switches[1]120 is the fixed Y position. 1 is the switch number.

So when switch 1 is turned on, all float mode enemy will drop to 120 Y.
Movement stops and that's it.
y position isn't updated? hmm..

try a bigger number like 300 😛

if that still doesn't work, try change .y to .x and tell me if they moved.

Edit:

And make sure you remove the old code that stops the movement. Both if and end. Because as long as that code is there switch 1 turns off all movement on all enemies. 
The old code was the problem. I removed it and my battler jumped - well, they all did as you previously mentioned.
Yup, judging on how that script works(targeting all battlers with the tag and not the indexed troop), that seems to be the work around.

So since that script didn't use the index for positioning.. But somehow it still need to find the troop's info somewhere, i wonder if we can pair self with one to make it works for 1 enemy only.

Try change the line to

return self.y = 120 if $game_switches[1] && self == $game_troop.members[0]This should limit it to work on the enemy in the 1st slot of Troop members. (aka 1st enemy in the battle)

If that works, change 0 to $game_variables[1] and you should be able to control which enemy to stop & move down using game variable 1.
I tried both

return self.y = 120 if $game_switches[1] && self == $game_troop.members[0]

and

return self.y = 120 if $game_switches[1] && self == $game_troop.members[$game_variables[1]]

In both cases, when the switch was turned on, the battler continued to hover, and there was no change in position.
Well, the problem about this script is the way it target its sprite change.

If self means the sprite name/index itself then there's no references to enemy/troops.

Means we can't pair it up with an enemy id and force it to work on certain troop members and that little code that changed ALL same enemy on the same update method is final. (At least final without modifying a few parts of that script, which require me to download MOG demo to get that script to further support this, and i don't really want to download that big demo 🙁 )

Give these a try then, but don't raise your hope.

return self.y = 120 if $game_switches[1] && self == $game_troop.members[0].idor

return self.y = 120 if $game_switches[1] && self == $game_troop.members[0].nameOr you can go through that script and look for a ".new" call that's either related to battler/troop/enemy. The part where it's trying to get the id/sprite name of the battler... Not sure how to isolate the way it update each sprite at this very moment, but there should be a way to do that.
First one crashed as an unidentified method for 'id' and second took no effect.

There is only one section with '.new' in the script, but it does not seem related to identifying a battler:


#--------------------------------------------------------------------------

  # ● Update Collpase Slice

  #--------------------------------------------------------------------------      

  def update_collpase_slice    

      return if !self.visible

      if [email protected]_slice[0] ; @battler.motion_slice[0] = true

          @pre_image = self.bitmap

          @cw_2s = @pre_image.width ; @ch_2s = @pre_image.height

          self.bitmap = Bitmap.new(@pre_image.width * 2,@pre_image.height)

          self.ox = self.bitmap.width / 2

      end

      @battler.motion_slice[1] += 1

      @battler.motion_slice[2] += 1

      if @battler.motion_slice[2] < 60 and @battler.motion_slice[2] < @cw_2s / 2

         self.bitmap.clear

         scr_rect_1 = Rect.new(0,0,@cw_2s,@ch_2s / 2)

         self.bitmap.blt((@cw_2s / 2) - @battler.motion_slice[1],0,@pre_image,scr_rect_1)

         scr_rect_2 = Rect.new(0,@ch_2s / 2,@cw_2s,@ch_2s / 2)

         self.bitmap.blt((@cw_2s / 2) + @battler.motion_slice[1],@ch_2s / 2,@pre_image,scr_rect_2)   

      else

         self.opacity -= 3

         if self.opacity == 0 ; self.visible = false ; collapse_end ; end

      end   

  end 

Original thread: https://forums.rpgmakerweb.com/threads/battler-graphic-translation.44851/