I've been trying to install the lava surfing script from mej71 here. I believe it was written for Essentials v15, and I'm trying to adapt it for Essentials v17 to use in my game for this year's Jam.
It's been challenging because I'm new to scripting, there were several edits that needed to be made, and they weren't in all the same places outlined in mej71's tutorial. I do think I got it mostly working, but the base_surf sprite is not appearing.
It's difficult for me to know where the mistake is, since there's no error message, and the edited code is all over the place. But since the move seems to be working, and the problem appeares to be with the base_surf sprite, I thought perhaps it has something to do with the "Sprite_SurfBase" script section? See what I have below:
I've been working on this all day, and I'm quite frustrated. This is my first time editing a script and it seems I chose one of the more complex things to work on. I'm going to sleep now, I hope someone can point out an error or something. Maybe there's a script keyword I can search for using Ctrl + Shift + F that could point me in the right direction?
It's been challenging because I'm new to scripting, there were several edits that needed to be made, and they weren't in all the same places outlined in mej71's tutorial. I do think I got it mostly working, but the base_surf sprite is not appearing.
It's difficult for me to know where the mistake is, since there's no error message, and the edited code is all over the place. But since the move seems to be working, and the problem appeares to be with the base_surf sprite, I thought perhaps it has something to do with the "Sprite_SurfBase" script section? See what I have below:
Ruby:
class Sprite_SurfBase
attr_reader :visible
attr_accessor :event
def initialize(sprite,event,viewport=nil)
@rsprite = sprite
@sprite = nil
@event = event
@viewport = viewport
@disposed = false
@surfbitmap = AnimatedBitmap.new("Graphics/Characters/base_surf")
@lavasurfbitmap = AnimatedBitmap.new("Graphics/Characters/base_surf")
@divebitmap = AnimatedBitmap.new("Graphics/Characters/base_dive")
@cws = @surfbitmap.width/4
@chs = @surfbitmap.height/4
@cwl = @lavasurfbitmap.width/4
@chl = @lavasurfbitmap.height/4
@cwd = @divebitmap.width/4
@chd = @divebitmap.height/4
update
end
def dispose
if !@disposed
@sprite.dispose if @sprite
@sprite = nil
@surfbitmap.dispose
elsif @lavasurfbitmap.dispose
@disposed = true
end
end
def disposed?
@disposed
end
def visible=(value)
@visible = value
@sprite.visible = value if @sprite && !@sprite.disposed?
end
def update
return if disposed?
if !$PokemonGlobal.surfing && !$PokemonGlobal.diving
# Just-in-time disposal of sprite
if @sprite
@sprite.dispose
@sprite = nil
end
return
end
# Just-in-time creation of sprite
@sprite = Sprite.new(@viewport) if !@sprite
if @sprite
if $PokemonGlobal.surfing
@sprite.bitmap = @surfbitmap.bitmap; cw = @cws; ch = @chs
elsif $PokemonGlobal.lavasurfing
@sprite.bitmap = @lavasurfbitmap.bitmap; cw = @cwl; ch = @chl
elsif $PokemonGlobal.diving
@sprite.bitmap = @divebitmap.bitmap; cw = @cwd; ch = @chd
end
sx = @event.pattern_surf*cw
sy = ((@event.direction-2)/2)*ch
@sprite.src_rect.set(sx,sy,cw,ch)
if $PokemonTemp.surfJump
@sprite.x = ($PokemonTemp.surfJump[0]*Game_Map.realResX-@event.map.display_x+3)/4+(Game_Map::TILEWIDTH/2)
@sprite.y = ($PokemonTemp.surfJump[1]*Game_Map.realResY-@event.map.display_y+3)/4+(Game_Map::TILEHEIGHT/2)+16
else
@sprite.x = @rsprite.x
@sprite.y = @rsprite.y
end
@sprite.ox = cw/2
@sprite.oy = ch-16 # Assume base needs offsetting
@sprite.oy -= @event.bob_height
@sprite.z = @event.screen_z(ch)-1
@sprite.zoom_x = @rsprite.zoom_x
@sprite.zoom_y = @rsprite.zoom_y
@sprite.tone = @rsprite.tone
@sprite.color = @rsprite.color
@sprite.opacity = @rsprite.opacity
end
end
end
I've been working on this all day, and I'm quite frustrated. This is my first time editing a script and it seems I chose one of the more complex things to work on. I'm going to sleep now, I hope someone can point out an error or something. Maybe there's a script keyword I can search for using Ctrl + Shift + F that could point me in the right direction?
Last edited: