[RPGXP]Need someone to convert a script

Started by MetalZelda, October 20, 2013, 06:10:34 am

Previous topic - Next topic

MetalZelda

Hello everybody :)
I'm not very active in the forum and it's bad because of reasons xD
Well, technically, I'm switching my Zelda project from XAS ABS to BlizzABS and seems to be easy for the moment, but something is troubling me ...

I found in the Internet a script that allow map zooms, and which is really great for gameplay thing and cutscenes, and I badly want this script to work.
It is a script that only work this the fuc**** useless SDK, which is both XAS and Blizz incompatible.

Blizzard, you ungrateful nice sexy administrator, or someone else, please make some makers dream true ...

Please, can you make this shit to be a regular RPG Maker XP script instead of a non-working XAS & blizz SDK support

Script bellow :
=begin
==============================================================================
** Map_Zoom
------------------------------------------------------------------------------
Trebor777
Version 1.1
14/06/2007
------------------------------------------------------------------------------
* Description FR:

Ce script permet d'effectuer des zoom in et zoom out sur un point pr?cis de
la map.

* Description US:

This script allow you to zoom in or out on a specific map location.

------------------------------------------------------------------------------
* Instructions FR:

Placer le Script sous le SDK et au dessus de Main.
Utiliser 1 des 2 commandes dans un script ou un ?v?nement "appeler un script":
. $game_map.start_zoom(x,y,coef,spd)
. $scene.zoom(x,y,coef,spd) #avec $scene une instance de Scene_Map

x et y: Coordonn?es(pas en pixel) du point ? zoomer/d?zoomer
coef : Valeur du zoom ? atteindre de 0.1, ? l'infini
spd : Vitesse du zoom, la variation est bas?e sur le calcul suivant:
0.2*spd

* Instructions US:

Place The Script Below the SDK and Above Main.
Use 1 of this 2 command in a script or with the event command "Call a script":
. $game_map.start_zoom(x,y,coef,spd)
. $scene.zoom(x,y,coef,spd) #with $scene a Scene_Map instance

x & y: Target Location(not inpixel)to zoom in/out
coef : Zoom value to reach from 0.1, to infinite
spd : Zoom speed, the fluctuation is based on this formula: 0.2*spd

Version 1.1
Code adapted to the new tilemap class.
==============================================================================
=end
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Map_Zoom', 'Trebor777', 1.1, '14-06-2007')

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state('Map_Zoom') and SDK.state('Tilemap')

#==============================================================================
# ** Spriteset_Map
#==============================================================================
class Spriteset_Map
def update_character_sprites
# Update character sprites
for sprite in @character_sprites
sprite.zoom_x=$game_map.tilemap_settings.zoom_x
sprite.zoom_y=$game_map.tilemap_settings.zoom_y
sprite.update
end
end
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map
def zoom(x,y,coef,spd)
if !$game_map.zooming?
$game_map.start_zoom(x,y,coef,spd)
end
end
end
#==============================================================================
# ** Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
alias zoom_setup_scroll setup_scroll
def setup_scroll
setup_zoom
zoom_setup_scroll
end
#--------------------------------------------------------------------------
def setup_zoom
# Initialize scroll information
@zoom_rest = 0
@zoom_speed = 2
end
#--------------------------------------------------------------------------
# * Start Zoom
# focus : zoom value to reach
# speed : zoom speed
#--------------------------------------------------------------------------
def start_zoom(x,y,focus, speed)
@x_zoom=x
@y_zoom=y
@zoom_rest = (focus-@tilemap_settings.zoom_x).abs
@zoom_speed = speed*((focus-@tilemap_settings.zoom_x)/@zoom_rest)
end
#--------------------------------------------------------------------------
# * Determine if Scrolling
#--------------------------------------------------------------------------
def zooming?
return @zoom_rest > 0
end
#--------------------------------------------------------------------------
alias zoom_update_scrolling update_scrolling
def update_scrolling
update_zooming
zoom_update_scrolling
end
#--------------------------------------------------------------------------
def update_zooming
# If zooming
if @zoom_rest > 0
# Change from zoom speed to focus in map coordinates
focus = 0.2 * @zoom_speed
# Execute zooming
@tilemap_settings.zoom_x =focus
@tilemap_settings.zoom_y =focus
# Subtract focus zoomed
@zoom_rest -= focus.abs
$game_player.center(@x_zoom,@y_zoom)
end
end
#--------------------------------------------------------------------------
# * Scroll Down
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_down(distance)
@display_y = [@display_y distance, (self.height*@tilemap_settings.zoom_y - 15) * 128/tilemap_settings.zoom_y].min
end
#--------------------------------------------------------------------------
# * Scroll Left
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_left(distance)
@display_x = [@display_x - distance, 0].max
end
#--------------------------------------------------------------------------
# * Scroll Right
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_right(distance)
@display_x = [@display_x distance, (self.width*@tilemap_settings.zoom_x - 20) * 128/tilemap_settings.zoom_x].min
end
#--------------------------------------------------------------------------
# * Scroll Up
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_up(distance)
@display_y = [@display_y - distance, 0].max
end
end
#==============================================================================
# ** Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Get Screen X-Coordinates
#--------------------------------------------------------------------------
def screen_x
# Get screen coordinates from real coordinates and map display position
#return (@real_x) / 4 # 16
return (@real_x - $game_map.display_x 3*$game_map.tilemap_settings.zoom_x) / 4*$game_map.tilemap_settings.zoom_x 16*$game_map.tilemap_settings.zoom_x
end
#--------------------------------------------------------------------------
# * Get Screen Y-Coordinates
#--------------------------------------------------------------------------
def screen_y
# Get screen coordinates from real coordinates and map display position
y = (@real_y - $game_map.display_y 3*$game_map.tilemap_settings.zoom_y) / 4*$game_map.tilemap_settings.zoom_y 32*$game_map.tilemap_settings.zoom_y
# Make y-coordinate smaller via jump count
if @jump_count >= @jump_peak
n = @jump_count - @jump_peak
else
n = @jump_peak - @jump_count
end
return y - (@jump_peak * @jump_peak - n * n) / 2
end
#--------------------------------------------------------------------------
# * Get Screen Z-Coordinates
#--------------------------------------------------------------------------
def screen_z(height = 0)
# If display flag on closest surface is ON
if @always_on_top
# 999, unconditional
return 999
end
# Get screen coordinates from real coordinates and map display position
z = (@real_y - $game_map.display_y 3*$game_map.tilemap_settings.zoom_y) / 4*$game_map.tilemap_settings.zoom_y 32*$game_map.tilemap_settings.zoom_y
# If tile
if @tile_id > 0
# Add tile priority * 32
return z $game_map.priorities[@tile_id] * 32*$game_map.tilemap_settings.zoom_y
# If character
else
# If height exceeds 32, then add 31
return z ((height > 32) ? 31 : 0)
end
end
end
#==============================================================================
# ** Game_Player
#==============================================================================
class Game_Player < Game_Character
@center_x= CENTER_X # Center screen x-coordinate * 4
@center_y = CENTER_Y # Center screen y-coordinate * 4
#--------------------------------------------------------------------------
# * Scroll Down
#--------------------------------------------------------------------------
def update_scroll_down(last_real_y)
# If character moves down and is positioned lower than the center
# of the screen
if @real_y > last_real_y and @real_y - $game_map.display_y > @center_y
# Scroll map down
$game_map.scroll_down(@real_y - last_real_y)
end
end
#--------------------------------------------------------------------------
# * Scroll Left
#--------------------------------------------------------------------------
def update_scroll_left(last_real_x)
# If character moves left and is positioned more let on-screen than
# center
if @real_x < last_real_x and @real_x - $game_map.display_x < @center_x
# Scroll map left
$game_map.scroll_left(last_real_x - @real_x)
end
end
#--------------------------------------------------------------------------
# * Scroll Right
#--------------------------------------------------------------------------
def update_scroll_right(last_real_x)
# If character moves right and is positioned more right on-screen than
# center
if @real_x > last_real_x and @real_x - $game_map.display_x > @center_x
# Scroll map right
$game_map.scroll_right(@real_x - last_real_x)
end
end
#--------------------------------------------------------------------------
# * Scroll Up
#--------------------------------------------------------------------------
def update_scroll_up(last_real_y)
# If character moves up and is positioned higher than the center
# of the screen
if @real_y < last_real_y and @real_y - $game_map.display_y < @center_y
# Scroll map up
$game_map.scroll_up(last_real_y - @real_y)
end
end
#--------------------------------------------------------------------------
# * Set Map Display Position to Center of Screen
#--------------------------------------------------------------------------
def center(x, y)
@center_x= (320/$game_map.tilemap_settings.zoom_x - 16) * 4 # Center screen x-coordinate * 4
@center_y = (240/$game_map.tilemap_settings.zoom_y - 16) * 4 # Center screen y-coordinate * 4
max_x = ($game_map.width*$game_map.tilemap_settings.zoom_x - 20) * 128/$game_map.tilemap_settings.zoom_x
max_y = ($game_map.height*$game_map.tilemap_settings.zoom_y - 15) * 128/$game_map.tilemap_settings.zoom_y
$game_map.display_x = ([0, [x * 128 - @center_x, max_x].min].max)
$game_map.display_y = ([0, [y * 128 - @center_y, max_y].min].max)
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end


Thanks, in advance

Heretic86

Do you have a working demo?  I'll need access to to the other scripts its dependant on before I can fully yank out the SDK Dependancy.  Other info I've found points to SDK Tilemap Class that Im not having any luck with.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Memor-X

hang on, i think i've seen this script, i remember a Map Zoom Script that i wanted to use in Nexis Core because it could improve some of the scenes where there was a number of small rooms in one map and being zoomed in would allow me to cut characters out of the scene quicker, if it's the same script then it's this dam script's SDK dependency which has slowed Nexis Core's development right down, reason why i'm holding off doing any mapping until either ARCed comes out with it's own Map Zoom Event Command, i find a script like it which doesn't need the SDK or i give up

i'll jump onto C.C tonight and look up the script i have in my "SDK Virus Archive" to see if it's the same one, if it is i'll post up a demo unless someone beats me too it

LiTTleDRAgo

King's Tilemap (edited) : _http://pastebin.com/raw.php?i=183DGStA
Trebor777's Map Zoom (edited) : _http://pastebin.com/raw.php?i=cgQFzCf3

Note that it's a normal version, it's not compatible with BABS since BABS overwrite Game_Player class
but I think it's compatible with XAS

I didn't hold BABS right now so I'm not sure where is the method in Blizz ABS that handles Player

MetalZelda

October 21, 2013, 05:47:10 am #4 Last Edit: October 21, 2013, 06:03:14 am by MetalZelda
Quote from: Heretic86 on October 20, 2013, 06:17:40 pm
Do you have a working demo?  I'll need access to to the other scripts its dependant on before I can fully yank out the SDK Dependancy.  Other info I've found points to SDK Tilemap Class that Im not having any luck with.


Thankfully, I have a demo of this script that was floating around in my hard drive.
http://www.mediafire.com/?v4646y9r60vz4oo

Quote from: LiTTleDRAgo on October 21, 2013, 03:25:06 am
King's Tilemap (edited) : _http://pastebin.com/raw.php?i=183DGStA
Trebor777's Map Zoom (edited) : _http://pastebin.com/raw.php?i=cgQFzCf3

Note that it's a normal version, it's not compatible with BABS since BABS overwrite Game_Player class
but I think it's compatible with XAS

I didn't hold BABS right now so I'm not sure where is the method in Blizz ABS that handles Player


I would test it now ^^, and I'll send feedbacks :) thanks Drago

Feedbacks

It works with XAS, but it's very glitchy, when you call the zoom syntax within the script call, the map just goes insane and duplicate event and there's no tiles anymore and have major slowdown (with zoom, the game run around 3 FPS) ...



And also, the maps are static ... The hero can move but the map don't scroll eigher (I'm serious, that's not a random event position, the event scroll but not the map (See the minimap))



And, if I attempt to teleport to another room, there's a nice message, maybe related to the Tilemap script that is confusing the default XAS script. (See pictore bellow)



Otherwise, that was a nice try, it proove that it works, but need more heavily information ... If someone can handle that, I wouldn't be able to handle that kind of script :/
Thanks in advance

LiTTleDRAgo

if that line is pointing to sprite.bitmap = nil or something with bitmap = nil, delete that line
or try this XAS version : http://littledrago.blogspot.com/2013/05/rgss-xas-391-ally-system-v112.html

btw, because it seems impossible to recreate the zoom animation, I simplified the script, you can redownload both the script in previous links

$game_map.zoom(x,y,zoom)

MetalZelda

Quote from: LiTTleDRAgo on October 21, 2013, 07:59:50 am
if that line is pointing to sprite.bitmap = nil or something with bitmap = nil, delete that line
or try this XAS version : http://littledrago.blogspot.com/2013/05/rgss-xas-391-ally-system-v112.html

btw, because it seems impossible to recreate the zoom animation, I simplified the script, you can redownload both the script in previous links

$game_map.zoom(x,y,zoom)


Yay it works ! but the character isn't zoomed x(
Nah, the zooming animation can be done with event things I guess, with wait and zoom ratio, it can be enough ^^.

LiTTleDRAgo

probably compatibility problem with your other scripts,
can you tell me your scripts order in your script editor?

try to delete or comment out this part of the script

Spoiler: ShowHide

#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display the character.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Character
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  $@ || alias_method(:zoom_update_scrolling, :update)
  #--------------------------------------------------------------------------
  # * Aliased method: update
  #--------------------------------------------------------------------------
  def update(*args)
    zoom_update_scrolling(*args)
    # Update character sprites
    self.zoom_x = $game_map.zoom_x
    self.zoom_y = $game_map.zoom_y
  end
end


and then copy this into right above the main

Spoiler: ShowHide

#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display the character.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Character
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  $@ || alias_method(:zoom_update_scrolling, :update)
  #--------------------------------------------------------------------------
  # * Aliased method: update
  #--------------------------------------------------------------------------
  def update(*args)
    zoom_update_scrolling(*args)
    # Update character sprites
    self.zoom_x *= $game_map.zoom_x
    self.zoom_y *= $game_map.zoom_y
  end
end

MetalZelda

Quote from: LiTTleDRAgo on October 21, 2013, 09:52:45 am
probably compatibility problem with your other scripts,
can you tell me your scripts order in your script editor?

try to delete or comment out this part of the script

Spoiler: ShowHide

#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display the character.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Character
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  $@ || alias_method(:zoom_update_scrolling, :update)
  #--------------------------------------------------------------------------
  # * Aliased method: update
  #--------------------------------------------------------------------------
  def update(*args)
    zoom_update_scrolling(*args)
    # Update character sprites
    self.zoom_x = $game_map.zoom_x
    self.zoom_y = $game_map.zoom_y
  end
end


and then copy this into right above the main

Spoiler: ShowHide

#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display the character.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Character
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  $@ || alias_method(:zoom_update_scrolling, :update)
  #--------------------------------------------------------------------------
  # * Aliased method: update
  #--------------------------------------------------------------------------
  def update(*args)
    zoom_update_scrolling(*args)
    # Update character sprites
    self.zoom_x *= $game_map.zoom_x
    self.zoom_y *= $game_map.zoom_y
  end
end



I tested your XAS 3.91 and it works, I use the same version but mine have a tons of add-ons to be a Zelda engine. So, it is something relating to my configs, itherwise, your script works fine :)
It NEED to be added in the script database ^^
Thanks Drago :)