Atmas_Sylphen 31 Posted August 3, 2013 I've been playing around with TP, the default scripts and trying to use other peoples scripts creatively, but I can't seem to get this to work. And after searching and searching for what I'm looking for, I'm bowing my head and making this request. What I'm looking for: I basically want TP to be AP, Action Points. Every turn the actor gains an action point and the max AP they can have is 5. Each action point represents the amount of things they can do in one turn. So if they have 2 actions points, they can heal, then attack in the same turn. Every action will take up AP except for "Defend" which will raise AP by 1. The sad part is I've already managed to max TP to 5, I've set it to regen 1 Tp per turn, turned off the "gain Tp from damage" setting, and really all the other things needed for this to work.. except for the extra actions based on TP amount. Since theres no Variables or Conditional branches that allow me to select TP as a condition. The non-script solution is simple really, add Action Times feature to the actor based on their current TP amount, then erase it when their TP becomes 0. But Ace doesn't let me make a variable based on TP., and I have no clue how to make the Action Times feature give +1 action that isn't based on a "percentage". So is there a script I'm not aware of? Or perhaps someone can write me one? It doesn't even have to be a whole battle system write up, it could just be a "patch" that lets me make TP into a variable =p. Share this post Link to post Share on other sites
Karanum 3 Posted August 3, 2013 (edited) I haven't had time to extensively test this, nor is this a very complex script, but it should at least turn an actor's TP into the amount of actions per turn. It also ends all of a player's actions and increases TP by 1 if they guard. There is no graphical indication of how many actions a player may do though. Might add that tomorrow if you are interested. Feel free to use (or discard) this however you want. #This should set the amount of actions for each battler to their TP. #The game completely ignores the 'Additional Actions' trait with this. #If an actor has 0 TP, they will still get 1 action. Don't know why. # #Feel free to expand upon this as you like. class Game_Battler < Game_BattlerBase def make_action_times return @tp end end class Game_Actor < Game_Battler alias karanum_tpaa_nextcmd next_command def next_command if @actions[@action_input_index].item.id == guard_skill_id @tp += 1 return false end karanum_tpaa_nextcmd end end class Game_Party < Game_Unit def make_actions members.each {|member| member.make_actions if member.tp > 0 } end end Edited August 4, 2013 by Karanum Share this post Link to post Share on other sites
Atmas_Sylphen 31 Posted August 3, 2013 Thank you thank you thank you! This work exactly how I needed it too =D. There's an error that pops up if an actor tries to guard with 0 Tp but I fixed that by making every actor regen 1 tp every turn so they never reach 0 =p. And the graphical action indicator is the TP count itself. Since every action requires at least 1 tp, the player can see it lower every time they do something, so they can see how many actions they can take that turn. Again thank you! XD I'll PM you if there's any unexpected issues =) Share this post Link to post Share on other sites
Karanum 3 Posted August 4, 2013 I made a small edit to the code I pasted in my previous post. This fix should solve the issue where actors get a turn, even with 0 TP. I haven't been able to replicate the error you mentioned, but I assume this fix should also clear that up. Share this post Link to post Share on other sites
Atmas_Sylphen 31 Posted August 4, 2013 (edited) Awesome =3. Alright, after several hours of playtesting this I found one more error. When an actor is dead, it pops up. It tells me the problem is in the game_actor class you wrote, undefinded method with item.id. So I thought about it, and having the actors regen 1 tp every turn, plus gaining 1 from defending is abit much since they gain two per turn that way. So I commented out that section to check, and it works similar, but guarding happens multiple times if they have more than 1 tp. Alright, I'll try your edited part and see what happens. Edited August 4, 2013 by Atmas_Sylphen Share this post Link to post Share on other sites
Atmas_Sylphen 31 Posted August 5, 2013 Ok, so the only error is when an actor is dead, the party command comes up, and when you select fight, it produces the error. I'm going to see if I can figure out why it's doing that. Though, my scripting knowledge is far more limited compared to yours =p. Share this post Link to post Share on other sites
Karanum 3 Posted August 5, 2013 (edited) I've been trying to fix the bugs, but it turns out to be a lot harder than I thought. I'm sorry, this might take a while. ^ I should say things like that more often, because right after that I had a breakthrough. Here's a new version of the script: module BattleManager def self.prior_command begin if !actor || !actor.prior_command @actor_index -= 1 return false if @actor_index < 0 unless actor.actions.size <= 0 unless actor.actions[actor.action_input_index].item.id == actor.guard_skill_id actor.tp += 1 end end SceneManager.scene.refresh_status end end until actor.inputable? return true end def self.gather_action_ids(actions) return actions.collect { |action| action.item.id } end end class Game_Actor < Game_Battler def make_action_times return @tp end alias karanum_tpaa_nextcmd next_command def next_command return false if @actions.size <= 0 if @actions[@action_input_index].item.id == guard_skill_id return false end @tp -= 1 SceneManager.scene.refresh_status return false if @tp < 1 karanum_tpaa_nextcmd end def prior_command return false if @action_input_index <= 0 @action_input_index -= 1 unless @actions[@action_input_index].nil? unless @actions[@action_input_index].item.id == guard_skill_id @tp += 1 end end SceneManager.scene.refresh_status return true end end class Game_Party < Game_Unit def make_actions members.each {|member| member.make_actions if member.tp > 0 } end end class Scene_Battle < Scene_Base alias karanum_tpaa_battlestart battle_start def battle_start give_turn_tp karanum_tpaa_battlestart end alias karanum_tpaa_turnend turn_end def turn_end give_turn_tp karanum_tpaa_turnend end def give_turn_tp $game_party.members.each { |actor| actor.tp += 1 } end end The dead actor bug is solved, along with a whole lot of other tiny things. TP automatically increases by 1 each turn now, so you don't need to do that yourself anymore. Also, the TP goes down whenever you select an action now so the TP bar is used as a real-time indication of how many actions the player has left. Edited August 5, 2013 by Karanum Share this post Link to post Share on other sites
Atmas_Sylphen 31 Posted August 5, 2013 =p I hate to bring up more issues, and you certainly fixed the ones from before, but the when I select Attack, it uses up a TP but doesnt deal damage, or play the animation. Also, I tested a battle with a dead actor and he gained TP every turn, so if I brought him back to life, he could attack over and over. This seems like it's turning into a full fledged battle system script XD. You should claim the rights to it and call it Karanums Action Point BS! Share this post Link to post Share on other sites