Need help with a script error.

Previous animated battler script ended up not working so well, it was too good to be true. =/

Now i'm trying out this script by Rhyme but it gives me an error.

SNGsHWM.png


The error makes no sense to me at all. No other script i'm using involves cy, @pose, ss_size or @frame_size.  I even took it straight from the demo provided

I'm trying to use a 700x98 spritesheet, FrameSize set to [7,1]  Each frame is 100x98.

Here's the script. It originally supports Holders but I made edits so that only pose 0 (idle) is used.

Spoiler
#==============================================================================# ■ Animated Enemy Sprites# Merry Christmas and happy holidays!#==============================================================================# Notebox Tag:# Enemy: !Flip#==============================================================================# Spritesheet Data for referencing## 0. Idle# 1. Defend# 2. Weak# 3. Damaged# 4. Attack# 5. Item# 6. Skill# 7. Magic# 8. Advance (n/a)# 9. Retreat (n/a)# 10. Victory (n/a)# 11. Enter# 12. Dead# 13. Credits and/or etc (n/a)#==============================================================================# ~rhyme#==============================================================================module Animated_Enemy_Sprites Delay = 8 FrameSize = [7, 1] DefaultBlink = falseend#==============================================================================# ■ Game_Battler#==============================================================================class Game_Battler < Game_BattlerBase attr_accessor 😛ose #-------------------------------------------------------------------------- # ● Flip #-------------------------------------------------------------------------- def flip_sprite return false end #-------------------------------------------------------------------------- # ● Reset Pose #-------------------------------------------------------------------------- def reset_pose @pose = 0 #@pose = 2 if @hp < mhp / 4 #if @states != nil # @pose = 2 if @states.size > 0 #end #@pose = 1 if guard? #@pose = 12 if dead? end #-------------------------------------------------------------------------- # ● Use Item #-------------------------------------------------------------------------- alias use_item_ani use_item def use_item(item) if item.is_a?(RPG::Item) # @pose = 4 else if item.is_a?(RPG::Skill) if item.id == attack_skill_id # @pose = 4 elsif item.physical? # @pose = 6 elsif item.magical? # @pose = 7 end end end use_item_ani(item) end #-------------------------------------------------------------------------- # ● Perform Damage #-------------------------------------------------------------------------- alias perform_map_damage_effect_ani perform_map_damage_effect def perform_map_damage_effect perform_map_damage_effect_ani #@pose = 3 unless @guarding end #-------------------------------------------------------------------------- # ● Upon Damage #-------------------------------------------------------------------------- alias on_damage_ani on_damage def on_damage(value) #@pose = 3 unless @guarding on_damage_ani(value) endend#==============================================================================# ■ Game_Enemy#==============================================================================class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ● Flip #-------------------------------------------------------------------------- def flip_sprite return true if Scan::string($data_enemies[@enemy_id].note, "!Flip") return super endend#==============================================================================# ■ Sprite_Battler#==============================================================================class Sprite_Battler < Sprite_Base attr_accessor :battler #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- def initialize(viewport, battler = nil) super(viewport) @battler = battler @battler_visible = false @effect_type = nil @effect_duration = 0 @spritesheet = true @pose = 0 @counter = 0 @delay = Animated_Enemy_Sprites:😀elay @frame_size = Animated_Enemy_Sprites::FrameSize end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super if @battler @battler.reset_pose if @battler.pose == nil self.mirror = @battler.flip_sprite @use_sprite = @battler.use_sprite? if @spritesheet update_pose if @pose != 11 end if Graphics.frame_count % @delay == 0 @counter += 1 if @counter >= @frame_size[0] @counter = 0 if @pose == 11 update_pose else @battler.reset_pose end end end if @use_sprite update_bitmap update_origin update_position end setup_new_effect setup_new_animation update_effect else @effect_type = nil end self.opacity = 255 self.visible = true end #-------------------------------------------------------------------------- # ● Update bitmap #-------------------------------------------------------------------------- def update_bitmap if @spritesheet @spritesheet_bitmap = Cache.battler(@battler.battler_name + " Move", @battler.battler_hue) ss_size = [@spritesheet_bitmap.width, @spritesheet_bitmap.height] new_bitmap = Bitmap.new(ss_size[0] / @frame_size[0], ss_size[1] / @frame_size[1]) cx = @counter * (ss_size[0] / @frame_size[0]) cy = @pose * (ss_size[1] / @frame_size[1]) crop_rect = Rect.new(cx, cy, ss_size[0], ss_size[1]) new_bitmap.blt(0, 0, @spritesheet_bitmap, crop_rect) else new_bitmap = Cache.battler(@battler.battler_name, @battler.battler_hue) end if bitmap != new_bitmap self.bitmap = new_bitmap init_visibility end end #-------------------------------------------------------------------------- # ● Update Pose #-------------------------------------------------------------------------- def update_pose oldpose = @pose newpose = @battler.pose if newpose != oldpose @counter = 0 @pose = newpose end end #-------------------------------------------------------------------------- # ● Blink #-------------------------------------------------------------------------- def update_blink self.opacity = (@effect_duration % 10 < 5) ? 255 : 0 if Animated_Enemy_Sprites:😀efaultBlink endend#============================================================================# ▼ Scan#============================================================================module Scan #-------------------------------------------------------------------------- # ● Scan.string(object, string) #-------------------------------------------------------------------------- def self.string(object, string) if object[/#{Regexp.quote string}/] return true end return false endend
Original post for script
What ARE the edits you made?


Does it work if you remove your edits?
I tested your provided edited script, and line 170 on me shows self.opacity = 255... 

can you open up your script editor after the error and post a screenie of the resulting screen? it seems like it's on a line having a multiplication operation
My edits were just commenting out the lines that change @pose  from being anything but 0. (So that I assume the pose will always be 0 aka row #1)

Specifically lines 48-53 / 61 / 65 / 67 / 69 / 81 / 88

@adik, ......what? o_o  self.opacity = 255 is line 158
really (I think the === signs went to next lines as I used word)? then I'll just count from there

so it's this line?

cy = @pose * (ss_size[1] / @frame_size[1])

it seems like one of these values are returning a symbol which makes the operation invalid...

maybe try to use the console and put print lines before this to show the values of @pose, ss_size[1] and @frame_size[1]?
You can always Ctrl+F and search @pose
Thing is, there is no line involving an overwrite of the @pose variable to a symbol (not on Game_Battler, neither on Sprite_Battler). It actually never changes to anything else than zero (and this is caused by what I presume are your edits). So I assume this is caused by an incompatibility. Is there any other script that uses a pose property?

Salut,

Orochii Zouveleki
No other scripts involve @pose.

Edit! I fixed the issue. It was an oversight in my part. Now I just need to fix the collapse.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-a-script-error.18450/