Zetu 70 Posted April 27, 2012 (edited) Was all this nessessary? Seems like it has nothing to do with the script at hand. Shows the bar. Appropriately uses the 10 Focus required. Undefined method 'value' line 371 crash. That seems weird... That is where it says.... unless resource.nil? resource.value -= @result.mp_damage end ...is it not? Hmm. Change it to unless resource.nil? puts resource.inspect resource.value -= @result.mp_damage end and tell me what is displayed in the Game Console after the error is thrown. (most likely a screeny) Edited April 27, 2012 by Zetu Share this post Link to post Share on other sites
Dark Horseman 93 Posted April 27, 2012 The #### was there previously, and I just # what was there before. This is the script from link unedited otherwise. Share this post Link to post Share on other sites
Zetu 70 Posted April 27, 2012 I can't figure out why that method returns the note string instead of Resource class. :/ I'll check into it. v1.05 is up and I added a demo. 1 Dark Horseman reacted to this Share this post Link to post Share on other sites
Dark Horseman 93 Posted April 28, 2012 (edited) Hey Zetu, the new demo and script are working pretty good. I tested around with it and found some minor errors that had some easy work arounds: :regen, :set, 20, for energy does not increase the actor's energy at all per turn. However, if I replace :set for both Rage and Energy to :mmp, it works exactly the way it's supposed to: 20 energy per turn and -5 rage automatically. Does :set have to be initialized to 1 in the script? It's not working, but I can live without it easily. :regenoffdamage has a small bug where it shows a floating point number on the screen that is incredibly long. I found that is the only method that uses += base, so it was just missing a += base.to_i in line 462. Edit: Just ran this with Fomar's ATB system and it ran consistently as long as I didn't set the turns to incredibly fast. I love you. Edited April 28, 2012 by Dark Horseman Share this post Link to post Share on other sites
Stefan 0 Posted April 29, 2012 Pretty cool update. The regen of energy, heat and focus works just fine with :mmp. The only major issue i see, is the regen out of battle (:replenish) that does not work (:regenoob of course too). Share this post Link to post Share on other sites
Zetu 70 Posted April 29, 2012 (edited) The not regening due to :set was a simple problem that I can't believe I didn't see. I'll post v1.06 by the end of today. And I just noticed that the script doesn't use :regenoob/:replenish at all. Must have accidentally removed it, so I'll throw that up too. EDIT: Nevermind, I changed the vocab. It's no longer :depleteoob/:regenoob, but :replenish/:deplete and works fine for me. I promise (in a week or so) that I will do some major work on this system, since I'll have the free time to do so then. Edited April 29, 2012 by Zetu Share this post Link to post Share on other sites
HellKiteChaoS 35 Posted April 30, 2012 Hey Zetu, I know you've had a lot of issues and updates for the script here, which by the way, is awesome, but I have one request if you find you have the time (no rush). I use YSA Battle System: Classical ATB and Yanfly Engine Ace - Ace Battle Engine v1.22 for my battle system in my game. Your script works in the fact that I can build the types of resources I would like to use, and the spell cost works like intended, but the issue is, out of combat my character has the resources I put in, but in combat, my character has the mana / TP bars, not the new ones I put in place. The spell costs still appear, just not the resource bars. Is there any way you can make your script compatible with them, or would I have to approach them to make their script compatible with yours? Share this post Link to post Share on other sites
Stefan 0 Posted April 30, 2012 (edited) Yanfly compatability works like in 1.03 For showing the ampx bars into yanfly engine battle ace look for "def draw_actor_mp"-class into battle engine 1.22 then overwrite it by: #----------------------------------------------------------------- # overwrite method: draw_actor_mp #-------------------------------------------------------------------------- def draw_actor_mp(actor, x, y, width=124) if actor.resources.nil? actor.setup(actor.id) end width /= actor.resources.size offset = width if actor.resources.size != 1 offset += 2 width -= 1 end for i in 0...actor.resources.size draw_actor_ampx(actor.resources[i], x+offset*i, y, width) end end to let the letters and numbers fit, u have to copy the "def draw_actor_ampx" of zetus ampx 1.05 into YBE 1.22 ace and test the coordinates this works for me: #------------------------------------------------------------------------- # overwrite method: draw_actor_ampx #-------------------------------------------------------------------------- def draw_actor_ampx(resource, x, y, width) color1, color2 = resource.params[:color] draw_gauge(x, y-2, width, resource.rate, text_color(color1), text_color(color2)) change_color(text_color(color2)) draw_text(x, y+3, 30, line_height, resource.params[:abbv][0]) draw_current_and_max_values(x, y+3, width, resource.value, resource.max, mp_color(resource.battler), normal_color) end to show both: Tp and Mp gauges in battle, you have to overrite "def draw_item(index)" by: #-------------------------------------------------------------------------- # overwrite method: draw_item #-------------------------------------------------------------------------- def draw_item(index) return if index.nil? clear_item(index) actor = battle_members[index] rect = item_rect(index) return if actor.nil? draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?) draw_actor_name(actor, rect.x, rect.y, rect.width-8) draw_actor_action(actor, rect.x, rect.y) draw_actor_icons(actor, rect.x, line_height*1, rect.width) gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4) if draw_tp?(actor) && draw_mp?(actor) draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4) draw_actor_mp(actor, rect.x+2, line_height*2, rect.width-4) elsif draw_tp?(actor) && !draw_mp?(actor) draw_actor_tp(actor, rect.x+2, line_height*3+gx, rect.width-4) else draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4) end end finaly to show both mp and tp needs in the skill cost menu, you can create a new script, which looks like this class Window_SkillList < Window_Selectable def draw_skill_cost(rect, skill) if @actor.skill_tp_cost(skill) > 0 change_color(tp_cost_color, enable?(skill)) draw_text(rect, @actor.skill_tp_cost(skill), 2) rect.width -= 32 end if @actor.skill_mp_cost(skill) > 0 skill.skill_cost(@actor).each do |index, value| next if (resource = @actor.resources.resource_of(index)).nil? next if value <= 0 change_color(text_color(resource.params[:color][0]), @actor.skill_cost_payable?(skill)) draw_text(rect, value, 2) rect.width -= 32 end end end end In the End it should look like this: http://imageshack.us/photo/my-images/171/ampx105yanflybattleengi.png/ This is as far as I got yesterday, I will work onto the menu bars tomorrow. Edited April 30, 2012 by Jet Added spoilers and code tags Share this post Link to post Share on other sites
Dark Horseman 93 Posted May 1, 2012 (edited) EDIT: Nevermind, I changed the vocab. It's no longer :depleteoob/:regenoob, but :replenish/:deplete and works fine for me. The rage and energy settings will regen every step, but they won't regen 100% right after battle which is fairly awkward. Also, I can't use items or skills outside of battle to regenerate the resource. An MP user is pretty much never going to refill their resource. A small fix to line 441. As of right now healing someone with Rage will kill their resource value if "regendmg" is used.. Healing counts as a negative resource, so I just put an if statement in there. Further, the code specifies "base *= max" and returns an error if :mmp is used. Replacing the line with "base *= resource.max" fixes it. def apply_damage_regen(damage, element_id=0) return if dead? @resources.each.each do |resource| next unless resource.include? :regendmg type, base = resource.params[:regendmg] puts damage puts base case type when :mmp; base *= max when :damage; base *= damage when :percent; base *= damage.to_f/mhp end #### Make sure positive if base.to_i > 0 resource.value += base.to_i end Edited May 7, 2012 by Dark Horseman Share this post Link to post Share on other sites
HellKiteChaoS 35 Posted May 2, 2012 Stefan, after placing the script patches in, I get this error. Script 'Yan_Battle_System' line 2242 NameError occurred. undefined local variable or method 'battle_members' for #<Window_BattleEnemy:0x948f52c> Am I missing or overlooking something? Share this post Link to post Share on other sites
Stefan 0 Posted May 2, 2012 (edited) Well perhaps you made a mistake. I put it all together from the forum and couldn't recreate the error. just uploaded the script here: http://pastebin.com/nV9bNb0e Althrough i had an Error with the enemy Mp-Bars in battle, that occured when i didn't set ampx-ressources to enemys in the enemy notetag. Once that was done, I hadn't any problem with compability. Edited May 2, 2012 by Stefan Share this post Link to post Share on other sites
HellKiteChaoS 35 Posted May 3, 2012 Okay, two more questions. And btw, thanks Stefan for that script, it works! ^.^ My questions are with the rage spell, I'm trying to customize it a little more than the default provided. Right now I have the script set up as :deplete, :regenoffdmg, :damage, 0.1, :regendmg, :percent, 120, :max, 100, :name, "Rage", :abbv, "RG", :color, 10, 2 The first question is, With " :regenoffdmg, :damage, 0.1,", it produces rage from any damage done, even damage from spells that cost rage to cast (which defeats the purpose of having it cost rage.) I want the character to gain rage just through taking damage from enemy's and from the "Attack" command. Now I looked at ":regenelemental, <element_id>, <type>, <base> " in the options, but I can't get it to work correctly with "Attack". My understanding is <element_id> is the element I create in the "Terms" tab in the "Elements" section of the database. I created an element named "Normal". Set the "001: Attack" skill in the skill list to have its damage set to the "Normal" element I created. In the script, i have it set up as :regenelemental, 13, :damage, 0.1 (13 being the element "Normal" in my list) This does not produce rage from the "Attack" function. Am I setting this up incorrectly? My second question is, While using ":damage, 0.1" being the character gains rage based on 10% of the damage done, this will scale horribly in the later game, as when the character does 10,000+ damage hits, the rage bar will always fill 100% with each turn. I would like to set up a way to set the character to only gain rage based on the damage dealt to the enemy based on the % of its max HP. Example: (8)a = 0% to 10% (14)b = 10% to 30% (21)c = 30% to 60% (33)d = 60% to 100% If the character hits the target, dealing enough damage to do 13% of its total HP in one hit, the character would gain 14 rage. If the character hits the target, dealing enough damage to do 55% of its total HP in one hit, the character would gain 21 rage. etc etc. This would help scale damage throughout the game and even for boss fights where the player will not hit for huge chunks of the bosses total health yet still gain enough rage to be able to perform without feeling starved for rage. How can I set this up with the ":regenoffdmg, :damage, 0.1,"? I know I've been asking a lot of questions about this in this form, but I really enjoy the fact that I can really customize the characters in my game. Thanks to everyone who's answered my questions and helped me through this script for so long. <3 <3 <3 Share this post Link to post Share on other sites
Dark Horseman 93 Posted May 3, 2012 Bob, for your scaling problem, have you tried: :regenoffdmg, :percent, 30, It may sound the same as what you're doing, but it actually calls: when :percent; base *= damage.to_f/mhp Using :percent will scale the damage to your maximum hit points I believe. This is also something easier which you may or may not want to do: make Rage cost a set amount for your attack/abilities. It is infinitely easier to balance for the length of an entire game. This is how Warcraft does it except they can set it for each of their individual abilities. :regendmg, :set, 5, :regendmg, :mmp, 5, Share this post Link to post Share on other sites
Pineapple 0 Posted May 4, 2012 Now I looked at ":regenelemental, <element_id>, <type>, <base> " in the options, but I can't get it to work correctly with "Attack". My understanding is <element_id> is the element I create in the "Terms" tab in the "Elements" section of the database. I also cannot get this to work properly. does it not function in the current system? (I noticed there was no examples of it in the demo, perhaps this is why) Share this post Link to post Share on other sites
Dark Horseman 93 Posted May 7, 2012 (edited) A couple more things I figured out from using the script: - Outside of battle, :replenish and :deplete will update resources a "tick" after 10 steps strangely. Currently, there isn't a way to make resources default to 100 or 0 right after combat. - Items or skills that regenerate a resource (e.g. MP Recover with appropriate <ampx damage: Mana> tag) do not work outside of combat. That means a "Mana Potion" will only give you mana in combat. - The work around to above is to make the item add a feature "Add State: blank dummy state" and "Remove State: blank dummy state". This seems to be the only way to make the item/skill work. It appears the game believes the resource is always full, so it refuses to allow you to alter resources outside of combat, but if you append a buff along with the equation, the logic allows you to do it (you have to remove because after you give the buff, it will block you from using the spell/item again). - <AMPX REGEN: X> and <AMPX COST: X> appear to have no functionality yet. Using these notes doesn't do anything for my actor, and it appears these have not been implemented in the code yet. (are these placeholders?) Edited May 11, 2012 by Dark Horseman 1 rayhaku reacted to this Share this post Link to post Share on other sites
kwanzaabot 0 Posted July 3, 2012 Okay, this is kind of convoluted, so bear with me. I'm finding the bars/gauges a little too short. If I have an MP and a Rage bar, the name of the bar and its number sort of get placed on top of each other, so if I have 100 MP, in combat it tends to look like "1M0P0". It's hard to read. Is there any way I could modify this so the game renders the HP bar (which takes up too much space) like it does when the default game has a TP bar? So that the HP, MP and Rage bars take up a third of the space, instead of the HP bar, as it is, taking up two thirds, with a tiny bit left over for the other bars? Share this post Link to post Share on other sites
Hibashirii 0 Posted July 3, 2012 (edited) Every time i try to open the menu or to start a fight i get the following error: Script 'Yanfly Core' line 710: FloatDomainError occurred. NaN Can someone help me with this matter? Edited July 3, 2012 by Hibashirii Share this post Link to post Share on other sites
Stefan 0 Posted July 4, 2012 If u use yanfly and ampx, every single Actor and enemy must have <ampx: Mana>/ <ampx: Rage>/ <ampx: Focus> or whatever resource is used into its notetag. Share this post Link to post Share on other sites
Hibashirii 0 Posted July 4, 2012 Oh okay , thanks. It made me crazy that it didnt work. Thanks again. Share this post Link to post Share on other sites
SamHain 0 Posted July 9, 2012 (edited) Hello there. I had a question regarding setting the maxes for the alternate resources. What if I don't want to set a set number as the max for a resource, but I also didn't want the max for that resource to be equal to the value of one of their stats? Is it possible to set this script up so that the maximum available amount of a desire resource could scale as a character levels? Is there a way to set the resource value to equal a percentage of an existing stat? Let's say I have a Swordmage that uses both Mana and Rage. But rather than set a fixed max for one or the other, I want the Swordmage's Mana and Rage max values to be equal to 50% of his total mmp each. Would it be possible to do such a thing? Also, is it possible to cause a resource to regenerate at a slow and steady rate outside of battle? For example, for every X steps the resource regenerates Y point(s). (forgive me if my question seems a bit bulky) Edited July 9, 2012 by SamHain Share this post Link to post Share on other sites
Zetu 70 Posted July 10, 2012 @Bob Greg: In the next version, I'll add :regenoffdmgphy and :regenoffdmgmag for both spell and physical damages. @Dark Horseman: It would be cool if you could do regen on spell use to add extra rage in particular attacks. I'll add it. @SamHain: I would have to add on to it to do that, so I'll add it to the next version. If there are other features anyone wants me to add plz tell me. Share this post Link to post Share on other sites
SamHain 0 Posted July 10, 2012 (edited) I'm entirely new to scripting, and the script you have may already cover this: Is there a way to take the new resources provided to a character and place them into two variables each? One variable that equals the max total of the new resource, and another that equals the current amout of that resource? My technical wording may be a bit off; so, I'mma try me an analogy. Let's say that in my game, I have a raging barbarian warrior hulk (using Rage as an alternate resource, of course). Now let's say that as part of the game's progression, that Hulk of a barbaian will be required to enter the grand Temple of Happy Fluffy Peace, Cuddly Lovey Caring Sickeningly Sweet Cutness Bunnies which happens to have a warded doorway to keep things that don't quite fit that description out of it. So, I make an event for the door. @Conditional: Variable[ABCD: Hulk Rage] < Variable[iJKL: Fluffy Bunny Happy Gate] @Yes @*Door Opens* @ShowText: "(\_/) Welcome" @ShowText: "(^.^) to" @ShowText: "(><)o BUNNY LAND!" @Else @ShowText: "Lolumad brah?" @ShowText: "Calm down and come back later." @ShowText: "Hulk: FFFFFFFFFUUUUUUUUUUUUUU!!!!!!!!!" @Variable[ABCD: Hulk Rage] set = Variable[EFG: Hulk Max Rage] @End @End in which, Variable[ABCD: Hulk Rage] is how much rage he currently has built up and Variable[EFG: Hulk Max Rage] is his maximum amount of rage... which would then be how much rage he's built up afte being trolled by a bunny. ... or something akin to that. Edited July 10, 2012 by SamHain Share this post Link to post Share on other sites
Zetu 70 Posted July 10, 2012 Your question makes no sense, but if you just want to access the value of the resources, just use... <Actor>.resources[0].value Also, this is probably something you shouldn't deal with if you just started scripting. 1 tiagoms reacted to this Share this post Link to post Share on other sites
Stefan 0 Posted July 11, 2012 Hi Zetu, since you are doing a newer version: ........ I want to set an maximum amount of a resource to a variable (for examples loads of the actors weapon) Share this post Link to post Share on other sites
SamHain 0 Posted July 16, 2012 Your question makes no sense, but if you just want to access the value of the resources, just use... <Actor>.resources[0].value Also, this is probably something you shouldn't deal with if you just started scripting. /shrug Being a hands on sort, I'm a fan of the emersion learning style. In the script phrase you mentioned above, does that differentiate between different resources? Or would I have to make alterations to access the values of multiple resources? Share this post Link to post Share on other sites