Estou precisando muito de um Script de pet p/ netplay ou p/ jogo offline!
Me ajudem dou +1 Cred please!
Me ajudem dou +1 Cred please!
=begin
:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
|Autor: RD12| Pet Global
--------------------------------------------------------------------------------
Com esse sistema os jogadores poderão ter Pets, globais.
O pet será o Anel[acessório].
--------------------------------------------------------------------------------
Para criar um Pet, insira no Módulo PET o seguinte:
ID[id] = ["Gráfico", HP, MP, Tempo]
---------------------------Explicação-------------------------------------------
id = ID do Anel, que será o Pet
HP/MP = HP/MP que o pet recupera com o Tempo
Tempo = Segundos que o pet recupera o HP/MP
:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
AldeiaRpgBr.com
=end
module PET
ID = []
#ID[Luva_ID] = ["Gráfico", HP, MP, Tempo(segundos)]
ID[25] = ["151-Animal01", 0, 0, 0]#Botei pra não recuperar HP/MP
#ID[2] = ["mecha", 10, 10, 5]
end
class Scene_Map
attr_reader :spriteset
end
class Spriteset_Map
attr_reader :character_sprites, :viewport1
alias rd12_dispose dispose
def player_sprite
@character_sprites.each do |spr_char|
if spr_char.character == $game_player
return spr_char
end
end
end
def dispose
$Pet = nil
rd12_dispose
end
end
class Scene_Map
attr_reader :character
attr_reader :animation_id
alias alias_update update
def update
alias_update
return if !$scene.is_a?(Scene_Map)
return if $scene.spriteset.nil?
@actor = $game_party.actors[0]
return unless $scene.is_a?(Scene_Map)
if PET::ID[@actor.armor4_id].nil? or @actor.armor4_id.nil?
return if $Pet.nil?
$Pet.bitmap = RPG::Cache.character("", 4)
$Pet = nil
return
end
@direção = $game_player.direction
#Criar sprite do pet
unless $Pet
$Pet = Sprite.new(@spriteset.viewport1)
$Pet.x = $game_player.screen_x
$Pet.y = $game_player.screen_y
end
$Pet.bitmap = RPG::Cache.character(PET::ID[@actor.armor4_id][0], 4)
#Pet Recuperar o HP/MP com o tempo
tempo = PET::ID[@actor.armor4_id][3]
if tempo > 0
if Graphics.frame_count % (20 * tempo) == 0
$game_party.actors[0].hp += PET::ID[@actor.armor4_id][1]
$game_party.actors[0].sp += PET::ID[@actor.armor4_id][2]
end
end
#Cria o gráfico do Pet, e com animação de andar
cw = $Pet.bitmap.width / 4
ch = $Pet.bitmap.height / 4
aw = $frame*cw
ah = (@direção - 2) / 2 * ch
$Pet.src_rect = Rect.new(aw, ah, cw ,ch )
player_spr = $scene.spriteset.player_sprite
#Pet Seguir o Player
#Direção =:2:=
if $game_player.direction == 2
$Pet.z = player_spr.z - 1
return unless $game_map.passable?($game_player.x, $game_player.y-1, 2)
if $Pet.x < ($game_player.screen_x - $Pet.bitmap.width/8)
$Pet.x += 4
end
if $Pet.x > ($game_player.screen_x - $Pet.bitmap.width/8)
$Pet.x -= 4
end
if $Pet.y < ($game_player.screen_y-32-$Pet.bitmap.height/4)
$Pet.y += 4
end
if $Pet.y > ($game_player.screen_y-32-$Pet.bitmap.height/4)
$Pet.y -= 4
end
#Direção =:4:=
elsif $game_player.direction == 4
return unless $game_map.passable?($game_player.x+1, $game_player.y, 4)
$Pet.z = player_spr.z + 1
if $Pet.x < ($game_player.screen_x+16)
$Pet.x += 4
end
if $Pet.x > ($game_player.screen_x+16)
$Pet.x -= 4
end
if $Pet.y < ($game_player.screen_y-$Pet.bitmap.height/4)
$Pet.y += 4
end
if $Pet.y > ($game_player.screen_y-$Pet.bitmap.height/4)
$Pet.y -= 4
end
#Direção =:6:=
elsif $game_player.direction == 6
return unless $game_map.passable?($game_player.x-1, $game_player.y, 6)
$Pet.z = player_spr.z + 1
if $Pet.x < ($game_player.screen_x-16-$Pet.bitmap.width/4)
$Pet.x += 4
end
if $Pet.x > ($game_player.screen_x-16-$Pet.bitmap.width/4)
$Pet.x -= 4
end
if $Pet.y < ($game_player.screen_y-$Pet.bitmap.height/4)
$Pet.y += 4
end
if $Pet.y > ($game_player.screen_y-$Pet.bitmap.height/4)
$Pet.y -= 4
end
#Direção =:8:=
elsif $game_player.direction == 8
return unless $game_map.passable?($game_player.x, $game_player.y+1, 8)
$Pet.z = player_spr.z + 1
if $Pet.x < ($game_player.screen_x - ($Pet.bitmap.width/8))
$Pet.x += 4
end
if $Pet.x > ($game_player.screen_x - ($Pet.bitmap.width/8))
$Pet.x -= 4
end
if $Pet.y < ($game_player.screen_y+12-($Pet.bitmap.height/8))
$Pet.y += 4
end
if $Pet.y > ($game_player.screen_y+12-($Pet.bitmap.height/8))
$Pet.y -= 4
end
end#if player.direction
end#update
end#class
module PET
ID[0] = nil
end
class Sprite_Character < RPG::Sprite
alias alias_update update
def update
alias_update
$frame = @character.pattern
end
end