Help - Search - Members - Calendar
Full Version: RPG Tankentai Sideview Battle System Auto Enemy Positions
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS2-Submissions
erthia
Inspired by Melody engine's ability to auto setup enemy positions, I decided to create a script that will help make positioning enemies easier in the RPG Tankentai Sideview Battle System. All you have to do is just add the enemies by pressing the add button in the database. Place code as last script if you see no changes.

NOTE: Make sure levitate is not checked on the monster, it won't place the battler properly.

CODE
module ENEMY_POSITION
  
POSITION_ENEMY ={
############################################################################
#Configure Adjustments here:
############################################################################
          #[adj_x, adj_y, x_rate_x, x_rate_y, y_rate_x, y_rate_y],
:setup  => [-408,  128,    0.300,   -0.250,    1.600,    0.500],
}
end

############################################################################

class Game_Troop < Game_Unit
  def setup(troop_id)
    clear
    @troop_id = troop_id
    @enemies = []

    offsets = ENEMY_POSITION::POSITION_ENEMY[:setup]
    for member in troop.members
      next if $data_enemies[member.enemy_id] == nil
      enemy = Game_Enemy.new(@enemies.size, member.enemy_id)
    

      position_x = (member.x * offsets[2]) + (member.y * offsets[4])
      position_x += offsets[0]
      
      position_y = (member.x * offsets[3]) + (member.y * offsets[5])
      position_y += offsets[1]
  
      enemy.screen_x = Integer(position_x)
      enemy.screen_y = Integer(position_y)

      @enemies.push(enemy)
    end
    make_unique_names
  end
  
end
sniperzip
i don't see Acter??
[but see monster in side view]
erthia
Everything should work the same before this script is placed, for the characters. This script doesn't modify the placement of characters, only the enemies. I just tried it on a brand new installation of the sideview system.
arokalot
When I tried this it showed the enemy way off the screen.
Ashalinia
You've actually tested this? When I had 2 enemies on the screen it just put them insanely close together. Is this dependent on graphic sizes?
SoloHero
QUOTE (Ashalinia @ Apr 24 2011, 03:46 PM) *
You've actually tested this? When I had 2 enemies on the screen it just put them insanely close together. Is this dependent on graphic sizes?

Not really. You can just customize the spacing between enemies in the script and they'll all follow those same coordinates.
Ashalinia
QUOTE
Not really. You can just customize the spacing between enemies in the script and they'll all follow those same coordinates.


Oh I see, so this is so that all enemy troops are placed at the same coordinates in battles? That would make a little more sense.
Bloodmatrix
thank you, you did a great job with this script. it was exactly what I was looking for, and was expecting.
am using it from now on biggrin.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.