Hello There, Guest! Login Register


[ Script ] Map Traveling Support
#1
Star 
Greetings!

* Credit goes to Migno!

I had a custom pathfinding written a while ago and after seeing Migno's Unlimited Map Support Snippet I've instead decided to take development in another direction and create a Map Support script for the script creators community.

The script is intended to help you code easier, by removing the necessity of thousands of ifs and elseifs by replacing them with an algorithm that does the work for you. Basically, using a user-defined table containing the path your script needs to take, this Map Traveling Support is intended to move the player to any map inside your path table.

Usage
1. Create a path table, exactly like this:
t = {
  "Pokecenter Cinnabar",
  "Cinnabar Island",
  "Cinnabar mansion 1",
  "Cinnabar mansion 2",
  "Cinnabar mansion 3",
}
You can add, remove or edit any maps you need in order for your script to work.


2. Add the following at the beginning of your script, only after  (*) customization, if you have any.
require 'travelscript'

3. Use the "moveTo()" command in order to have the player travel to the defined destination.
Example:
moveTo("Pokecenter Cinnabar")


Customization
(*) All customization must be done before loading the module using require.
If you'd like to customize your usage of Map Traveling Support, the current features are:
  • Enabling/disabling logging ( logging = true/false ) - it is true by default
  • Compatibility variable setting - for example, in order to make the All-Catcher script by Redshkie compatible with my Map Traveling Support, I had to set some variables before implementing it. Here's an example:
    pokecenter = "Pokecenter Cinnabar"catchmap = "Cinnabar mansion 3"
Example
t = {
   "Pokecenter Cinnabar",
   "Cinnabar Island",
   "Cinnabar mansion 1",
   "Cinnabar mansion 2",
   "Cinnabar mansion 3",
}

pokecenter = "Pokecenter Cinnabar" -- This is a (*) Compatibility variable setting 
level_location = "Cinnabar mansion 3" -- This is a (*) Compatibility variable setting 
logging = true

require 'travelmodule'
(*) Compatibility variable setting have nothing to do with my Map Traveling Support Script.

function onPathAction()
if getUsablePokemonCount() >= 1
   if getMapName() != level_location then
       moveTo(level_location)
   elseif getMapName() == level_location then
       moveToGrass()
   end
else
   if getMapName() != pokecenter then
       moveTo(pokecenter)
   end
end
end

Download 
Github repository


To-Do List
  • Implement an Anti-Mod feature by recording cell changes
  • Create algorithm for routes with multiple destination points
  • Add support for path exceptions
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)