Jump to content

Recommended Posts

This is a tool for developers who wish to create system that rely on AP (ability points) for example, Final Fantasy's V's Job System, Final Fantasy VII's materia system etc. I intend to follow this up with a skill system where by characters can learn skills from weapons.

 

 

AP System Script

Category: Creator Tools

First you need to make an attribute for AP like so:

AP%20System%2001.png

Then on your enemies you need to add a trait like this:

AP%20System%2002.png

Note the 5 is the ap this enemy will give.

If needed edit the script to use the right attribute, look for:

AP_Element = 11

 

Then you're done, a screenshot to celebrate:

 

AP%20System%2003.png

 

Now for the script:

 

=begin
AP System Script
by Fomar0153
Version 1.0
----------------------
Notes
----------------------
No requirements
Implements an ap system for you to use when creating skill
ystems that utilise AP.
----------------------
Instructions
----------------------
You will need to create an attribute to use for AP.
Then set is as a trait, although it says % just put
the number you want the enemy to give as AP.
----------------------
Known bugs
----------------------
None
=end
module Vocab
 ObtainAp	   = "%s AP was obtained!"
end

class Game_Actor < Game_Battler
 #--------------------------------------------------------------------------
 # â— New Method gain_ap
 #--------------------------------------------------------------------------
 def gain_ap(ap)
# your code goes here
 end
end

module BattleManager

 # Set you AP Element
 AP_Element = 11

 #--------------------------------------------------------------------------
 # â— Rewrote self.display_exp
 #--------------------------------------------------------------------------
 def self.display_exp
if $game_troop.exp_total > 0
  text = sprintf(Vocab::ObtainExp, $game_troop.exp_total)
  $game_message.add('\.' + text)
end
if $game_troop.ap_total > 0
  text = sprintf(Vocab::ObtainAp, $game_troop.ap_total)
  $game_message.add('\.' + text)
end
 end
 #--------------------------------------------------------------------------
 # â— Rewrote self.gain_exp
 #--------------------------------------------------------------------------
 def self.gain_exp
$game_party.all_members.each do |actor|
  actor.gain_exp($game_troop.exp_total)
end
wait_for_message
$game_party.all_members.each do |actor|
  actor.gain_ap($game_troop.ap_total)
end
wait_for_message
 end
end

class Game_Troop < Game_Unit
 #--------------------------------------------------------------------------
 # â— New Method ap_total
 #--------------------------------------------------------------------------
 def ap_total
dead_members.inject(0) {|r, enemy| r += enemy.ap }
 end
end

class Game_Enemy < Game_Battler
 #--------------------------------------------------------------------------
 # â— New Method ap_total
 #--------------------------------------------------------------------------
 def ap
return (self.element_rate(BattleManager::AP_Element) * 100).to_i
 end
end

 

 

 

Planned Future Development

-May need updating when RPG Maker VXA is released in English.

Share this post


Link to post
Share on other sites

Although this is nice, are you planning to do something with it? (Other than let us make systems that support it)

 

EDIT: Oh, you don't even have the AP gain stored, do you? I'd add setting <Game_Actor>'s @ap = 0 on setup, and the @ap += ap in that method. Actually, this script doesn't actually do much by itself, only displays the potential AP you could have gained.

Edited by Zetu

Share this post


Link to post
Share on other sites

Although this is nice, are you planning to do something with it? (Other than let us make systems that support it)

 

EDIT: Oh, you don't even have the AP gain stored, do you? I'd add setting <Game_Actor>'s @ap = 0 on setup, and the @ap += ap in that method. Actually, this script doesn't actually do much by itself, only displays the potential AP you could have gained.

 

Thanks, currently I'm working on a system where you can learn skills from equipment (using AP) but I wanted to separate the two systems to reduce the number of times people potentially code the same thing. I'll probably make other skill systems with this as well in the future.

 

As for @ap not being stored that was intentional being as not everyone will want to implement ap as a single variable an example from my weapon skills script I'm working on:

 

class Game_Actor < Game_Battler
 #--------------------------------------------------------------------------
 # â— Aliases setup
 #--------------------------------------------------------------------------
 alias eqskills_setup setup
 def setup(actor_id)
   eqskills_setup(actor_id)
   if Equipment_Skills::Learn_Skills
     @ap = []
   end
 end
 #--------------------------------------------------------------------------
 # â— New Method or Rewrites gain_ap
 #--------------------------------------------------------------------------
 def gain_ap(ap)
   if Equipment_Skills::Learn_Skills
     for item in self.equips
       if item.is_a?(RPG::Weapon)
         unless Equipment_Skills::Weapons[item.id] == nil
           for skill in Equipment_Skills::Weapons[item.id]
             if @ap[skill] == nil
               @ap[skill] = 0
             end
             @ap[skill] += ap
           end
         end
       end
       if item.is_a?(RPG::Armor)
         unless Equipment_Skills::Armors[item.id] == nil
           for skill in Equipment_Skills::Armors[item.id]
             if @ap[skill] == nil
               @ap[skill] = 0
             end
             @ap[skill] += ap
           end
         end
       end
     end
   end
 end
end

 

I needed to store gained ap in an array to keep track of each skill's ap.

 

Should be finished bu tomorrow morning at the latest I'd say.

Share this post


Link to post
Share on other sites

I need to ask, what does this script, by itself, specifically do? enemies will give AP, but is anything particularly done with that ap? Do we have to use this in conjunction with your equipment script? or is the equipment script some updated/renovated version of this?

Share this post


Link to post
Share on other sites

Did you find out if what I was talking about was possible? I didn't notice the Fomar at first btw XD Wrong thread O: I was referring to the thread about the custom equipment slots.

Edited by Bernkastel

Share this post


Link to post
Share on other sites

Is it possibe to assign the ap gain to a variable? For example, I'd like to assign the ap increase to the variable 180 (start value 0) so that the player can buy skills with it.

(Sorry for my bad english)

Share this post


Link to post
Share on other sites

class Game_Actor < Game_Battler
 #--------------------------------------------------------------------------
 # â— New Method gain_ap
 #--------------------------------------------------------------------------
 def gain_ap(ap)
$game_variables[x + @actor_id] += ap
 end
end

Try that, replace x with a number e.g. If I want to use variable 10 to 16, x would be 9.

 

Edit: Put this below the original script.

Edited by Fomar0153

Share this post


Link to post
Share on other sites

Curious if there would be a way to eliminate it announcing the acquisition.

"So and so gained so much AP!"

Yeah, I want to hide that. :) Unfortunately I do not have sufficient knowledge to know if changing anything would be safe xD.

 

EDIT: I would also like to know if it would be possible to change the name from AP to something else, or the sentence it states.

Edited by Tewky

Share this post


Link to post
Share on other sites

Don't know if I can't post 2 months after the last post, but I don't know another way to tell you this bug...

When a character dies and the battle ends, the character should not receive AP, but he does.

Any way to fix it?

Share this post


Link to post
Share on other sites

Got a few questions on this script. I saw where you stated that it can be set to a number variable but could it be link instead to a variable like \v [x] and put in a event to do a random 1 to 100 for variable x to make the AP not a set every fight but a % chance to be given on the fight. Basically I am interested in using this in a form of alternate currency of sorts, kind of like the mythril system in shining force neo or exa games. Where sometimes monsters would award this bonus and it could be used in a shop like yanfly call common event shop to award bonuses to stats and other abilities and such. Or I could set it up also like on Everquests AA system too would work. If you have any suggestions I would love to hear them. 

Share this post


Link to post
Share on other sites

how did you make the vocab show how much exp you got?

Just change this part of this script...

 

 

 

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

# â— Rewrote self.display_exp

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

def self.display_exp

    if $game_troop.exp_total > 0

     text = sprintf(Vocab::ObtainExp, $game_troop.exp_total)

     $game_message.add('\.' + text)

    end

    if $game_troop.ap_total > 0

     text = sprintf(Vocab::ObtainAp, $game_troop.ap_total)

     $game_message.add('\.' + text)

    end

end

 

If you want no msg about AP you should be able to turn it into this

 

 

 

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

# â— Rewrote self.display_exp

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

def self.display_exp

    if $game_troop.exp_total > 0

     text = sprintf(Vocab::ObtainExp, $game_troop.exp_total)

     $game_message.add('\.' + text)

    end

end

 

If you don't want XP showing. Change the part of this script at the top of this reply to..

 

 

 

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

# â— Rewrote self.display_exp

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

def self.display_exp

    if $game_troop.ap_total > 0

     text = sprintf(Vocab::ObtainAp, $game_troop.ap_total)

     $game_message.add('\.' + text)

    end

end

 

You should know that if you get 0xp or 0ap and you have it set to display, it won't because the condition tells it to display ap/xp >0

I would say keep it this way, unless you want a battle where you kill a towns folk and loose AP or XP

 

 

I didn't test this but I can if you still need help....

I think this should do every thing the script normal does, but now it doesn't tell you the AP you gained from battle.

You should how ever edit the menu some where letting the player know their total AP.  There are many ways to do this.

 

Good Luck

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×