Bob423 52 Report post Posted December 30, 2013 (edited) I have a custom stat cannot be increased with normal stat increasing items because it is 100% handled in a script and therefore isn't in the database. I need a script that will allow me to make items that increase my custom "hit" stat. This is the script for said stat: # HIT stat module STATS Hit = { 1 => { :scaler => 0.9525, :base => 4 },#actor_id => { ... 2 => { :scaler => 0.9865, :base => 9 }, 3 => { :scaler => 0.9785, :base => 6 }, 4 => { :scaler => 0.9640, :base => 5 }, 5 => { :scaler => 0.9435, :base => 3 }, 6 => { :scaler => 1.0060, :base => 10 }, 7 => { :scaler => 0.9470, :base => 4 }, } end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Game_Actor #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class Game_Actor < Game_Battler alias hit_setup setup attr_accessor :bob_hit def setup(actor_id) @base_hit = 0 @hit_bonus = 0 @thisActor = actor_id hit_setup(actor_id) @hit = 0 end def base_hit @base_hit = (level * STATS::Hit[@thisActor][:scaler] + STATS::Hit[@thisActor][:base]).round end def base_pdef weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] pdef1 = weapon != nil ? weapon.pdef : 0 pdef2 = armor1 != nil ? armor1.pdef : 0 pdef3 = armor2 != nil ? armor2.pdef : 0 pdef4 = armor3 != nil ? armor3.pdef : 0 pdef5 = armor4 != nil ? armor4.pdef : 0 return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 + base_hit end end Edited March 4, 2014 by Bob423 Share this post Link to post Share on other sites
Bob423 52 Report post Posted January 2, 2014 If I can get an item to increase a variable depending on which character it's used on, I can probably do it with a common event. The problem is that I don't think there's a way to use an item and have the common event do something very slightly different depending on what character it's used on. e.g. using item calls common event after character is selected common event increases character's lvl. There are scripts for lvl increasing items like rare candy, but it would be nice to be able to do something like that without scripts. Share this post Link to post Share on other sites
Bob423 52 Report post Posted February 27, 2014 It's been a while. Does anyone new want to give it a try? Share this post Link to post Share on other sites
ShinkuAura 15 Report post Posted February 27, 2014 HEY! no double posting. In your case no triple posting. Share this post Link to post Share on other sites
Bob423 52 Report post Posted February 27, 2014 Actually, if you're bumping your own topic and/or adding information about something it's fine...I think. I've done it before anyway. Share this post Link to post Share on other sites
ShinkuAura 15 Report post Posted February 27, 2014 Still rules are rules. I am the strict type. Anyways...I have no script knowledge for RPG maker XP can't help you bro. Share this post Link to post Share on other sites
Bob423 52 Report post Posted February 27, 2014 How else can I bump my topic? Please think about whether or not it is worth the effort and do not over enforce rules...like me :D Share this post Link to post Share on other sites
Heretic86 25 Report post Posted February 27, 2014 (edited) Reasonable application of forum rules and guidelines should be considered, even with necroposting. The intent is to make the forums as friendly as we can reasonably make them, not drive people away for bumping or necroposting on a mostly inactive forum when people are genuinely asking for assistance. Reasonable would be a bump in a 24 hour period. --- It may be possible to achieve this without scripts, just looking in the wrong place. Take a look under States at "Sharp". I havent played too much with it myself so not sure if either Atk % or Hit Rate % could be used to alter the property. Edited February 27, 2014 by Heretic86 Share this post Link to post Share on other sites
Bob423 52 Report post Posted February 27, 2014 That won't work because: 1. Those are temporary, do not stack, and may confuse the player. I want an item that permanently increases HIT by 1 2. HIT in my game is a custom stat. Hit Rate is completely different and not even used in my custom battle formula. I would also settle for something increasing the PDEF stat since, because of complicated stuff, it's basically the same thing. DEX is renamed DEF and is Defense PDEF is renamed HIT, but in order to make it increase when a character levels up, I made a second HIT stat and made the formula for finding HIT, "PDEF + HIT" I know, it's complicated and weird. HIT is accuracy by the way. Also my "Sharp" stat is called Firmus after the name of the spell that causes it and it increases STR (which is called ATK in game) by 50% Share this post Link to post Share on other sites
black mage 28 Report post Posted March 2, 2014 (edited) Here's some bases on how to have an item that can increase a custom stats 1. set the custom stat to be available for each actor class Game_Actor < Game_Battler def setup(actor_id) @customstat_plus = 0 end #-------------------------------------------------------------------------- # * Get HIT #-------------------------------------------------------------------------- def customstat n = [[base_customstat + @customstat_plus, 1].max, 999].min n = [[Integer(n), 1].max, 999].min return n end #-------------------------------------------------------------------------- # * Set customstat # customstat : new customstat #-------------------------------------------------------------------------- def customstat=(customstat) @customstat_plus += customstat - self.customstat @customstat_plus = [[@customstat_plus, -999].max, 999].min end #-------------------------------------------------------------------------- # * Get Basic customstat #-------------------------------------------------------------------------- def base_customstat n = 0 return [[n, 1].max, 999].min end end 2. Set so that when you use an item, you get the actor_id. Open the script editor, on scene item, find these line : # If single target if @target_window.index >= 0 # Apply item use effects to target actor target = $game_party.actors[@target_window.index] used = target.item_effect(@item) end modify it so it become like this : # If single target if @target_window.index >= 0 # Apply item use effects to target actor target = $game_party.actors[@target_window.index] $target2 = target used = target.item_effect(@item) end 3. Set the item that increase the custom stat - make an item that when used, it call a common event. - do a script call $target2.customstat += n There you go, it'll increase the custom stat for the certain actor whose had the item used on him/her by n. You can use the custom stat in damage calculation or anything else you'd like. Note : this is only for items that used on a single target. But I think it'll not be that hard to figure how to do this with an item that target all party members. Edited March 2, 2014 by black mage 1 Bob423 reacted to this Share this post Link to post Share on other sites
Bob423 52 Report post Posted March 2, 2014 I can't get it to work and it looks like you want me to set up my stat completely differently. How do I "set the custom stat to be available for each actor"? and why do I need to? That script won't mess with what I already have, right? I have this: # HIT stat module STATS Hit = { 1 => { :scaler => 0.9525, :base => 4 },#actor_id => { ... 2 => { :scaler => 0.9865, :base => 9 }, 3 => { :scaler => 0.9785, :base => 6 }, 4 => { :scaler => 0.9640, :base => 5 }, 5 => { :scaler => 0.9435, :base => 3 }, 6 => { :scaler => 1.0060, :base => 10 }, 7 => { :scaler => 0.9470, :base => 4 }, } end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Game_Actor #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class Game_Actor < Game_Battler alias hit_setup setup attr_accessor :bob_hit def setup(actor_id) @base_hit = 0 @hit_bonus = 0 @thisActor = actor_id hit_setup(actor_id) @hit = 0 end def base_hit @base_hit = (level * STATS::Hit[@thisActor][:scaler] + STATS::Hit[@thisActor][:base]).round n = @base_hit return [[n, 1].max, 255].min end end and this, to add the pdef stat and limit it to 255 def base_pdef n = 0 weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] n += weapon != nil ? weapon.pdef : 0 n += armor1 != nil ? armor1.pdef : 0 n += armor2 != nil ? armor2.pdef : 0 n += armor3 != nil ? armor3.pdef : 0 n += armor4 != nil ? armor4.pdef : 0 n += base_hit return [[n, 0].max, 255].min end Share this post Link to post Share on other sites
black mage 28 Report post Posted March 2, 2014 (edited) Your script alone won't give the custom stat an option to have it value to be increased or decrease (The truth is, I think that it could, but not as simpel as how I do it). That's why i make a script so it can be increased manualy. And since your request is to have the value added via items, there goes point 2 and 3 in my previous post :) AFAIK it won't mess your code, but it'll still need some configuration. My script is just a base for the custom stat so it can be increased or decreased manualy (easily). EDIT : Forgot to answer this : How to "set the custom stat to be available for each actor". Just copy the script above main. It'll do the rest by itself. Edited March 2, 2014 by black mage Share this post Link to post Share on other sites