Main Menu
  • Welcome to The RPG Maker Resource Kit.

[REQUEST] Caterpillar Script for MA's Manual Leader Control

Started by Infinate X, May 05, 2011, 09:15:04 PM

0 Members and 1 Guest are viewing this topic.

Infinate X

The name says most of it.


I want a caterpillar script that works like this:
When variable 1 is higher then 0 all four actors follow the leader rather then just the last 3.

Pretty simple huh?

Helpers will get credit in my game and a virtual cooke on this topic. It is chocolate chip.

modern algebra

Give a link to the Caterpillar script you want to use. It is a very simple edit and I am sure any scripter would prefer to do that than write the entire script from scratch.

pacdiggity

Quote from: modern algebra on May 05, 2011, 09:31:25 PMI am sure any scripter would prefer to do that than write the entire script from scratch.
That.
That actually is quite a simple edit. Even I might be able to do it :V
it's like a metaphor or something i don't know

Infinate X

The only games I've ever had a caterpillar were games I used PRABS, ORBS, Requiem, and Vampire battle systems. I don't know any good oes but I will look and test for compatability!

Infinate X

I originally didn't want this caterpillar script but after seeing the many event based possiblities for it (and since it was the only one I could find on rmrk) I decided to use it!

Zeriab's Caterpillar: http://rmrk.net/index.php/topic,35167.0.html

Is it also possible to make the event use party position instead of actor ID? I would need (currently) over 30 events if it was actor ID

There is going to be more Terramon as I advance in game production

Infinate X

This is really important for my game, so if at all possible, I need this done ASAP.

EDIT: Sorry wrong script... I still need this one done for my game though!

darkserge000


class Game_Player
#--------------------------------------------------------------------------
# * Move Down
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Left
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Right
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move up
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left
super
end
#--------------------------------------------------------------------------
# * Move Lower Right
#--------------------------------------------------------------------------
def move_lower_right
super
end
#--------------------------------------------------------------------------
# * Move Upper Left
#--------------------------------------------------------------------------
def move_upper_left
super
end
#--------------------------------------------------------------------------
# * Move Upper Right
#--------------------------------------------------------------------------
def move_upper_right
super
end
end

class Game_Follower < Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :actor
attr_accessor :move_speed
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super()
@through = true
@actor = actor
end
#--------------------------------------------------------------------------
# * Set Actor
#--------------------------------------------------------------------------
def actor=(actor)
@actor = actor
setup
end
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup
if @actor != nil
@character_name = $game_actors[@actor].character_name
@character_index = $game_actors[@actor].character_index
else
@character_name = ""
@character_index = 0
end
@opacity = 255
@blend_type = 0
@priority_type = 0
end

#--------------------------------------------------------------------------
# * Screen Z
#--------------------------------------------------------------------------
def screen_z
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z - 1
end
super
end
#--------------------------------------------------------------------------
# * Same Position Starting Determinant (Disabled)
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
result = false
return result
end
#--------------------------------------------------------------------------
# * Front Envent Starting Determinant (Disabled)
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
result = false
return result
end
#--------------------------------------------------------------------------
# * Touch Event Starting Determinant (Disabled)
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
result = false
return result
end
end

class Spriteset_Map
alias_method :spriteset_map_create_characters, :create_characters
def create_characters
spriteset_map_create_characters
$game_party.followers.each do |char|
@character_sprites << Sprite_Character.new(@viewport1, char)
end
end
end

class Game_Party
#--------------------------------------------------------------------------
# * Constants
#--------------------------------------------------------------------------
MAX_SIZE = 8
CATERPILLAR = 2
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :followers
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_party_initialize, :initialize
def initialize
trick_caterpillar_party_initialize
@followers = Array.new(MAX_SIZE - 1) {Game_Follower.new(nil)}
@move_list = []
end
#--------------------------------------------------------------------------
# * Update Followers
#--------------------------------------------------------------------------
def update_followers
flag = $game_player.transparent || $game_switches[CATERPILLAR]
@followers.each_with_index do |char, i|
char.actor = @actors[i + 1]
char.move_speed = $game_player.move_speed
if $game_player.dash?
char.move_speed += 1
end
char.update
char.transparent = flag
end
end
#--------------------------------------------------------------------------
# * Move To Party
#--------------------------------------------------------------------------
def moveto_party(x, y)
@followers.each {|char| char.moveto(x, y)}
@move_list.clear
end
#--------------------------------------------------------------------------
# * Move Party
#--------------------------------------------------------------------------
def move_party
@move_list.each_index do |i|
if @followers[i] == nil
@move_list[i...@move_list.size] = nil
next
end
case @move_list[i].type
when 2
@followers[i].move_down(*@move_list[i].args)
when 4
@followers[i].move_left(*@move_list[i].args)
when 6
@followers[i].move_right(*@move_list[i].args)
when 8
@followers[i].move_up(*@move_list[i].args)
when 1
@followers[i].move_lower_left
when 3
@followers[i].move_lower_right
when 7
@followers[i].move_upper_left
when 9
@followers[i].move_upper_right
when 5
@followers[i].jump(*@move_list[i].args)
end
end
end
#--------------------------------------------------------------------------
# * Add Move List
#--------------------------------------------------------------------------
def update_move(type, *args)
move_party
@move_list.unshift(Game_MoveListElement.new(type, args))
end
end

class Game_MoveListElement
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(type, args)
@type = type
@args = args
end
#--------------------------------------------------------------------------
# * Type
#--------------------------------------------------------------------------
def type
return @type
end
#--------------------------------------------------------------------------
# * Args
#--------------------------------------------------------------------------
def args
return @args
end
end

class Game_Player
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :move_speed

#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_update, :update
def update
$game_party.update_followers
trick_caterpillar_player_update
end
#--------------------------------------------------------------------------
# * Moveto
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_moveto, :moveto
def moveto(x, y)
$game_party.moveto_party(x, y)
trick_caterpillar_player_moveto(x, y)
end
#--------------------------------------------------------------------------
# * Move Down
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_down, :move_down
def move_down(turn_enabled = true)
if passable?(@x, @y+1)
$game_party.update_move(2, turn_enabled)
end
trick_caterpillar_player_move_down(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Left
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_left, :move_left
def move_left(turn_enabled = true)
if passable?(@x-1, @y)
$game_party.update_move(4, turn_enabled)
end
trick_caterpillar_player_move_left(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Right
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_right, :move_right
def move_right(turn_enabled = true)
if passable?(@x+1, @y)
$game_party.update_move(6, turn_enabled)
end
trick_caterpillar_player_move_right(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Up
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_up, :move_up
def move_up(turn_enabled = true)
if passable?(@x, @y-1)
$game_party.update_move(8, turn_enabled)
end
trick_caterpillar_player_move_up(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_lower_left, :move_lower_left
def move_lower_left
if passable?(@x - 1, @y) and passable?(@x, @y + 1)
$game_party.update_move(1)
end
trick_caterpillar_player_move_lower_left
end
#--------------------------------------------------------------------------
# * Move Lower Right
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_lower_right, :move_lower_right
def move_lower_right
if passable?(@x + 1, @y) and passable?(@x, @y + 1)
$game_party.update_move(3)
end
trick_caterpillar_player_move_lower_right
end
#--------------------------------------------------------------------------
# * Move Upper Left
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_upper_left, :move_upper_left
def move_upper_left
if passable?(@x - 1, @y) and passable?(@x, @y - 1)
$game_party.update_move(7)
end
trick_caterpillar_player_move_upper_left
end
#--------------------------------------------------------------------------
# * Move Upper Right
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_upper_right, :move_upper_right
def move_upper_right
if passable?(@x + 1, @y) and passable?(@x, @y - 1)
$game_party.update_move(9)
end
trick_caterpillar_player_move_upper_right
end
#--------------------------------------------------------------------------
# * Jump
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_jump, :jump
def jump(x_plus, y_plus)
new_x = @x + x_plus
new_y = @y + y_plus
if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y)
$game_party.update_move(5, x_plus, y_plus)
end
trick_caterpillar_player_jump(x_plus, y_plus)
end
end###########
###########
###########

darkserge000

i have scripts here. i post it below. i hope this will help. Im new here ^_^

Infinate X

Quote from: darkserge000 on October 05, 2011, 03:29:24 PM

class Game_Player
#--------------------------------------------------------------------------
# * Move Down
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Left
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Right
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move up
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left
super
end
#--------------------------------------------------------------------------
# * Move Lower Right
#--------------------------------------------------------------------------
def move_lower_right
super
end
#--------------------------------------------------------------------------
# * Move Upper Left
#--------------------------------------------------------------------------
def move_upper_left
super
end
#--------------------------------------------------------------------------
# * Move Upper Right
#--------------------------------------------------------------------------
def move_upper_right
super
end
end

class Game_Follower < Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :actor
attr_accessor :move_speed
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super()
@through = true
@actor = actor
end
#--------------------------------------------------------------------------
# * Set Actor
#--------------------------------------------------------------------------
def actor=(actor)
@actor = actor
setup
end
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup
if @actor != nil
@character_name = $game_actors[@actor].character_name
@character_index = $game_actors[@actor].character_index
else
@character_name = ""
@character_index = 0
end
@opacity = 255
@blend_type = 0
@priority_type = 0
end

#--------------------------------------------------------------------------
# * Screen Z
#--------------------------------------------------------------------------
def screen_z
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z - 1
end
super
end
#--------------------------------------------------------------------------
# * Same Position Starting Determinant (Disabled)
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
result = false
return result
end
#--------------------------------------------------------------------------
# * Front Envent Starting Determinant (Disabled)
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
result = false
return result
end
#--------------------------------------------------------------------------
# * Touch Event Starting Determinant (Disabled)
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
result = false
return result
end
end

class Spriteset_Map
alias_method :spriteset_map_create_characters, :create_characters
def create_characters
spriteset_map_create_characters
$game_party.followers.each do |char|
@character_sprites << Sprite_Character.new(@viewport1, char)
end
end
end

class Game_Party
#--------------------------------------------------------------------------
# * Constants
#--------------------------------------------------------------------------
MAX_SIZE = 8
CATERPILLAR = 2
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :followers
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_party_initialize, :initialize
def initialize
trick_caterpillar_party_initialize
@followers = Array.new(MAX_SIZE - 1) {Game_Follower.new(nil)}
@move_list = []
end
#--------------------------------------------------------------------------
# * Update Followers
#--------------------------------------------------------------------------
def update_followers
flag = $game_player.transparent || $game_switches[CATERPILLAR]
@followers.each_with_index do |char, i|
char.actor = @actors[i + 1]
char.move_speed = $game_player.move_speed
if $game_player.dash?
char.move_speed += 1
end
char.update
char.transparent = flag
end
end
#--------------------------------------------------------------------------
# * Move To Party
#--------------------------------------------------------------------------
def moveto_party(x, y)
@followers.each {|char| char.moveto(x, y)}
@move_list.clear
end
#--------------------------------------------------------------------------
# * Move Party
#--------------------------------------------------------------------------
def move_party
@move_list.each_index do |i|
if @followers[i] == nil
@move_list[i...@move_list.size] = nil
next
end
case @move_list[i].type
when 2
@followers[i].move_down(*@move_list[i].args)
when 4
@followers[i].move_left(*@move_list[i].args)
when 6
@followers[i].move_right(*@move_list[i].args)
when 8
@followers[i].move_up(*@move_list[i].args)
when 1
@followers[i].move_lower_left
when 3
@followers[i].move_lower_right
when 7
@followers[i].move_upper_left
when 9
@followers[i].move_upper_right
when 5
@followers[i].jump(*@move_list[i].args)
end
end
end
#--------------------------------------------------------------------------
# * Add Move List
#--------------------------------------------------------------------------
def update_move(type, *args)
move_party
@move_list.unshift(Game_MoveListElement.new(type, args))
end
end

class Game_MoveListElement
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(type, args)
@type = type
@args = args
end
#--------------------------------------------------------------------------
# * Type
#--------------------------------------------------------------------------
def type
return @type
end
#--------------------------------------------------------------------------
# * Args
#--------------------------------------------------------------------------
def args
return @args
end
end

class Game_Player
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :move_speed

#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_update, :update
def update
$game_party.update_followers
trick_caterpillar_player_update
end
#--------------------------------------------------------------------------
# * Moveto
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_moveto, :moveto
def moveto(x, y)
$game_party.moveto_party(x, y)
trick_caterpillar_player_moveto(x, y)
end
#--------------------------------------------------------------------------
# * Move Down
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_down, :move_down
def move_down(turn_enabled = true)
if passable?(@x, @y+1)
$game_party.update_move(2, turn_enabled)
end
trick_caterpillar_player_move_down(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Left
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_left, :move_left
def move_left(turn_enabled = true)
if passable?(@x-1, @y)
$game_party.update_move(4, turn_enabled)
end
trick_caterpillar_player_move_left(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Right
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_right, :move_right
def move_right(turn_enabled = true)
if passable?(@x+1, @y)
$game_party.update_move(6, turn_enabled)
end
trick_caterpillar_player_move_right(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Up
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_up, :move_up
def move_up(turn_enabled = true)
if passable?(@x, @y-1)
$game_party.update_move(8, turn_enabled)
end
trick_caterpillar_player_move_up(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_lower_left, :move_lower_left
def move_lower_left
if passable?(@x - 1, @y) and passable?(@x, @y + 1)
$game_party.update_move(1)
end
trick_caterpillar_player_move_lower_left
end
#--------------------------------------------------------------------------
# * Move Lower Right
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_lower_right, :move_lower_right
def move_lower_right
if passable?(@x + 1, @y) and passable?(@x, @y + 1)
$game_party.update_move(3)
end
trick_caterpillar_player_move_lower_right
end
#--------------------------------------------------------------------------
# * Move Upper Left
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_upper_left, :move_upper_left
def move_upper_left
if passable?(@x - 1, @y) and passable?(@x, @y - 1)
$game_party.update_move(7)
end
trick_caterpillar_player_move_upper_left
end
#--------------------------------------------------------------------------
# * Move Upper Right
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_upper_right, :move_upper_right
def move_upper_right
if passable?(@x + 1, @y) and passable?(@x, @y - 1)
$game_party.update_move(9)
end
trick_caterpillar_player_move_upper_right
end
#--------------------------------------------------------------------------
# * Jump
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_jump, :jump
def jump(x_plus, y_plus)
new_x = @x + x_plus
new_y = @y + y_plus
if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y)
$game_party.update_move(5, x_plus, y_plus)
end
trick_caterpillar_player_jump(x_plus, y_plus)
end
end###########
###########
###########


So this is it? I'm not sure if it is because you didn't really say if it was a full script or just a part of it...

JonFawkes

It appears to be an alternate Caterpillar script. I don't see any credits on it though. You might want to check it out and see if it has any of the functions you need. A quick look through the script and it doesn't appear so though.

Infinate X

#10
I tried it and it's just a basic caterpillar script. It's not what I was looking for. I want one where 3 events follow you. I'm using Dricc's Actor Clones so it would be hard to event. I'm not sure if it actually is.

When I think about it, I probably can use Zeriab's Caterpillar script. I'll try it and co0me back with my response.

EDIT: It has everthing I wanted, except the events are run by actor ID apposed to Party ID... If it were Party ID then it would work really good. If not then I would have 1000 events on every map. Even if it were just have a map specificly for the Events and they follow you on every map that would be good. The down side is, I don't think there's a cap on how many actors I can have with Dricc's Actor Clones, so I don't think it will work after a while.