Help - Search - Members - Calendar
Full Version: Pet script by "originalwij" v1.0
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS2-Submissions
slaQ
Hey everyone,

I was looking for a pet script, and as of now originalwij has been so kind to provide us with one.

Be sure to thank him, and NOT me.

greetings, slaQ


=====SEE BELOW FOR ORINIGALWIJ'S PET SCRIPT=====
slaQ
Seriously? zero replies? confused.gif

There must be someone willing to give this a shot...

If not then I guess I'll have to learn myself some ruby sweat.gif
Ziosin
I personally can't script. But for someone else, it should be a fairly easy script. You just have to relocate your post to here: http://www.rpgrevolution.com/forums/index.php?showforum=93

Before you repost it, though, ask a mod to close this one so you don't have multiple posts of the same thing.
originalwij
@slaQ

Try this:

[Show/Hide] Pet Script v1.0
CODE

#==============================================================================
# Pet
#==============================================================================
# Author : OriginalWij
# Version : 1.0
#==============================================================================

# Pet enable switch number
PET_ENABLE_SWITCH = 1
# Pet ID (database actor number)
PET_ID = 5

#==============================================================================
# Game_Character
#==============================================================================

class Game_Character
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_accessor :priority_type
end

#==============================================================================
# Game_Player
#==============================================================================

class Game_Player
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :move_speed
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
alias pet_game_player_update update unless $@
def update
$game_party.update_pet
pet_game_player_update
end
#--------------------------------------------------------------------------
# Move to
#--------------------------------------------------------------------------
alias pet_game_player_moveto moveto unless $@
def moveto(x, y)
$game_party.moveto_pet(x, y)
pet_game_player_moveto(x, y)
end
#--------------------------------------------------------------------------
# Move down
#--------------------------------------------------------------------------
alias pet_game_player_move_down move_down unless $@
def move_down(turn = true)
if passable?(@x, @y + 1)
$game_party.move_pet(2, turn)
end
pet_game_player_move_down(turn)
end
#--------------------------------------------------------------------------
# Move left
#--------------------------------------------------------------------------
alias pet_game_player_move_left move_left unless $@
def move_left(turn = true)
if passable?(@x - 1, @y)
$game_party.move_pet(4, turn)
end
pet_game_player_move_left(turn)
end
#--------------------------------------------------------------------------
# Move right
#--------------------------------------------------------------------------
alias pet_game_player_move_right move_right unless $@
def move_right(turn = true)
if passable?(@x + 1, @y)
$game_party.move_pet(6, turn)
end
pet_game_player_move_right(turn)
end
#--------------------------------------------------------------------------
# Move up
#--------------------------------------------------------------------------
alias pet_game_player_move_up move_up unless $@
def move_up(turn = true)
if passable?(@x, @y - 1)
$game_party.move_pet(8, turn)
end
pet_game_player_move_up(turn)
end
#--------------------------------------------------------------------------
# Move down left
#--------------------------------------------------------------------------
alias pet_game_playermove_lower_left move_lower_left unless $@
def move_lower_left
if passable?(@x - 1, @y + 1)
$game_party.move_pet(1)
end
pet_game_playermove_lower_left
end
#--------------------------------------------------------------------------
# Move down right
#--------------------------------------------------------------------------
alias pet_game_playermove_lower_right move_lower_right unless $@
def move_lower_right
if passable?(@x + 1, @y + 1)
$game_party.move_pet(3)
end
pet_game_playermove_lower_right
end
#--------------------------------------------------------------------------
# Move up left
#--------------------------------------------------------------------------
alias pet_game_player_move_upper_left move_upper_left unless $@
def move_upper_left
if passable?(@x - 1, @y - 1)
$game_party.move_pet(5)
end
pet_game_player_move_upper_left
end
#--------------------------------------------------------------------------
# Move up right
#--------------------------------------------------------------------------
alias pet_game_player_move_upper_right move_upper_right unless $@
def move_upper_right
if passable?(@x + 1, @y - 1)
$game_party.move_pet(7)
end
pet_game_player_move_upper_right
end
#--------------------------------------------------------------------------
# Jump
#--------------------------------------------------------------------------
alias pet_game_player_jump jump unless $@
def jump(pet_x, pet_y)
new_x = @x + pet_x
new_y = @y + pet_y
if (pet_x == 0 and pet_y == 0) or passable?(new_x, new_y)
$game_party.move_pet(9, [pet_x, pet_y])
end
pet_game_player_jump(pet_x, pet_y)
end
end

#==============================================================================
# Game_Party
#==============================================================================

class Game_Party
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :pet
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
alias pet_game_party_initialize initialize unless $@
def initialize
pet_game_party_initialize
@pet = Game_Pet.new(nil)
@move_pet = []
end
#--------------------------------------------------------------------------
# Update pet
#--------------------------------------------------------------------------
def update_pet
@pet.actor = PET_ID
@pet.move_speed = $game_player.move_speed
if $game_player.dash?
@pet.move_speed += 1
end
@pet.update
@pet.transparent = !$game_switches[PET_ENABLE_SWITCH]
end
#--------------------------------------------------------------------------
# Move to (pet)
#--------------------------------------------------------------------------
def moveto_pet(x, y)
@pet.moveto(x, y)
@move_pet.clear
end
#--------------------------------------------------------------------------
# Move pet
#--------------------------------------------------------------------------
def move_pet(type, turn = false)
if @move_pet == nil
@move_pet = [type, turn]
do_type = 0
else
do_type = @move_pet[0]
do_turn = @move_pet[1]
@move_pet = [type, turn]
end
case do_type
when 1
@pet.move_lower_left
when 2
@pet.move_down(do_turn)
when 3
@pet.move_lower_right
when 4
@pet.move_left(do_turn)
when 5
@pet.move_upper_left
when 6
@pet.move_right(do_turn)
when 7
@pet.move_upper_right
when 8
@pet.move_up(do_turn)
when 9
@pet.jump(do_turn[0], do_turn[1])
end
end
end

#==============================================================================
# Game_Pet
#==============================================================================

class Game_Pet < Game_Character
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :actor
attr_accessor :move_speed
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
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
@priority_type = $game_player.priority_type
end
#--------------------------------------------------------------------------
# Get screen Z
#--------------------------------------------------------------------------
def screen_z
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z - 1
end
super
end
#--------------------------------------------------------------------------
# Chek event trigger (here)
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
return false
end
#--------------------------------------------------------------------------
# Check event trigger (there)
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
return false
end
#--------------------------------------------------------------------------
# Check event trigger (touch)
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
return false
end
#--------------------------------------------------------------------------
# Jump
#--------------------------------------------------------------------------
def jump(x, y)
super(x, y)
end
end

#==============================================================================
# Spriteset_Map
#==============================================================================

class Spriteset_Map
#--------------------------------------------------------------------------
# Create characters
#--------------------------------------------------------------------------
alias pet_spriteset_map_create_characters create_characters unless $@
def create_characters
pet_spriteset_map_create_characters
@character_sprites << Sprite_Character.new(@viewport1, $game_party.pet)
end
end


To use: setup the enable switch and the pet ID (top of the script)
NOTE: The pet ID refers to the ID of an actual actor in the database, but only the walking graphic needs to be set.
slaQ
Yes! this is beautiful! exactly how I'd imagined happy.gif

I really owe you for this one originalwij.

Is there anything I can give back to you? Maybe help you out with some graphical stuff perhaps ?
(I'm a professional graphics designer)

Just name it and I'll fix it for you smile.gif

Thanks again,

slaQ
woratana
Nice~^^

Will this script work with caterpillar? Just curious.^^
originalwij
@slaQ

Thanks, glad to help!
I'll PM you when I figure out what graphics I need. I'm a scripter (obviously) and not very good at graphics ...

@woratana

I don't believe it will work with a caterpillar script as it is a mini-caterpillar script itself, but I will see what I can do ....
Kakeru
QUOTE (originalwij @ Dec 9 2008, 06:43 PM) *
@slaQ

Try this:

[Show/Hide] Pet Script v1.0
CODE

#==============================================================================
# Pet
#==============================================================================
# Author : OriginalWij
# Version : 1.0
#==============================================================================

# Pet enable switch number
PET_ENABLE_SWITCH = 1
# Pet ID (database actor number)
PET_ID = 5

#==============================================================================
# Game_Character
#==============================================================================

class Game_Character
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_accessor :priority_type
end

#==============================================================================
# Game_Player
#==============================================================================

class Game_Player
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :move_speed
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
alias pet_game_player_update update unless $@
def update
$game_party.update_pet
pet_game_player_update
end
#--------------------------------------------------------------------------
# Move to
#--------------------------------------------------------------------------
alias pet_game_player_moveto moveto unless $@
def moveto(x, y)
$game_party.moveto_pet(x, y)
pet_game_player_moveto(x, y)
end
#--------------------------------------------------------------------------
# Move down
#--------------------------------------------------------------------------
alias pet_game_player_move_down move_down unless $@
def move_down(turn = true)
if passable?(@x, @y + 1)
$game_party.move_pet(2, turn)
end
pet_game_player_move_down(turn)
end
#--------------------------------------------------------------------------
# Move left
#--------------------------------------------------------------------------
alias pet_game_player_move_left move_left unless $@
def move_left(turn = true)
if passable?(@x - 1, @y)
$game_party.move_pet(4, turn)
end
pet_game_player_move_left(turn)
end
#--------------------------------------------------------------------------
# Move right
#--------------------------------------------------------------------------
alias pet_game_player_move_right move_right unless $@
def move_right(turn = true)
if passable?(@x + 1, @y)
$game_party.move_pet(6, turn)
end
pet_game_player_move_right(turn)
end
#--------------------------------------------------------------------------
# Move up
#--------------------------------------------------------------------------
alias pet_game_player_move_up move_up unless $@
def move_up(turn = true)
if passable?(@x, @y - 1)
$game_party.move_pet(8, turn)
end
pet_game_player_move_up(turn)
end
#--------------------------------------------------------------------------
# Move down left
#--------------------------------------------------------------------------
alias pet_game_playermove_lower_left move_lower_left unless $@
def move_lower_left
if passable?(@x - 1, @y + 1)
$game_party.move_pet(1)
end
pet_game_playermove_lower_left
end
#--------------------------------------------------------------------------
# Move down right
#--------------------------------------------------------------------------
alias pet_game_playermove_lower_right move_lower_right unless $@
def move_lower_right
if passable?(@x + 1, @y + 1)
$game_party.move_pet(3)
end
pet_game_playermove_lower_right
end
#--------------------------------------------------------------------------
# Move up left
#--------------------------------------------------------------------------
alias pet_game_player_move_upper_left move_upper_left unless $@
def move_upper_left
if passable?(@x - 1, @y - 1)
$game_party.move_pet(5)
end
pet_game_player_move_upper_left
end
#--------------------------------------------------------------------------
# Move up right
#--------------------------------------------------------------------------
alias pet_game_player_move_upper_right move_upper_right unless $@
def move_upper_right
if passable?(@x + 1, @y - 1)
$game_party.move_pet(7)
end
pet_game_player_move_upper_right
end
#--------------------------------------------------------------------------
# Jump
#--------------------------------------------------------------------------
alias pet_game_player_jump jump unless $@
def jump(pet_x, pet_y)
new_x = @x + pet_x
new_y = @y + pet_y
if (pet_x == 0 and pet_y == 0) or passable?(new_x, new_y)
$game_party.move_pet(9, [pet_x, pet_y])
end
pet_game_player_jump(pet_x, pet_y)
end
end

#==============================================================================
# Game_Party
#==============================================================================

class Game_Party
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :pet
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
alias pet_game_party_initialize initialize unless $@
def initialize
pet_game_party_initialize
@pet = Game_Pet.new(nil)
@move_pet = []
end
#--------------------------------------------------------------------------
# Update pet
#--------------------------------------------------------------------------
def update_pet
@pet.actor = PET_ID
@pet.move_speed = $game_player.move_speed
if $game_player.dash?
@pet.move_speed += 1
end
@pet.update
@pet.transparent = !$game_switches[PET_ENABLE_SWITCH]
end
#--------------------------------------------------------------------------
# Move to (pet)
#--------------------------------------------------------------------------
def moveto_pet(x, y)
@pet.moveto(x, y)
@move_pet.clear
end
#--------------------------------------------------------------------------
# Move pet
#--------------------------------------------------------------------------
def move_pet(type, turn = false)
if @move_pet == nil
@move_pet = [type, turn]
do_type = 0
else
do_type = @move_pet[0]
do_turn = @move_pet[1]
@move_pet = [type, turn]
end
case do_type
when 1
@pet.move_lower_left
when 2
@pet.move_down(do_turn)
when 3
@pet.move_lower_right
when 4
@pet.move_left(do_turn)
when 5
@pet.move_upper_left
when 6
@pet.move_right(do_turn)
when 7
@pet.move_upper_right
when 8
@pet.move_up(do_turn)
when 9
@pet.jump(do_turn[0], do_turn[1])
end
end
end

#==============================================================================
# Game_Pet
#==============================================================================

class Game_Pet < Game_Character
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :actor
attr_accessor :move_speed
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
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
@priority_type = $game_player.priority_type
end
#--------------------------------------------------------------------------
# Get screen Z
#--------------------------------------------------------------------------
def screen_z
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z - 1
end
super
end
#--------------------------------------------------------------------------
# Chek event trigger (here)
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
return false
end
#--------------------------------------------------------------------------
# Check event trigger (there)
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
return false
end
#--------------------------------------------------------------------------
# Check event trigger (touch)
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
return false
end
#--------------------------------------------------------------------------
# Jump
#--------------------------------------------------------------------------
def jump(x, y)
super(x, y)
end
end

#==============================================================================
# Spriteset_Map
#==============================================================================

class Spriteset_Map
#--------------------------------------------------------------------------
# Create characters
#--------------------------------------------------------------------------
alias pet_spriteset_map_create_characters create_characters unless $@
def create_characters
pet_spriteset_map_create_characters
@character_sprites << Sprite_Character.new(@viewport1, $game_party.pet)
end
end


To use: setup the enable switch and the pet ID (top of the script)
NOTE: The pet ID refers to the ID of an actual actor in the database, but only the walking graphic needs to be set.



Sorry how do u use this pinch.gif im nwe to RPG maker VX and well im really not taht good could you please make a tiny beginers guild of how to use this thanks i would be truly grateful and thank you fro the scrpit biggrin.gif pinch.gif
originalwij
Update (per Woratana's question): this script IS compatible with Trickster's caterpillar script (the one I use)
However, if you use both, the pet will overlap the first actor in the caterpillar.

There is a fix though: find and replace the line I specified with the code below it ....
CODE
  #--------------------------------------------------------------------------
  # Update Followers
  #--------------------------------------------------------------------------
  def update_followers
    flag = $game_player.transparent || $game_switches[CATERPILLAR]
    @followers.each_with_index do |char, i|
      char.actor = @actors[i + 1]   <======= replace this line with the code below

      if $game_switches[1] and i == 0
        char.actor = @actors[i + 6]
      elsif $game_switches[1]
        char.actor = @actors[i]
      else
        char.actor = @actors[i + 1]
      end

... where the switch specified is the same switch specified in the Pet Script
AND the number "6" is the actor ID of a blank actor
EDIT: you also need to increase the caterpillar size by 1 to make room for the blank character (where the pet will appear)

@ Kakeru
1) insert the script in the materials section above main in the script window
2) specify the switch and the pet ID at the top of the script (change them to fit your game)
3) turn on the switch in the game (using an event command) to activate the pet (or switch off to deactivate)
Oralom
Am I missing something? What does it actually do? Like does the pet fight in battle? I may sound like a complete tard for asking, but for some odd reason I can't figure out what the script is for. Well, besides pets, but what about the pets? Like do they follow you? Fight for you? Join your party? Do you have to feed them & take care of them? I'm really lost. All i know is that it's a script about pets, but no one said what it does.
originalwij
@Oralom
it just adds the pet to follow you, without being in the party, that's it.
the pet in this script does nothing.
I scripted it as a request.
it's up to you to add scripts/events to make it do what you want it to (ex. auto-battle in a party, find items, etc.)
N2Y
This script is fantastic.

Any chance this could be converted to RMXP? The only caterpillar scripts offered for RMXP need actual party members, which is not what I need.

Anyways, great job nonetheless!
originalwij
i'm not sure if it could be converted to XP or not.
i've never worked with XP (went from 2003 to VX)
but, if someone else can port it to XP, you have my permission ...
nobodyreal
I've been looking for a script like this for a really long time. Thanks originalwij! I have a question though. Is there a way to allow more than one pet? Like if I have a princess that follows you at one point of the game, and a dog that follows you at another point, is there a way to do that and have different switches activate each one?
kamster94
can u add txt file with this script? because when i try to copy it, and paste, it is all in one line ;( pls help
(it may be due by php interpretor)
originalwij
@nobodyreal
just change the graphic for the pet (actor) using the corresponding event command to do so.
that way you could have unlimited pets (actors) laugh.gif (just not at the same time)

@kamster94
try pasting it into Notepad/Wordpad first .... (usually works) dry.gif
(if not i'll post a demo, let me know)
GuyInTraining
Originalwij, would you please add a feature to show "Baloon Icons" on the pet via call script or something?
I think it would be nice for events... smile.gif
trizty
Is it possible to disable the jump for the pet (I have a huge bird for a pet, but I was having difficulty figuring this out), preferably with a switch or variable so that in some cases, I can enable the jump?
darkubersaw
is there a way for you to make it so i can "talk" to the pet and it will give choices like "Feed", "Play" ect.?
buny
how to giving a pet name or function to attack or waaaaaatt??
kaimonkey
Is there a way I can make the pet follow infront?
Darastrix
Then aren't you technically following the pet?besides I think it would be impossible since the pet only moves after calculating your movement,but since your behind you clash with the pet causing you to stop but the pet goes forward,and it can easily get trapped in sharp corners
kaimonkey
No, I just wanted only the pets to have stats, and the actual player to just walk around, I thoufght I mgight be able to do that by reating the owner like a pet....
Darastrix
Well,just change the actors picture to a pet picture and the pet picture to the actor picture..
kaimonkey
No, you mis understood, at the moment, the actor infront has stats, and the pet behind doesn't. I want that to swap round, but the owner to still be infront. So that when they are in a fight, they don't fight, their pets do. All it is making the pet have stats and the owner infront nots, It sounds simple, but I know its not
Darastrix
QUOTE (kaimonkey @ Mar 10 2009, 08:51 PM) *
No, you mis understood, at the moment, the actor infront has stats, and the pet behind doesn't. I want that to swap round, but the owner to still be infront. So that when they are in a fight, they don't fight, their pets do. All it is making the pet have stats and the owner infront nots, It sounds simple, but I know its not


That doesn't seem very simple at all
shadowedchaosknight
How do you call the event specifically? I honestly have no idea on how to get the dog follow you, I have the actor ID and the script enabled, just not sure how to actually get the pet to show up
Oralom
After much thought I decided to come back to this thread. I finally understand what it's for, but I just have one question. Have you ever played EarthBound? You know how they have the Teddy Bear that follows you, but doesn't battle? Instead it takes damage for you. Well, up to a certain amount, then it's destroyed. Anyway, I was wondering if I could do something similar to that using this script?


Edit:
Speaking of Teddy Bears, does anyone know where I can find a Teddy Bear sprite to use as a character?
Michael
QUOTE (originalwij @ Dec 10 2008, 04:43 AM) *
@slaQ

Try this:

[Show/Hide] Pet Script v1.0
CODE

#==============================================================================
# Pet
#==============================================================================
# Author : OriginalWij
# Version : 1.0
#==============================================================================

# Pet enable switch number
PET_ENABLE_SWITCH = 1
# Pet ID (database actor number)
PET_ID = 5

#==============================================================================
# Game_Character
#==============================================================================

class Game_Character
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_accessor :priority_type
end

#==============================================================================
# Game_Player
#==============================================================================

class Game_Player
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :move_speed
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
alias pet_game_player_update update unless $@
def update
$game_party.update_pet
pet_game_player_update
end
#--------------------------------------------------------------------------
# Move to
#--------------------------------------------------------------------------
alias pet_game_player_moveto moveto unless $@
def moveto(x, y)
$game_party.moveto_pet(x, y)
pet_game_player_moveto(x, y)
end
#--------------------------------------------------------------------------
# Move down
#--------------------------------------------------------------------------
alias pet_game_player_move_down move_down unless $@
def move_down(turn = true)
if passable?(@x, @y + 1)
$game_party.move_pet(2, turn)
end
pet_game_player_move_down(turn)
end
#--------------------------------------------------------------------------
# Move left
#--------------------------------------------------------------------------
alias pet_game_player_move_left move_left unless $@
def move_left(turn = true)
if passable?(@x - 1, @y)
$game_party.move_pet(4, turn)
end
pet_game_player_move_left(turn)
end
#--------------------------------------------------------------------------
# Move right
#--------------------------------------------------------------------------
alias pet_game_player_move_right move_right unless $@
def move_right(turn = true)
if passable?(@x + 1, @y)
$game_party.move_pet(6, turn)
end
pet_game_player_move_right(turn)
end
#--------------------------------------------------------------------------
# Move up
#--------------------------------------------------------------------------
alias pet_game_player_move_up move_up unless $@
def move_up(turn = true)
if passable?(@x, @y - 1)
$game_party.move_pet(8, turn)
end
pet_game_player_move_up(turn)
end
#--------------------------------------------------------------------------
# Move down left
#--------------------------------------------------------------------------
alias pet_game_playermove_lower_left move_lower_left unless $@
def move_lower_left
if passable?(@x - 1, @y + 1)
$game_party.move_pet(1)
end
pet_game_playermove_lower_left
end
#--------------------------------------------------------------------------
# Move down right
#--------------------------------------------------------------------------
alias pet_game_playermove_lower_right move_lower_right unless $@
def move_lower_right
if passable?(@x + 1, @y + 1)
$game_party.move_pet(3)
end
pet_game_playermove_lower_right
end
#--------------------------------------------------------------------------
# Move up left
#--------------------------------------------------------------------------
alias pet_game_player_move_upper_left move_upper_left unless $@
def move_upper_left
if passable?(@x - 1, @y - 1)
$game_party.move_pet(5)
end
pet_game_player_move_upper_left
end
#--------------------------------------------------------------------------
# Move up right
#--------------------------------------------------------------------------
alias pet_game_player_move_upper_right move_upper_right unless $@
def move_upper_right
if passable?(@x + 1, @y - 1)
$game_party.move_pet(7)
end
pet_game_player_move_upper_right
end
#--------------------------------------------------------------------------
# Jump
#--------------------------------------------------------------------------
alias pet_game_player_jump jump unless $@
def jump(pet_x, pet_y)
new_x = @x + pet_x
new_y = @y + pet_y
if (pet_x == 0 and pet_y == 0) or passable?(new_x, new_y)
$game_party.move_pet(9, [pet_x, pet_y])
end
pet_game_player_jump(pet_x, pet_y)
end
end

#==============================================================================
# Game_Party
#==============================================================================

class Game_Party
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :pet
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
alias pet_game_party_initialize initialize unless $@
def initialize
pet_game_party_initialize
@pet = Game_Pet.new(nil)
@move_pet = []
end
#--------------------------------------------------------------------------
# Update pet
#--------------------------------------------------------------------------
def update_pet
@pet.actor = PET_ID
@pet.move_speed = $game_player.move_speed
if $game_player.dash?
@pet.move_speed += 1
end
@pet.update
@pet.transparent = !$game_switches[PET_ENABLE_SWITCH]
end
#--------------------------------------------------------------------------
# Move to (pet)
#--------------------------------------------------------------------------
def moveto_pet(x, y)
@pet.moveto(x, y)
@move_pet.clear
end
#--------------------------------------------------------------------------
# Move pet
#--------------------------------------------------------------------------
def move_pet(type, turn = false)
if @move_pet == nil
@move_pet = [type, turn]
do_type = 0
else
do_type = @move_pet[0]
do_turn = @move_pet[1]
@move_pet = [type, turn]
end
case do_type
when 1
@pet.move_lower_left
when 2
@pet.move_down(do_turn)
when 3
@pet.move_lower_right
when 4
@pet.move_left(do_turn)
when 5
@pet.move_upper_left
when 6
@pet.move_right(do_turn)
when 7
@pet.move_upper_right
when 8
@pet.move_up(do_turn)
when 9
@pet.jump(do_turn[0], do_turn[1])
end
end
end

#==============================================================================
# Game_Pet
#==============================================================================

class Game_Pet < Game_Character
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :actor
attr_accessor :move_speed
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
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
@priority_type = $game_player.priority_type
end
#--------------------------------------------------------------------------
# Get screen Z
#--------------------------------------------------------------------------
def screen_z
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z - 1
end
super
end
#--------------------------------------------------------------------------
# Chek event trigger (here)
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
return false
end
#--------------------------------------------------------------------------
# Check event trigger (there)
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
return false
end
#--------------------------------------------------------------------------
# Check event trigger (touch)
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
return false
end
#--------------------------------------------------------------------------
# Jump
#--------------------------------------------------------------------------
def jump(x, y)
super(x, y)
end
end

#==============================================================================
# Spriteset_Map
#==============================================================================

class Spriteset_Map
#--------------------------------------------------------------------------
# Create characters
#--------------------------------------------------------------------------
alias pet_spriteset_map_create_characters create_characters unless $@
def create_characters
pet_spriteset_map_create_characters
@character_sprites << Sprite_Character.new(@viewport1, $game_party.pet)
end
end


To use: setup the enable switch and the pet ID (top of the script)
NOTE: The pet ID refers to the ID of an actual actor in the database, but only the walking graphic needs to be set.


Great work, I do like it myself. I have a idea if anyone wants to use it. You can always try and find or create a pokemon character, then use it as a pet by using the script. I wouldn't because I'm not a fan of Pokemon but I just remembered these people playing it the other day. Anyway, thanks again.
ASCIIgod
QUOTE (originalwij @ Dec 9 2008, 11:43 AM) *
@slaQ

Try this:

[Show/Hide] Pet Script v1.0
CODE

#==============================================================================
# Pet
#==============================================================================
# Author : OriginalWij
# Version : 1.0
#==============================================================================

# Pet enable switch number
PET_ENABLE_SWITCH = 1
# Pet ID (database actor number)
PET_ID = 5

#==============================================================================
# Game_Character
#==============================================================================

class Game_Character
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_accessor :priority_type
end

#==============================================================================
# Game_Player
#==============================================================================

class Game_Player
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :move_speed
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
alias pet_game_player_update update unless $@
def update
$game_party.update_pet
pet_game_player_update
end
#--------------------------------------------------------------------------
# Move to
#--------------------------------------------------------------------------
alias pet_game_player_moveto moveto unless $@
def moveto(x, y)
$game_party.moveto_pet(x, y)
pet_game_player_moveto(x, y)
end
#--------------------------------------------------------------------------
# Move down
#--------------------------------------------------------------------------
alias pet_game_player_move_down move_down unless $@
def move_down(turn = true)
if passable?(@x, @y + 1)
$game_party.move_pet(2, turn)
end
pet_game_player_move_down(turn)
end
#--------------------------------------------------------------------------
# Move left
#--------------------------------------------------------------------------
alias pet_game_player_move_left move_left unless $@
def move_left(turn = true)
if passable?(@x - 1, @y)
$game_party.move_pet(4, turn)
end
pet_game_player_move_left(turn)
end
#--------------------------------------------------------------------------
# Move right
#--------------------------------------------------------------------------
alias pet_game_player_move_right move_right unless $@
def move_right(turn = true)
if passable?(@x + 1, @y)
$game_party.move_pet(6, turn)
end
pet_game_player_move_right(turn)
end
#--------------------------------------------------------------------------
# Move up
#--------------------------------------------------------------------------
alias pet_game_player_move_up move_up unless $@
def move_up(turn = true)
if passable?(@x, @y - 1)
$game_party.move_pet(8, turn)
end
pet_game_player_move_up(turn)
end
#--------------------------------------------------------------------------
# Move down left
#--------------------------------------------------------------------------
alias pet_game_playermove_lower_left move_lower_left unless $@
def move_lower_left
if passable?(@x - 1, @y + 1)
$game_party.move_pet(1)
end
pet_game_playermove_lower_left
end
#--------------------------------------------------------------------------
# Move down right
#--------------------------------------------------------------------------
alias pet_game_playermove_lower_right move_lower_right unless $@
def move_lower_right
if passable?(@x + 1, @y + 1)
$game_party.move_pet(3)
end
pet_game_playermove_lower_right
end
#--------------------------------------------------------------------------
# Move up left
#--------------------------------------------------------------------------
alias pet_game_player_move_upper_left move_upper_left unless $@
def move_upper_left
if passable?(@x - 1, @y - 1)
$game_party.move_pet(5)
end
pet_game_player_move_upper_left
end
#--------------------------------------------------------------------------
# Move up right
#--------------------------------------------------------------------------
alias pet_game_player_move_upper_right move_upper_right unless $@
def move_upper_right
if passable?(@x + 1, @y - 1)
$game_party.move_pet(7)
end
pet_game_player_move_upper_right
end
#--------------------------------------------------------------------------
# Jump
#--------------------------------------------------------------------------
alias pet_game_player_jump jump unless $@
def jump(pet_x, pet_y)
new_x = @x + pet_x
new_y = @y + pet_y
if (pet_x == 0 and pet_y == 0) or passable?(new_x, new_y)
$game_party.move_pet(9, [pet_x, pet_y])
end
pet_game_player_jump(pet_x, pet_y)
end
end

#==============================================================================
# Game_Party
#==============================================================================

class Game_Party
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :pet
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
alias pet_game_party_initialize initialize unless $@
def initialize
pet_game_party_initialize
@pet = Game_Pet.new(nil)
@move_pet = []
end
#--------------------------------------------------------------------------
# Update pet
#--------------------------------------------------------------------------
def update_pet
@pet.actor = PET_ID
@pet.move_speed = $game_player.move_speed
if $game_player.dash?
@pet.move_speed += 1
end
@pet.update
@pet.transparent = !$game_switches[PET_ENABLE_SWITCH]
end
#--------------------------------------------------------------------------
# Move to (pet)
#--------------------------------------------------------------------------
def moveto_pet(x, y)
@pet.moveto(x, y)
@move_pet.clear
end
#--------------------------------------------------------------------------
# Move pet
#--------------------------------------------------------------------------
def move_pet(type, turn = false)
if @move_pet == nil
@move_pet = [type, turn]
do_type = 0
else
do_type = @move_pet[0]
do_turn = @move_pet[1]
@move_pet = [type, turn]
end
case do_type
when 1
@pet.move_lower_left
when 2
@pet.move_down(do_turn)
when 3
@pet.move_lower_right
when 4
@pet.move_left(do_turn)
when 5
@pet.move_upper_left
when 6
@pet.move_right(do_turn)
when 7
@pet.move_upper_right
when 8
@pet.move_up(do_turn)
when 9
@pet.jump(do_turn[0], do_turn[1])
end
end
end

#==============================================================================
# Game_Pet
#==============================================================================

class Game_Pet < Game_Character
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :actor
attr_accessor :move_speed
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
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
@priority_type = $game_player.priority_type
end
#--------------------------------------------------------------------------
# Get screen Z
#--------------------------------------------------------------------------
def screen_z
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z - 1
end
super
end
#--------------------------------------------------------------------------
# Chek event trigger (here)
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
return false
end
#--------------------------------------------------------------------------
# Check event trigger (there)
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
return false
end
#--------------------------------------------------------------------------
# Check event trigger (touch)
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
return false
end
#--------------------------------------------------------------------------
# Jump
#--------------------------------------------------------------------------
def jump(x, y)
super(x, y)
end
end

#==============================================================================
# Spriteset_Map
#==============================================================================

class Spriteset_Map
#--------------------------------------------------------------------------
# Create characters
#--------------------------------------------------------------------------
alias pet_spriteset_map_create_characters create_characters unless $@
def create_characters
pet_spriteset_map_create_characters
@character_sprites << Sprite_Character.new(@viewport1, $game_party.pet)
end
end


To use: setup the enable switch and the pet ID (top of the script)
NOTE: The pet ID refers to the ID of an actual actor in the database, but only the walking graphic needs to be set.


hey guys its me ASCIIgod again. did anyone of you imagine 2 pet scripts?? one for pet and one for a cart huh?? then the solution is this script i made. its free to use, no credits needed. the instruction is just the same as the pet one. heres the code

[Show/Hide] the cart script


#==============================================================================
# Cart
#==============================================================================
# Author : ASCIIgod
# Version : 0.5 beta
# note: this script is similar to pet script. it does nothing but look as thought
# you have a Ragnarok styled cart happy.gif
#==============================================================================

# Pet enable switch number
CART_ENABLE_SWITCH = 4
# Pet ID (database actor number)
CART_ID = 5

#==============================================================================
# Game_Character
#==============================================================================

class Game_Character
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_accessor :priority_type
end

#==============================================================================
# Game_Player
#==============================================================================

class Game_Player
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :move_speed
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
alias cart_game_player_update update unless $@
def update
$game_party.update_cart
cart_game_player_update
end
#--------------------------------------------------------------------------
# Move to
#--------------------------------------------------------------------------
alias cart_game_player_moveto moveto unless $@
def moveto(x, y)
$game_party.moveto_cart(x, y)
cart_game_player_moveto(x, y)
end
#--------------------------------------------------------------------------
# Move down
#--------------------------------------------------------------------------
alias cart_game_player_move_down move_down unless $@
def move_down(turn = true)
if passable?(@x, @y + 1)
$game_party.move_cart(2, turn)
end
cart_game_player_move_down(turn)
end
#--------------------------------------------------------------------------
# Move left
#--------------------------------------------------------------------------
alias cart_game_player_move_left move_left unless $@
def move_left(turn = true)
if passable?(@x - 1, @y)
$game_party.move_cart(4, turn)
end
cart_game_player_move_left(turn)
end
#--------------------------------------------------------------------------
# Move right
#--------------------------------------------------------------------------
alias cart_game_player_move_right move_right unless $@
def move_right(turn = true)
if passable?(@x + 1, @y)
$game_party.move_cart(6, turn)
end
cart_game_player_move_right(turn)
end
#--------------------------------------------------------------------------
# Move up
#--------------------------------------------------------------------------
alias cart_game_player_move_up move_up unless $@
def move_up(turn = true)
if passable?(@x, @y - 1)
$game_party.move_cart(8, turn)
end
cart_game_player_move_up(turn)
end
#--------------------------------------------------------------------------
# Move down left
#--------------------------------------------------------------------------
alias cart_game_playermove_lower_left move_lower_left unless $@
def move_lower_left
if passable?(@x - 1, @y + 1)
$game_party.move_cart(1)
end
cart_game_playermove_lower_left
end
#--------------------------------------------------------------------------
# Move down right
#--------------------------------------------------------------------------
alias cart_game_playermove_lower_right move_lower_right unless $@
def move_lower_right
if passable?(@x + 1, @y + 1)
$game_party.move_cart(3)
end
cart_game_playermove_lower_right
end
#--------------------------------------------------------------------------
# Move up left
#--------------------------------------------------------------------------
alias cart_game_player_move_upper_left move_upper_left unless $@
def move_upper_left
if passable?(@x - 1, @y - 1)
$game_party.move_cart(5)
end
cart_game_player_move_upper_left
end
#--------------------------------------------------------------------------
# Move up right
#--------------------------------------------------------------------------
alias cart_game_player_move_upper_right move_upper_right unless $@
def move_upper_right
if passable?(@x + 1, @y - 1)
$game_party.move_cart(7)
end
cart_game_player_move_upper_right
end
#--------------------------------------------------------------------------
# Jump
#--------------------------------------------------------------------------
alias cart_game_player_jump jump unless $@
def jump(cart_x, cart_y)
new_x = @x + cart_x
new_y = @y + cart_y
if (cart_x == 0 and cart_y == 0) or passable?(new_x, new_y)
$game_party.move_cart(9, [cart_x, cart_y])
end
cart_game_player_jump(cart_x, cart_y)
end
end

#==============================================================================
# Game_Party
#==============================================================================

class Game_Party
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :cart
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
alias cart_game_party_initialize initialize unless $@
def initialize
cart_game_party_initialize
@cart = Game_cart.new(nil)
@move_cart = []
end
#--------------------------------------------------------------------------
# Update pet
#--------------------------------------------------------------------------
def update_cart
@cart.actor = CART_ID
@cart.move_speed = $game_player.move_speed
if $game_player.dash?
@cart.move_speed += 1
end
@cart.update
@cart.transparent = !$game_switches[CART_ENABLE_SWITCH]
end
#--------------------------------------------------------------------------
# Move to (cart)
#--------------------------------------------------------------------------
def moveto_cart(x, y)
@cart.moveto(x, y)
@move_cart.clear
end
#--------------------------------------------------------------------------
# Move cart
#--------------------------------------------------------------------------
def move_cart(type, turn = false)
if @move_cart == nil
@move_cart = [type, turn]
do_type = 0
else
do_type = @move_cart[0]
do_turn = @move_cart[1]
@move_cart = [type, turn]
end
case do_type
when 1
@cart.move_lower_left
when 2
@cart.move_down(do_turn)
when 3
@cart.move_lower_right
when 4
@cart.move_left(do_turn)
when 5
@cart.move_upper_left
when 6
@cart.move_right(do_turn)
when 7
@cart.move_upper_right
when 8
@cart.move_up(do_turn)
when 9
@cart.jump(do_turn[0], do_turn[1])
end
end
end

#==============================================================================
# Game_Pet
#==============================================================================

class Game_cart < Game_Character
#--------------------------------------------------------------------------
# Public instance variables
#--------------------------------------------------------------------------
attr_reader :actor
attr_accessor :move_speed
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
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
@priority_type = $game_player.priority_type
end
#--------------------------------------------------------------------------
# Get screen Z
#--------------------------------------------------------------------------
def screen_z
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z - 1
end
super
end
#--------------------------------------------------------------------------
# Chek event trigger (here)
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
return false
end
#--------------------------------------------------------------------------
# Check event trigger (there)
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
return false
end
#--------------------------------------------------------------------------
# Check event trigger (touch)
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
return false
end
#--------------------------------------------------------------------------
# Jump
#--------------------------------------------------------------------------
def jump(x, y)
super(x, y)
end
end

#==============================================================================
# Spriteset_Map
#==============================================================================

class Spriteset_Map
#--------------------------------------------------------------------------
# Create characters
#--------------------------------------------------------------------------
alias cart_spriteset_map_create_characters create_characters unless $@
def create_characters
cart_spriteset_map_create_characters
@character_sprites << Sprite_Character.new(@viewport4, $game_party.cart)
end
end

FireRMVX
Hey i odnt understand the to use can you eexplain it a lil more? thanks
ASCIIgod
QUOTE (FireRMVX @ Jun 9 2009, 07:26 PM) *
Hey i odnt understand the to use can you eexplain it a lil more? thanks


are you asking bout me cart script matey?? just activate the switch and it'll work
Lady Atlas
It's been a while since anyone has posted on this... But I was wondering if anyone knew how I cause the pet to keep moving (walking animation?) while staying in one position. It's a bat... So it needs to be flying... It looks weird when it stops in mid-air and just hangs there!
starbit
OK i know this is an old post but is there anyway to change the pet that comes up i know how to do it before the game starts and stuff and how it works but like i wanna make a shop where you can talk to the guy and he will give you a list of pets he has and you click on one and that pet follows you as of right now i can only get the dog to come up like is there a switch i can us or something to make it change to each pet i click on?
Kread-EX
Please use punctuation and capitalization because I don't understand your post at all. Just that you want a pet shop or something like that.
starbit
Ok Sorry. I'm using Pet Script v1.0, which lets you set a actor to follow you ( a pet ). Is there anyway to change the actor with a switch or event in game so i can set up a pet shop.
Kread-EX
Try to add this snippet under Wij's script.

CODE
#==============================================================================
# Game_System
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # Public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :pet_id
end

#==============================================================================
# Game_Player
#==============================================================================
class Game_Party
  #--------------------------------------------------------------------------
  # Update pet
  #--------------------------------------------------------------------------
  def update_pet
    $game_system.pet_id = PET_ID if $game_system.pet_id == nil
    @pet.actor = $game_system.pet_id
    @pet.move_speed = $game_player.move_speed
    if $game_player.dash?
      @pet.move_speed += 1
    end
    @pet.update
    @pet.transparent = !$game_switches[PET_ENABLE_SWITCH]
  end
end

To change the pet, use a Call Script event command:
CODE
$game_system.pet_id = XXX
(replace XXX with the ID of the pet in the database)
starbit
I must be doing something wrong ... To make the pet change work, would i just make a random person and make him say something like "would you like to change your pet" and put the "$game_system.pet_id = XXX" as a script?


never mind i'm dumb hahaha .... thanks so much biggrin.gif
LilTerra
This Is What To Do Make New Items With Your Pets Call Them Something Like Monkey's Whistle Cow's Whistle Whatever No Where It Says Consume Put No Now Make A commun Event Which Changes The Graphic (Like A Normal Change Actor Graphic) With this You Can Change The Graphic Of The Pet Actor And There You Go You Can change Pet Types. If You want to Make A Shop Add These Items To You Shop. If You are Talking About Swapping Pets You Can Just Change Event Graphic And Change Pet Graphic! I Will Make A Demo About What I Mean L8r
Kread-EX
Jesus Christ...
Please don't type like that. Your post is entirely unreadable. You only need to capitalize the first letter of the sentence.

>_<
LilTerra
Im sorry its a habit Here is A DEMO Explaining What I Was Saying For Starbit In Attachment
Goose112
I'm so confused. The original pet script that was posted on here, how do I enable the pet to make it work? I'm so new to VX, I was working on 2003 for awhile and just switched over to this so everything is so new to me (with what I didnt already know) I really wanna get this working so can someone plz help me?
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.