[XP/VX] Ability Grid

Ability Grid

I've decided to create an ability grid.  I got the inspiration from Final Fantasy X's Sphere Grid by Square Enix, so I feel I should credit them.  This is made almost completely with events.  The only things that require scripts are optional.

Demos/Resources:
Ability Grid (XP)
Ability Grid (VX)

Instructions:
This requires a little work on your part, but it is completely customizable to your liking.

1. Export TileE from the resource manager in the demo, then import it to the game you want to use it in.  These tiles are essential to using the system, but can be replaced by your own or other graphics if you so desire.

2. Create a variable to be used as the party's AP.

3. Create maps for each character's ability grid, like you'll see I did in the demo.  I used a parallax for the background.

4. Arrange the tiles based on how you want each character to advance.  I added the tiles as graphics, but you can put them in the events if you want.  For RMXP, you must make one of the invisible tiles unpassable and encircle the ability grid with it in the third layer to prevent the player from being able to walk anywhere.

5. Create a single tile event.  You can follow my outline, or you can edit it however you'd like.

6. Copy that tile and paste it on one of each kind of tile.  Then, edit those tiles for their respective advancements and copy and paste them to each of their similar tiles.  This is much easier than creating each event individually.

7. Don't forget to include a way out of the grid!  You can use whatever you want to teleport you out.  I used a magic circle since that was easiest.

8. Create an event that teleports the characters to their respective grids.

Optionals:
Ability Crystal - this item increases the AP of the party by a certain amount.
________________________________________

Grid Key - this will unlock the locks on an ability grid.
________________________________________

Increase Party AP with Each Level Gained - this small script increases a variable each time a character levels up.

XP:
Go to Game_Actor in the script editor and find line 462 (@level += 1).  Create a new line below this by clicking on the end of line 462 and pressing Enter.  Paste this script into the new line:
$game_variables[id] += value
Expand to see the code.

Change "id" to whatever the id of the variable is and change "value" to the amount you want to increase it by with each level.

VX:
Go to Game_Actor in the script editor and find line 525 (level_up).  Create a new line below this by clicking on the end of line 525 and pressing Enter.  Paste this script into the new line:
$game_variables[id] += value
Expand to see the code.

Change "id" to whatever the id of the variable is and change "value" to the amount you want to increase it by with each level.
________________________________________

Increase Individual AP with Each Level Gained - this script increases AP for individual party members each time they level up.  No work is required to change this, but you must be aware that the variable that is used for a character's AP corresponds to their ID in the database.  EX: If Ralph (ID: 001) levels up by 1, Variable 001 will increase by 1.

XP:
Insert in a new section above main.
class Game_Actor

  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    # Level up
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      # increment the corresponding game variable
      $game_variables[@actor_id] += 1
      # Learn skill
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
    # Level down
    while @exp < @exp_list[@level]
      @level -= 1
    end
    # Correction if exceeding current max HP and max SP
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
end
Expand to see the code.


VX:
Insert in a new section above (Insert here) under materials.
class Game_Actor
  def level_up
    @level += 1
    # increment the corresponding game variable
    $game_variables[@actor_id] += 1
    for learning in self.class.learnings
      learn_skill(learning.skill_id) if learning.level == @level
    end
  end
end
Expand to see the code.

________________________________________

HUD - This script works in both XP and VX.  It will display the variable used for a character in their ability grid.  In XP, place this in a new section above Main.  In VX, place it in a new section under (Insert here) in the Materials category.  Just replace the Map IDs (top and bottom of script) and the Variable IDs (top of script).

HUD Script Show
#==============================================================================
# ** Window_AP
#------------------------------------------------------------------------------
#  This class creates the window and writes the current "AP".
#  You can customize all the "Grid.." ID's and "Variable.." variables
#  so they suit you. here are some instructions:
#
#  Grid_One   - The ID of the first Ability Grid.
#  Grid_Two   - The ID of the second Ability Grid.
#  Grid_Three - The ID of the third Ability Grid.
#  Grid_Four  - The ID of the fourth Ability Grid.
#
#  Set all the "Grid.." variables to the ID's of your four Ability Grid map's.
# 
#
#  VariableOne   - The id of the variable for "Grid_One".
#  VariableTwo   - The id of the variable for "Grid_Two".
#  VariableThree - The id of the variable for "Grid_Three".
#  VariableFour  - The id of the variable for "Grid_Four".
#
#  Example: When the player is on the "Grid_One"'s map ID, it will show the
#           "VariableOne"'s value, and when the player is on "Grid_Two"'s
#           map ID, it will show the "VariableTwo"'s value.
#
#==============================================================================
class Window_AP < Window_Base
  # The map ID's of the Ability Grids.
  Grid_One = 1
  Grid_Two = 4
  Grid_Three = 0
  Grid_Four = 0
 
  VariableOne = 1
  VariableTwo = 4
  VariableThree = 0
  VariableFour = 0
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  # Self.opacity - This is the opacity of the window, you can change this
  #                to whatever you want between 0-255.
  #                0 = Fully transparent
  #                255 = opaque                            
  #
  # Self.visible - This will make the window invisible as default.
  #                So that the HUD won't show on every map.
  #              
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 200, 70)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 150
    self.visible = false
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  #  This will display the "Current AP:" text, and the variables of the
  #  Party members based on which map the player is on.
  #  You can change the "Current AP" text to whatever you want,
  #  but the rest you should keep as it is.
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    reset_variables
    self.contents.draw_text(0, 0, 100, 32, "Current AP:", 0)
  if $game_map.map_id == Grid_One
    self.contents.draw_text(120, 0, 32, 32, @variableone.to_s, 0)
  else if $game_map.map_id == Grid_Two
    self.contents.draw_text(120, 0, 32, 32, @variabletwo.to_s, 0)
  else if $game_map.map_id == Grid_Three
    self.contents.draw_text(120, 0, 32, 32, @variablethree.to_s, 0)
  else if $game_map.map_id == Grid_Four
    self.contents.draw_text(120, 0, 32, 32, @variablefour.to_s, 0)
  end
  end
  end
  end
  end
  def reset_variables
   @variableone = $game_variables[VariableOne]
   @variabletwo = $game_variables[VariableTwo]
   @variablethree = $game_variables[VariableThree]
   @variablefour = $game_variables[VariableFour]
  end
  def update
    super
    refresh if (@variableone = $game_variables[VariableOne] or
                @variabletwo = $game_variables[VariableTwo] or
                @variablethree = $game_variables[VariableThree] or
                @variablefour = $game_variables[VariableFour])
  end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This will add the HUD in Scene_Map.
#
#  Grid_One   - The ID of the first Ability Grid.
#  Grid_Two   - The ID of the second Ability Grid.
#  Grid_Three - The ID of the third Ability Grid.
#  Grid_Four  - The ID of the fourth Ability Grid.
#
#  NOTE: the numbers in these variables "Grid_One", "Grid_Two", etc.
#        Should be the same as the ones in the beginning of this script.
#
#
#  This will make the HUD visible whenever the player is in any of the four
#  "Grid.." map ID's.
#
#==============================================================================
class Scene_Map
  # The map ID's of the Ability Grids.
  Grid_One = 1
  Grid_Two = 4
  Grid_Three = 0
  Grid_Four = 0
  alias yourhud_main main
  alias yourhud_update update
  def main
    @yourhud = Window_AP.new
    yourhud_main
    @yourhud.dispose
  end
  def update
    if ($game_map.map_id == Grid_One or
        $game_map.map_id == Grid_Two or
        $game_map.map_id == Grid_Three or
        $game_map.map_id == Grid_Four)
      @yourhud.visible = true
    else
      @yourhud.visible = false     
    end
    @yourhud.update
    yourhud_update
  end
end
Expand to see the code.

________________________________________

Ability Grid access through menu (VX only) - Dargor has generously agreed to help me create this script, but I'm not going to post it here because of its length.  You can find it in the demo, though.
________________________________________

Ability Grid appears in menu after a switch is turned on - In Dargor's script, named Ability Grid in the demo, search for the method "create_command_window" and replace that whole method with this:
def create_command_window
    commands = $game_system.menu_commands
  if $game_switches[1] == true
    $game_system.add_menu_command(commands.size-1, Vocab::AbilityGrid)
  end
    dargor_vx_ag_menu_create_command_window
  end
Expand to see the code.


Just change the number in "$game_switches[1]" to the ID of the switch that you wish to have activate the ability grid menu command.

Notes:
*You can replace the ability grid with teachers that would increase a character's stats and give them abilities.

Credit:
Please give credit to the following people:
Marpy for helping me with obtaining scripts and giving me some very good suggestions.
Gando for creating the Increase Party AP with Each Level Gained script, the Variable HUDs, and the script edit that allows access to the Ability Grid through the menu after a switch is turned on.
Brewmeister for creating the Increase Individual AP with Each Level Gained script.
Dargor for creating the menu script.
Me for creating the events and tileset.
(If I forgot anyone, please PM me so I can add you to the list.)

If you have any questions, comments, or problems, feel free to PM me or post in this thread.
A new option has been added which allows each character to have separate AP, which will increase when the corresponding character levels up.  All credit for this script should go to Brewmeister.
I have came up how to make FF12 License Board out of this tutorial. The map have to be 24X24.

Anyway thx for the tutorial
I've finally gotten around to creating an XP demo, and I updated the VX demo so it now contains the ability grid option in the menu.  Please keep in mind that you need Dargor's Custom Commands script to use the Ability Grid script he created.  The only problem that has arisen is that the player is transferred before the map reappears after leaving the ability grid, which means the player can walk a step before the menu pops up.  We're working on this, and I'll post the update when it's fixed.  I won't include the ability grid menu script in this post since it's long and would take up a lot of room.  It shouldn't take too long to download the demo and get it from that.  Just make sure you credit Dargor for this! :thumb:
Hi there, first of all i have to say great system! I was looking for something like this since i love the ability grid in FFX. Thanks! :thumb:
But here's a problem (This will probably be very easy to solve but i don't know anything about scripting in RPG-maker)
In my project the hero will start out as a student and about 10 minutes into the game he will achieve his powers and change class. This means that i don't want the Ability Grid to be showable unless a special switch is on.
Could you please help me?
Well, you have two options.  You can either disable the menu access until you want him to be able to access the ability grid, or I try and get a script to make it appear after a switch is turned on.  If you want the second one, it may take a little while for me to get it.
I would like the second one if not too much trouble 🙂 i've got plenty of time for that btw, no rush.
You can be ensured to see your name amongst my credits :thumb:
You guys are talking about the Dargor's menu script right?
I mean, you want to make it so the Ability Grid access from the menu is only available when a certain switch is on?

Well, if that is the case, in Dargor's script, (named "Ability Grid" in the demo),  search for the method "create_command_window" and replace that whole method with this:
  def create_command_window
    commands = $game_system.menu_commands
  if $game_switches[1] == true
    $game_system.add_menu_command(commands.size-1, Vocab::AbilityGrid)
  end
    dargor_vx_ag_menu_create_command_window
  end
Expand to see the code.


You can change the number in "$game_switches[1]" to the id of the switch that you wish to have.
Now, after 10 minutes in the game, you turn the switch on, and the Ability Grid choise will show up in the menu.
Hope that helps! :thumb:

Over and out - Gando
Wow, thanks again for your help!  I'll have to add this to the first post.
awesome tut....im using this in my game for sure

Thanks
Thanks alot guys. This really helped me out. 😀
Looks good. I like it! I might use this in my game...

By the way, your in your signature, when I click on "Ability Grid," it takes me to w ww.rmxp.borg/forums/index.php?topic=44564.0

You might want to change that!  :thumb:

Anyways, nice job!
When I copy and paste the script from the demo, I can't access my menu (in game) because of an error on line 168. It works fine UNTIL I take it out of the demo then I get an error message and the game closes.
You just need to go through the setup in the script and change the IDs for the maps and map IDs.

#==============================================================================
# ** Ability Grid Setup
#==============================================================================
module Ability_Grid
  # The Ability Grid map id
  # SYNTAX: actor_id => map_id
  Maps = {
          1 => 1
         }
  # The initial position on the Ability Grid map id
  # SYNTAX: actor_id => [x,y]
  Position = {
              1 => [10,10]
             }
end
Expand to see the code.


You need to change the first set using the format Actor ID => Map ID and the second set with the format Actor ID => Map Coordinates.  If you change this to your own settings, it should work.
         
Alright thanks. I didn't think of that.
I love how you release all of your scripts for RMXP and RMVX.  :thumb: Most of the time I see a script I like, but it is only for XP. By the way, I also use your ability grid script, too! I will credit you and if/when I sell my game, which isn't likely, I will talk to you about any payment.

*EDIT1* Weird, anyone know how to fix my signature?
To fix your sig: change URL=http://www.ff-fan.com][/URL] to http://www.ff-fan.com

Same with the other one.  You are just forgetting the first [
hey thanks nice tut you got here i'm still tring to figure out how to do some of the things in here but it is a nice tut tho. Well come in handy for my game.
Absolutely gorgeous setup. its fantastic. just wanna let you know about your demo (XP). the lock events are set to action button rather than player touch and your chest doesn't give you a key.

also just some suggestions just for lazy convenience, you don't need to jump to this right away or anything.

It would be nice that the chest gives you as many keys as you action button for and the fairy gives you more than one AP at a time.

but this is great thank you for pulling this together!
I did the XP version rather quickly, so I'm not surprised, but thanks for pointing those errors out.  I'm currently concentrating on my own game, so I've kind of halted all work on other small projects.  I'll probably eventually fix the demo, but probably not for a little while.
Guardian1239 wrote:
I did the XP version rather quickly, so I'm not surprised, but thanks for pointing those errors out.  I'm currently concentrating on my own game, ...


yeah its understandable maybe just a notice on your main thing so people can change it if it matters a lot to them. I enjoyed the error because I didn't have to get past the lock. although it also sets up another cool thing that could be added where you have extra special ability buffs/increases where you can pass it but you could also be lucky and find a really good buff after unlocking the passable space, or something. 😉 a lot of fun this RM is.
It is, however, very very very laggy.  I suggest creating multiple maps for each grid.

Ex:
-Ch1 Main Grid
  -Ch2 Grid
  -Ch3 Grid

-Ch2 Main Grid
  -Ch1 Grid
  -Ch3 Grid

-Ch3 Main Grid
  -Ch1 Grid
  -Ch2 Grid

Of course, this method interferes with the ability grid menu script, but it will cut down on lag.  ^-^;
I'm a big fan of this system, but if were to want to reset an ability grid (so that an actor can go down a different path if desired), how would I go about implementing this?
What you can do is use something to activate a switch.

-Create an event at the start of the grid that will activate a switch, wait 60 frame (or whatever amount of frames you desire), and turn the switch off.
-In the last page of each tile, make an event that activates when that switch is on.  Make it parallel process.
-Create a conditional branch that asks whether or not the self switch is on.  If it's true, increase the character's AP variable by 1.
-Make the event  turn off the self switch.

It requires an extra event page, but it will work.  Since the switch event is at the start, the character will also be at the start and it will reset everything and give the player back the AP.
One problem I encountered on the VX demo which you might wanna fix. Whenever you select Ability Grid but then press ESC instead of choosing a character an error occurs:

Script "Ability Grid" Line 191: No method Error occurred.

There's some more too, you might wanna check it out for yourself.
I'm currently trying to contact Dargor, who has made the script.  He's been busy and hasn't had much free time, and I don't know any scripting, so I can't help you at the moment.  I'll let you know when I have more information.

Also, can you specify what else is problematic?  I can't help if I don't know what to fix. :thumb:
Dargor has fixed the script so that the error when hitting cancel instead of selecting a character has been fixed.  Also, he added fades to make the transition seem more natural and also made the script memorize the direction the character is facing both on the original map and the ability grid map.  Also, I fixed the errors in the XP demo.  Enjoy!
This system is wonderful, however, my game needs different grids for each class PER character. Simply put, each character has six grids that can ultimately be his. I have tried assigning the whole "1 => 1" thing to a variable, but I'm afraid I got the syntax wrong because I am a scripting illiterate. I was going to have a variable stand for the map number; and when a class was chosen the variable would be set to that number, thus making the script read the variable as the correct map number pertaining to the character's class.

Sorry if it sounds confusing, but I can't explain it any other way. Please help. Thanks in advance.
What you could do is transfer the player to a general map for that character that would then transfer them to another based on class.  You could incorporate it into the game's system, like make the player walk up to a panel on their general map that would then transfer them for a cool little scene.  Alternatively, you could create different characters for each class, using variables to record information and such.  This would also allow you to change the look of a character based on class, but I'm not sure how you're changing classes.  I have no scripting experience, so I can't help with that.  You'd have to contact Dargor or submit a request in the Script Requests forum if you want help altering the script itself.
i am totally digging the ability grid! i've found some problems though.

first of all, this weird bug:
i use ralph first, and go to his ability grid and do shit, then leave pressing the X button. then i try to do ylva's ability grid, and it flashes her grid on the screen for a moment then goes right back to the menu.
this happens with ralph's grid if i use ylva first.

second, is there a way to do this with KGC's menu customization script as opposed to dargor's? x_x i don't know anything about scripting, myself... but KGC's script is the one already implemented into my game, so i kinda can't use the ability grid system even though i really want to.

finally, if i try to save, this happens:
Content Hidden Show
http://i33.tinypic.com/21aei4x.png[/img]

and the game quits.

great job though, i hope these things can be fixed!

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=44564