• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Resource icon

Resource rainefallUtils 1.2

rainefall

riley
Expo Team
rainefall submitted a new resource:

rainefallUtils - Utility scripts by me, for me, maybe you too

Just a couple of my scripting utility functions

  • Bitmap.blur(power, [opacity]) and Bitmap.blur_fast(power, [opacity]) are functions for, well, blurring a bitmap. Bitmap.blur is not recommended for realtime use.
  • Sprite.create_outlined_sprite([width]) returns a sprite intended to sit below the sprite it is called on in order to display an outline. There is definitely a more efficient way of doing this but it is needed for...

Read more about this resource...
 

rainefall

riley
Expo Team
rainefall updated rainefallUtils with a new update entry:

Event Instantiation

Couple of additions, notably Rf.create_event, which allows you to instantiate events at runtime.

There's also a few changes you may want to take note of if you have been using rainefallUtils as a utility for your own scripts:
  • Kernel.lerp has been deprecated in favour of Math.lerp. It will be removed in the next version
  • Bitmap.blur has been renamed to Bitmap.blur_rf as to not conflict with the existing...

Read the rest of this update entry...
 

rainefall

riley
Expo Team
rainefall updated rainefallUtils with a new update entry:

Event Instantiation, pt 2

I've made a couple of changes/fixes regarding event instantiation across multiple maps. Notably, you can now specify a map id when creating an event. This update also fixes a bug where event objects are not deleted if the player is on a different map when Rf#delete_event is called, particularly important if you are using Volteson's Overworld Encounters.

Read the rest of this update entry...
 

lemiho19

Master Of Games
Member
Joined
Apr 23, 2023
Posts
16
Not that this will be relevant to anyone but me (im trying to get Voltseon's Multiplayer Solution in 18.2) but to get this script updated to 18.2 follow this guide

# Graphics functions
class Bitmap
# INEFFICIENT, NOT RECOMMENDED FOR REALTIME USE
def blur_rf(power, opacity = 128)
power.times do |i|
blur_fast(i, opacity / (i+1))
end
end

# SLIGHTLY LESS INEFICCIENT
def blur_fast(power, opacity = 128)
blt(power * 2, 0, self, self.rect, opacity )
blt(-power * 2, 0, self, self.rect, opacity)
blt(0, power * 2, self, self.rect, opacity)
blt(0, -power * 2, self, self.rect, opacity)
end
end

class Sprite
def create_outline_sprite(width = 2)
return if !self.bitmap
s = Sprite.new(self.viewport)
s.x = self.x - width
s.y = self.y - width
s.z = self.z
self.z += 1
s.ox = self.ox
s.oy = self.oy
s.tone.set(255,255,255)
s.bitmap = Bitmap.new(self.bitmap.width + width * 2, self.bitmap.height + width * 2)
3.times do |y|
3.times do |x|
next if y == 1 && y == x
s.bitmap.blt(x * width, y * width, self.bitmap, self.bitmap.rect)
end
end
return s
end
end

# Maths functions

module Math
def self.lerp(a, b, t)
return (1 - t) * a + t * b
end
end

# Map scroll locking
if RfSettings::ENABLE_MAP_LOCKING
class Game_Temp
attr_accessor :map_locked
end

class Game_Player
# Center player on-screen
def update_screen_position(last_real_x, last_real_y)
return if self.map.scrolling? || !(@moved_last_frame || @moved_this_frame) || $game_temp.map_locked
self.map.display_x = @real_x - SCREEN_CENTER_X
self.map.display_y = @real_y - SCREEN_CENTER_Y
end
end
end

# add characters to spriteset_map
class Spriteset_Map
def add_character(event)
@character_sprites.push(Sprite_Character.new(@@viewport1, event))
return @character_sprites[-1]
end

def delete_character(event)
@character_sprites.each_with_index do |e, i|
if e.character.id == event.id
e.dispose
@character_sprites.delete(e)
end
end
end
end

module Rf
def self.wait_for_move_route
loop do
Graphics.update
$scene.miniupdate

move_route_forcing = false

move_route_forcing = true if $game_player.move_route_forcing
$game_map.events.each_value do |event|
move_route_forcing = true if event.move_route_forcing
end
$game_temp.followers.each_follower do |event, follower|
move_route_forcing = true if event.move_route_forcing
end

break if !move_route_forcing
end
end

def self.create_event(map_id = -1)
# get the current map/specified map if applicable
map = $game_map
map = $map_factory.getMapNoAdd(map_id) if map_id > 0
# get a valid number to use as an event ID
new_id = map.events.length + 1
new_id -= 1 while map.events.key?(new_id)
# create new event
ev = RPG::Event.new(0,0)
ev.id = new_id
yield ev
# add event & event character sprite to map
map.events[ev.id] = Game_Event.new(map.map_id, ev, map) # logical event
begin
$scene.spriteset(map_id).add_character(map.events[ev.id]) if $scene.spriteset(map_id) # event sprite
rescue
Console.echo_li "Attempted to create event before map spriteset initialised..."
end
return {
:event => map.events[ev.id],
:map_id => map.map_id
}
end

def self.delete_event(ev)
$scene.spriteset(ev[:map_id]).delete_character(ev[:event])
$map_factory.getMapNoAdd(ev[:map_id]).events.delete(ev[:event].id)
end
end

Make the top of Game_Player look like this


class Game_Player < Game_Character
attr_accessor :bump_se
attr_accessor :charsetData
attr_accessor :encounter_count

# Define SCREEN_CENTER_X if not already defined
SCREEN_CENTER_X = ((SCREEN_WIDTH / 2) - (Game_Map::TILE_WIDTH / 2)) * Game_Map::X_SUBPIXELS unless defined?(SCREEN_CENTER_X)

# Define SCREEN_CENTER_Y if not already defined
SCREEN_CENTER_Y = ((SCREEN_HEIGHT / 2) - (Game_Map::TILE_HEIGHT / 2)) * Game_Map::Y_SUBPIXELS unless defined?(SCREEN_CENTER_Y)

and the last step is to move your Game_Map script to above Game_Player so that the map width and height are defined first

(I have not yet tested all functions but this will keep the script from erroring at startup and normal playing)

If I succeed in getting Voltseon's Multiplayer Solution I will have a post on that thread explaining how I did it but that is a lot less likely to happen...
 
Last edited:
Back
Top