Moving all Events on the Map

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
Ok, this makes things much easier. For each map create a collision map with id equal to map id for the standard view, then add 200 to that id for every rotation. You will have something like this.
In the following example I am using map 42 as sample.
Map 42 standard view -> Collision map filename: map042
Map 42 90° rotation -> Collision map filename: map242
Map 42 180° rotation -> Collision map filename: map442
Map 42 270° rotation -> Collision map filename: map642
Once you have your collision maps set this way you can tell Hime's script to load a new collision map based on the combination of map id and rotation value.
Code:
module HMRP
  VARIABLE_ID = 100 # Change this to be the id of the variable you want to use to store the number of your rotations.
end

class Game_Map

  def map_rotation
    $game_variables[HMRP::VARIABLE_ID]
  end

  def check_passage(x, y, bit)
     if use_collision_map?
       x = x * TH::Collision_Maps::Tile_Width
       y = y * TH::Collision_Maps::Tile_Height
       new_map_id = 200 * map_rotation + @map_id
       return Cache.collision_map(new_map_id)[x, y, 0] == 0
    else
      th_collision_maps_check_passage(x, y, bit)
    end
  end

end
Don't forget to increase your variable by 1 every time you rotate your map and to set it back to 0 when you move back to the standard view. This way Hime's script will always look for a different collision map every time you rotate your map.
 

Robert-Character Creator

Waiting for Replies
Veteran
Joined
Feb 8, 2014
Messages
518
Reaction score
223
First Language
English
Primarily Uses
RMVXA
Hmm, it doesn't seem to be working. Collision remains the same, as confirmed by the overlay script and personal testing. I am increasing the variable I placed in the script by 1 each rotation, as noted.

Naming_Convention_2.png Code_4.png Code_5.png
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
The overlay script should not show you any rotated collision map because I didn't change it.
Code:
class Spriteset_Map
  def create_collision_map
    @collision_map_sprite = Sprite.new
    map_rotated_id = 200 * $game_map.map_rotation + $game_map.map_id
    puts "OVERLAY: Map rotated id is: #{map_rotated_id}"
    bmp = TH::Collision_Map_Overlay.draw_collision_map(map_rotated_id)
    @collision_map_sprite.bitmap = Bitmap.new(bmp.width, bmp.height)
    @collision_map_sprite.bitmap.blt(0, 0, bmp, bmp.rect, TH::Collision_Map_Overlay::Opacity)
  end
end
It should also print a line in your console telling you the id of the collision map being shown.
Code:
module HMRP
  VARIABLE_ID = 100 # Change this to be the id of the variable you want to use to store the number of your rotations.
end

class Game_Map

  def map_rotation
   $game_variables[HMRP::VARIABLE_ID]
  end

  def check_passage(x, y, bit)
    if use_collision_map?
      x = x * TH::Collision_Maps::Tile_Width
      y = y * TH::Collision_Maps::Tile_Height
      new_map_id = 200 * map_rotation + @map_id
      puts "Collision map rotated id is: #{new_map_id}"
      return Cache.collision_map(new_map_id)[x, y, 0] == 0
   else
     th_collision_maps_check_passage(x, y, bit)
   end
  end

end
Code:
module TH
  module Collision_Maps
   def self.load_collision_map(map_id)
     path = sprintf(Path_Name, map_id)
     puts "Collision map path is: #{path}"
     bmp = Bitmap.new(path)
     colltable = Table.new(bmp.width, bmp.height, 1)
     @@makeCollisionTable.call(bmp.__id__, colltable.__id__, Tile_Width, Tile_Height)
     return colltable
   end
  end
end
Use these scripts and take a screenshot of your console so I can understand what's going on.
 

Robert-Character Creator

Waiting for Replies
Veteran
Joined
Feb 8, 2014
Messages
518
Reaction score
223
First Language
English
Primarily Uses
RMVXA
Here's the screenshot. Remember, each time Variable 26 increases is me attempting to rotate the map.

Code_7.png
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
From your screenshot it seems you didn't try to move at all. Changes only occur when check_passage is called, which means you have to move to have something running. At least that's how I wrote it. Until your check_passage method is called nothing happens. Now I don't remember if the overlay script updates when you change map or when your collision map is loaded but what I know is that your new collision map won't be loaded until you actually call the check_passage method.

Could you move your character a few steps (actually a single step should be enough) and show me what happens?
 

Robert-Character Creator

Waiting for Replies
Veteran
Joined
Feb 8, 2014
Messages
518
Reaction score
223
First Language
English
Primarily Uses
RMVXA
Those green squares behind the player are follower hitboxes, that the game tracks even when unused; if I hadn't moved, they would all still be directly behind her.

However, I tried again while moving throughout the entire process. It looks to be the same output, but it could still be useful.

I also tried a move route into an open space, and one into a wall, and tried using either while rotating the map. Nothing.

Code_8.png
 
Last edited:

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
Followers hitbox you say...are you using some kind of pixel movement script? They don't look like they are moving normally. If that's the case then the check_passage method might be called in that script as well.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
There it is. As I thought it uses a different version for check_passage. It seems you need a different script that is compatible with this one as well. Unfortunately the script itself is kinda long and requires a bit of time to be studied (time that I don't have right now). I won't be able to give it a more serious look before Wednesday since I am really busy these days. If you don't mind waiting I can see what I can do.

You have to be patient though because, as I said, these weeks I am really busy and my free time is almost 0. I cannot guarantee a successful result but I can guarantee that I will give it a look. According to how much time it takes I might be able to do it or not.In any case I'll give you an answer after carefully reading the script.

I am sorry that I am unable to solve your problem fast enough but in this century time really is a precious resource...
 
Last edited:

Robert-Character Creator

Waiting for Replies
Veteran
Joined
Feb 8, 2014
Messages
518
Reaction score
223
First Language
English
Primarily Uses
RMVXA
I can definitely wait that long; it's not a big issue. In the meantime, I've begun to cannibalize your coding in order to move the player to their proper place during the rotation. I've got it mostly working, though the player isn't moved to the exact right spot; here's the code, in case you're interested.

Note: Before this script call is activated, variables 28 and 29 are set to the player's x and y, respectively.
xN = 29
yN = 29
evX = $game_variables[28] + xN
evY = $game_variables[29] + yN
newX = -evY - xN
newY = evX - yN
$game_player.moveto(newX, newY)
ms_pro_cam_center_at_char(-1, 1)
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
Since you're using a script call you don't really need to previously store player's X and Y in two variables. Just use
Code:
$game_player.x # this is player x coordinate
$game_player.y # this is player y coordinate
I can definitely wait that long; it's not a big issue.
You might be lucky. In your screenshot I saw your free movement script above mine. Since mine overwrites check_passage - which is one of those that are aliased in the free movement script - in the latter instruction it is clearly stated that you have to put it BELOW every other script overwriting one of those methods. In your case changing your script order might be enough.
 
Last edited:

Robert-Character Creator

Waiting for Replies
Veteran
Joined
Feb 8, 2014
Messages
518
Reaction score
223
First Language
English
Primarily Uses
RMVXA
Placing your script above the Free Movement script did help things; it fixed another bug I was struggling with. However, the collision map still doesn't rotate. Thanks for the tip about $game_player.x and y.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

On my journey of character rework: I had this character, she was meant to be just a princess that joins your party. And at long term she was just uninteresting... So I tweaked her to be a rebel agaisn't the royalty before meeting up with the party.

Quick tip for any other ametuer pixel artists! When trying to create a colour palette, enabling Antialiasing can speed up the process of creating different shades! Just place your lightest colour and your darkest colour next to each other, select both pixels, and stretch it out!
Revolutionizing the JRPG Industry: Knocking on Doors.

Take that, murderhobos.
Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.

Forum statistics

Threads
106,054
Messages
1,018,580
Members
137,843
Latest member
Betwixt000
Top