Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: tsuchiphox on February 04, 2024, 05:15:02 pm

Title: [RMXP] Pixel-based movement and caterpillar?
Post by: tsuchiphox on February 04, 2024, 05:15:02 pm
I want to use pixel-based movement in my game, but if i use a simple pixel movement script it can't use the caterpillar script for party members. I know there are scripts that totally redefine everything that have both these features, but they ALSO make it so you have to use 8-directional spritesheets and make collision maps and stuff. I don't want all that, just a really simple pixel movement script that also applies to party followers/caterpillar support. Doesn't really matter to me if the pixel movement doesnt account for smaller objects, just want to make it easier to walk around. Is this possible/is there already a script like this that i was unable to find?

Basically, the kind of script i'm looking for might work like this:
Use standard 4-direction spritesheets
Allow pixel-based movement (Not using a collision map, just the tileset's impassibility)
Have a caterpillar system that also moves with pixel-based movement / Work with another caterpillar script

For reference, my game does not use any other scripts that affect movement or have any caterpillar script. It used to, but i removed them during testing and i have not put them back in.
Title: Re: [RMXP] Pixel-based movement and caterpillar?
Post by: KK20 on February 05, 2024, 02:17:31 am
What scripts did you try using in the past? It's going to be easier to just find things that work the way you want them to and repurpose them to your needs.

For example, Drago's pixel movement (https://forum.chaos-project.com/index.php/topic,13117.0.html) allows toggling events to use pixel movement, and I'm aware of some caterpillar systems that utilize events. Other caterpillar systems create a new type of map object (e.g. Map_Follow, Game_Follower, Caterpillar_Actor) that can probably be modified to work with Drago's script.
Title: Re: [RMXP] Pixel-based movement and caterpillar?
Post by: tsuchiphox on February 07, 2024, 06:58:57 pm
So  a bit of an update to this, i have got something slightly working but it has all kinds of weird errors. So first of all, i'm using fukuyama's caterpillar script and Drago's pixel movement, and they ''work'' together, but the follower character moves like twice as fast, ignores collision, sometimes moves strangely, and generally does not behave normally. No idea what in the code is causing this, my only guess would be that Drago's pixel movement script is only four directional movement while the caterpillar script supports eight directions (diagonal)? I dunno. If video is needed for this issue i can record it and link it here so you can understand what i mean when i say the follower acts very strange in game.
It's also worth noting that Drago's pixel movement is causing issues with the loading zones in the game, repeatedly warping the player back and forth on the event tiles for some reason. This script might end up being unusable anyways.
Title: Re: [RMXP] Pixel-based movement and caterpillar?
Post by: KK20 on February 09, 2024, 02:14:09 am
I noticed that weird behavior with Drago's script. I've made a patch that you can stick to the bottom of it:
class Scene_Map
  alias reset_pixel_on_transfer_player transfer_player
  def transfer_player
    $game_player.reset_pixel
    $game_player.transfer_start = [$game_temp.player_new_x, $game_temp.player_new_y]
    reset_pixel_on_transfer_player
  end
end

class Game_Player
  attr_accessor :transfer_start
 
  TRANSFER_START_NIL = [-1,-1]
 
  alias init_starting_transfer_loc initialize
  def initialize
    @transfer_start = TRANSFER_START_NIL
    init_starting_transfer_loc
  end
 
  alias check_if_move_off_transfer_start update
  def update
    if @x != @transfer_start[0] || @y != @transfer_start[1]
      @transfer_start = TRANSFER_START_NIL
    end
    check_if_move_off_transfer_start
  end
 
  alias buffer_trigger_here check_event_trigger_here
  def check_event_trigger_here(triggers)
    if @x == @transfer_start[0] && @y == @transfer_start[1]
      return false
    end
    buffer_trigger_here(triggers)
  end
 
end
Addresses two things
1. If the player is offset before triggering a map transfer, the game "slides" it back to that same offset upon loading the new map. The fix will stop that slide.
2. If transferring on top of another event that is triggered by player touch, it will trigger upon the player pressing any directional input. The fix will not trigger the event until the player has moved entirely off the space first.

I've also looked at various caterpillar scripts. Fukuyama's (which I think Blizz rewrote and included in Tons of Add-ons) behaves upon player directional input, i.e. one press of DOWN will update all the followers to move 1 full tile space forward, which doesn't work with pixel movement since one press of DOWN isn't a full tile space anymore. In contrast, Zeriab's and Kyonides' wait for the player to move entirely off of the tile first before it updates the movement of the followers 1 full tile forward. This looks better, but this means the followers still move as if using the default RMXP movement, unlike the player.

Both scripts I tried enabling "pixel_movement = true" but the followers' behaviors were still wonky.
Title: Re: [RMXP] Pixel-based movement and caterpillar?
Post by: Blizzard on February 11, 2024, 05:56:39 am
Hm, maybe you could just use Blizz-ABS. It has pixel-movement and caterpillar with default map passability. You just need to turn off the battle stuff.