A Simple merge request [MAPLINKS + BABS]

Started by Makasu, September 14, 2009, 11:18:21 pm

Previous topic - Next topic

Makasu

Howdy!

I'd like to request a simple merge of Wachunga's Maplinks script to be compatible with BABS v 2.x

I read on an rrr post that there was a merge done by Blizz himself. But somehow I don't know if its the same or if some alias' have changed or whatever the case may be.

Now according to the post that I read located here

All I need to change is the class Game_Player from:

class Game_Player

alias ml_cett check_event_trigger_touch
def check_event_trigger_touch(x, y)
check_maplinks(x,y)
ml_cett(x,y)
end

def check_maplinks(x,y)
if $game_map.valid?(x, y) then return end
dir = nil
if y == $game_map.height then dir = 2
elsif x == -1 then dir = 4
elsif x == $game_map.width then dir = 6
elsif y == -1 then dir = 8
end
if dir != nil
if $game_map.maplinks[dir] != nil
$game_map.maplinks[dir].activate
end
end
end

end


to:

class BlizzABS::Player_Controller

  alias ml_cett check_event_trigger_touch
  def check_event_trigger_touch(x, y)
    check_maplinks(x,y)
    ml_cett(x,y)
  end

  def check_maplinks(x,y)
    return if $game_map.valid?(x, y)
    if y == $game_map.height
      dir = 2
    elsif x == -1
      dir = 4
    elsif x == $game_map.width
      dir = 6
    elsif y == -1
      dir = 8
    else
      dir = nil
    end
    if dir != nil && $game_map.maplinks[dir] != nil
      $game_map.maplinks[dir].activate
    end
  end
 
end


But upon doing so I run into the error that reads:

Code: error
Script 'Maplinks' Line 125: NameError occured.
undefined method 'check_event_trigger_touch' for class BlizzABS::Player_Controller'


I have the maplinks script if it'll make the slight merge or the update of Blizz's other post easier?

Spoiler: ShowHide
Code: Maplinks
=begin
============
Maplinks - version 0.95 (2005-11-10)
============
by Wachunga

This script simplifies linking maps together: a single event sets up an
entire edge of the map as a teleport to another map. Players trying to
leave that edge of the current map are automatically teleported.

(This can also be achieved with many copies of teleport events along the edges
of a map or with a parallel-process event that sets variables and uses them to
teleport, but these methods are not optimal -- causing lag and/or inconvenience
for the mapper.)

To link a map with another on a specific edge (north, east, south or west),
create an event with <maplink> included in its name on the appropriate edge of
the map. (To avoid confusion, maplink events on corners of the map are
not valid.) Then, add a teleport ("Transfer Player") command to the event
to specify the destination map and other details (e.g. player direction,
fading on/off). If the destination is an east or west edge, then the Y
coordinate is calculated based on the player's Y coordinate when
teleporting; likewise, the X coordinate is calculated automatically when
the destination is a north or south edge.

Note: unlike normal teleport events, maplinks are activated when the player
tries to leave the screen instead of when stepping on the last tile. This
behaviour could be changed, but I feel that it's more natural this way:
it leaves the whole map open for actual exploration, instead of "wasting"
the outer tiles of a map.

=end

#-------------------------------------------------------------------------------

class Game_Event < Game_Character
alias ml_ge_init initialize
def initialize(map_id, event)
ml_ge_init(map_id, event)
if @event.name.upcase.include?('<MAPLINK>')
dir = nil
if @event.y == $game_map.height-1
dir = 2 unless @event.x == 0 or @event.x == $game_map.width-1
elsif @event.x == 0
dir = 4 unless @event.y == 0 or @event.y == $game_map.height-1
elsif @event.x == $game_map.width-1
dir = 6 unless @event.y == 0 or @event.y == $game_map.height-1
elsif @event.y == 0
dir = 8 unless @event.x == 0 or @event.x == $game_map.width-1
end
if dir != nil
@list.each { |command|
if command.code == 201
# make sure new location isn't be specified by variables
if command.parameters[0] == 0
$game_map.maplinks[dir] = Maplink.new(command.parameters)
break
end
end
}
end
end
end
end

#-------------------------------------------------------------------------------

class Game_Map
attr_accessor :maplinks

alias ml_gm_setup setup
def setup(map_id)
@maplinks = {}
ml_gm_setup(map_id)
end

def width(map_id = @map_id)
if map_id == @map_id
return @map.width
else
return load_data(sprintf("Data/Map%03d.rxdata", map_id)).width
end
end

def height(map_id = @map_id)
if map_id == @map_id
return @map.height
else
return load_data(sprintf("Data/Map%03d.rxdata", map_id)).height
end
end

end

#-------------------------------------------------------------------------------

class Maplink

def initialize(parameters)
@param = parameters
end

def activate
width = $game_map.width(@param[1])
height = $game_map.height(@param[1])
# modify x (p[2]) or y (p[3]) coordinates appropriately
if @param[2] == 0 or @param[2] == width-1
@param[3] = $game_player.y
elsif @param[3] == 0 or @param[3] == height-1
@param[2] = $game_player.x
end
# set up a dummy interpreter just for teleport
interpreter = Interpreter.new
interpreter.parameters = @param
interpreter.index = 0
interpreter.command_201
end

end

#-------------------------------------------------------------------------------

class Game_Player

alias ml_cett check_event_trigger_touch
def check_event_trigger_touch(x, y)
check_maplinks(x,y)
ml_cett(x,y)
end

def check_maplinks(x,y)
if $game_map.valid?(x, y) then return end
dir = nil
if y == $game_map.height then dir = 2
elsif x == -1 then dir = 4
elsif x == $game_map.width then dir = 6
elsif y == -1 then dir = 8
end
if dir != nil
if $game_map.maplinks[dir] != nil
$game_map.maplinks[dir].activate
end
end
end

end

#-------------------------------------------------------------------------------

class Interpreter
attr_accessor :parameters
attr_accessor :index
end


Its not that its majorly important. Its for simple recreation purposes and for some odd reason in BABS 2.57 whenever I have a lot of teleport events it causes the game to lag like crazy. :/

So any help or assistance is greatly appreciated. And will not go unnoticed. I'm willing to trade art in exchange for help. :)

Thank you in advance.
Dead on Arrival is the name of my project. Topic thread coming sooner or later.

Me on deviantart.com
My talents: ShowHide

  • Spriting
  • drawing
  • html coding
  • website design
  • skating
             PM now for a personal quote!
[[Will draw character art for you for $$$ or scripts!]]




Blizzard

BlizzABS::Player_Controller is does not exist since a specific version (probably 1.8x, 1.9x or 2.0x). It's BlizzABS::Controller you probably need to put there.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Makasu

September 15, 2009, 01:45:09 pm #2 Last Edit: September 15, 2009, 02:08:05 pm by Makasu
Quote from: Blizzard on September 15, 2009, 04:36:35 am
BlizzABS::Player_Controller is does not exist since a specific version (probably 1.8x, 1.9x or 2.0x). It's BlizzABS::Controller you probably need to put there.


Thank you but that didn't do anything. The error isn't there anymore but I think its disabled maplinks altogether?

EDIT:

I've uploaded a demo using a new[er] version of Maplinks in case someone wants to mess around with it and possible make it work with BABS

Download here!
Dead on Arrival is the name of my project. Topic thread coming sooner or later.

Me on deviantart.com
My talents: ShowHide

  • Spriting
  • drawing
  • html coding
  • website design
  • skating
             PM now for a personal quote!
[[Will draw character art for you for $$$ or scripts!]]




Blizzard

You probably need to add this line below the script.
$BlizzABS = BlizzABS::Processor.new

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Makasu

Now in a new script or at the very bottom of the script? like where those extra two attr's are?
Dead on Arrival is the name of my project. Topic thread coming sooner or later.

Me on deviantart.com
My talents: ShowHide

  • Spriting
  • drawing
  • html coding
  • website design
  • skating
             PM now for a personal quote!
[[Will draw character art for you for $$$ or scripts!]]




Aqua

You could add it in a new script at the very bottom so that you only need it once :P

Makasu

But see I'm still confused. If I add it to a new script it does nothing and if I add it to the end of maplinks v1 it gives me the error

Script 'Maplink' line 145 SyntaxError occured


which takes me to:

$game_map.maplinks[dir].activate]


I don't know whats causing it. I'm guessing maplink isn't really compatiable with BABS. Which sucks because like I said putting down a whole bunch of blank teleport events causes me to experience MAAAADDD lag. :(
Dead on Arrival is the name of my project. Topic thread coming sooner or later.

Me on deviantart.com
My talents: ShowHide

  • Spriting
  • drawing
  • html coding
  • website design
  • skating
             PM now for a personal quote!
[[Will draw character art for you for $$$ or scripts!]]




Aqua

There's an extra ] at the end of $game_map.maplinks[dir].activate

Makasu

September 15, 2009, 09:16:16 pm #8 Last Edit: September 15, 2009, 09:17:55 pm by Makasu
I probably typed it wrong. Lemme see though.

EDIT: Okay well the error is gone but still no teleporting.  :???:
Dead on Arrival is the name of my project. Topic thread coming sooner or later.

Me on deviantart.com
My talents: ShowHide

  • Spriting
  • drawing
  • html coding
  • website design
  • skating
             PM now for a personal quote!
[[Will draw character art for you for $$$ or scripts!]]




Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Makasu

Yeah. That'd probably be best. Because I can't seem to get it to work. And I've tried it without BABS and it works fine but with BABS in it just disables it.
Dead on Arrival is the name of my project. Topic thread coming sooner or later.

Me on deviantart.com
My talents: ShowHide

  • Spriting
  • drawing
  • html coding
  • website design
  • skating
             PM now for a personal quote!
[[Will draw character art for you for $$$ or scripts!]]




Blizzard

The problem is I don't really have time to. ._.; Maybe Aqua can help you.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Aqua

I don't have much time either...
Homework is sooo mean ;___;

Makasu

:( me and homework have never gotten along. And once again homework screws me over! Well its not a major thing hindering my progress like I said. Its more of a matter of convenience than anything. Placing one teleport event for a whole lets say 12 ain't half bad.
Dead on Arrival is the name of my project. Topic thread coming sooner or later.

Me on deviantart.com
My talents: ShowHide

  • Spriting
  • drawing
  • html coding
  • website design
  • skating
             PM now for a personal quote!
[[Will draw character art for you for $$$ or scripts!]]