Hey ... I didn't know where to post that ... I thought it was in script troubleshooting but Blizzard rules said "If there is a topic related to your script in script database then post in this topic" so here I am ...
I think it is a very good script and I decided to use it in my game, but I don't have good animation to show a "target" for now so ... I decided to add a little something :
show the targeting graphic with a picture. And it works, but I just have one issue.
When I teleport my hero from a map to another, then an automatic event run but ... the graphic is still here ! And it targets an empty place I don't know why xD (even when I put wait at the first line of the event).
I think it is not really related to this script in particular but to every scripts that use pictures, I'm not a very good scripter I think so here is the part I changed ( "labelled" with Stanley's add) :
#==============================================================================
# Sprite_Targeter
#==============================================================================
class Sprite_Targeter < RPG::Sprite
attr_accessor :character
def initialize(viewport, character = nil)
super(viewport)
# stanley's add : if else
if LiTTleDRAgo::TARGET_ANIMATION_ID == nil
self.bitmap = RPG::Cache.picture("Curseur ennemi") # the name of the picture
self.src_rect = Rect.new(0, 0, 32, 32)
self.visible = false
else
self.bitmap = Bitmap.new(1, 1)
end
@character = character
update
end
# STANLEY'S ADD : method dispose
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
self.visible = false
super
end
def update
@character = $BlizzABS.autotarget
if @character == nil
@loop_animation_id = 0
loop_animation(nil)
return
end
super
# stanley's add : if
if LiTTleDRAgo::TARGET_ANIMATION_ID == nil
self.visible = true
self.src_rect.x += 32 if Graphics.frame_count % 5 == 0
self.src_rect.x %= 128
self.src_rect.y = 0 # or 32 for blue one
if $BlizzABS.autotarget == nil
self.visible = false
else
self.x = @character.screen_x - 16
self.y = @character.screen_y - 23
self.z = @character.screen_z(0)
end
elsif @loop_animation_id == 0
@loop_animation_id = LiTTleDRAgo::TARGET_ANIMATION_ID
loop_animation($data_animations[@loop_animation_id])
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(0)
end
end
end
#==============================================================================
# Spriteset_Map
#==============================================================================
class Spriteset_Map
alias init_autotarget_later initialize
def initialize
#Stanley's add : we check in the class Sprite_Targeter if it is set to nil
# if LiTTleDRAgo::TARGET_ANIMATION_ID != nil
@autotarget = Sprite_Targeter.new(@viewport1)
# end
$game_temp.target_cursor_sprite = @target_cursor_sprite
init_autotarget_later
end
alias update_autotarget_later update
def update
@autotarget.update if @autotarget != nil
update_autotarget_later
end
alias dispose_autotarget_later dispose
def dispose
if @autotarget != nil
@autotarget.dispose
@autotarget = nil
end
dispose_autotarget_later
end
end
Also I tried to see if it entered in the Sprite_Targeter "dispose" method when changing map, and yes. So I added this "visible = false" in the dispose method, but it doesn't changed anything :/
EDIT : Waiting for a better idea I made a global variable that I set to false to temporarily desactivate the cursor