Equipment Level Base

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by Selchar, Jan 7, 2014.

  1. Selchar

    Selchar Veteran Veteran

    Messages:
    297
    Likes Received:
    77
    First Language:
    English
    Equipment Level Base Ver. 1.05
    Selchar
     

     
    Introduction
    This script adds the necessary methods for leveling.  It doesn't do anything on it's own, but other scripts such as the examples can take advantage of it.  I have supplied exp leveling for equips, as well as a basic scene for upgrading equips.

    Features
    - Allows for the creation of equipment leveling scripts.
    - Example allows for leveling weapons via exp, just like actors.
    - New example shows my attempt at a simple equip upgrade scene(see screenshot)
    - Can choose a default max level for all, or individual via notetags.
    - Different exp curves for different weapons, or all the same!

    Screenshot
    [​IMG]
     
    How to Use
    Place the script below ▼ Materials, below Tsukihime's Instance Items, but above ▼ Main Process.  Use the provided notetags and follow the instructions within the script.
     
    Script
    >Required<

    >Pick one of these<
    Equip Leveling Base 0 (Levels start at 0)
    Equip Leveling Base 1 (Levels start at 1)

    Equip Leveling by Exp (Requires a Base)
    Equip Upgrade Scene(Requires a Base)
    Equip Leveling by Ap(Requires a Base and Basic AP)
     
    FAQ
    Q: What are the terms of use?
    A: My terms are, anything goes, while the terms for Tsukihime's scripts can be found here
     
    Credit and Thanks
    - Selchar
    - Tsukihime for the Instance Items Base

    Updates
    1/7/14: Fixed equip name when leveling down | Changes in param calculations to guarantee accuracy.
    1/11/14: Compatibility with Weapon Durability
    1/12/14: Finalized? Compatibility with Weapon Durability(Price Fixing)
    1/16/14: Compatibility update with all other instance scripts using Tsukihime's Instance Items.  Added my basic Equip Upgrade Scene.
    1/17/14: Made Equip Upgrade Scene a little more dynamic, you can now control what parameters are shown, and in what order.
    3/4/14: Fixed a freezing bug in the Leveling by Exp script.
     
    Last edited by a moderator: Mar 1, 2015
    #1
    BCj, GGSlayer, Lorenze and 1 other person like this.
  2. Selchar

    Selchar Veteran Veteran

    Messages:
    297
    Likes Received:
    77
    First Language:
    English
    To go along with the earlier compatibility update, I'm adding a basic equip upgrade scene! See screenshot above.


    Small update to the upgrade scene, the stat window showing current stats and upgrade stats can now easily be controlled, which is to say you can control what params are shown, and the order by which they are shown!
     
    Last edited by a moderator: Jan 18, 2014
    #2
  3. TKLF

    TKLF Villager Member

    Messages:
    8
    Likes Received:
    0
    Heya.

    Can I request some features for this script in here?

    This has been pretty much the script I have been looking for minus one thing:

    Using items/materials in the upgrade process (like metals, and other whatnot like that).

    - Checking if player has enough of required item(s)

    -- Displaying quantity of item (Green if enough, red if insufficient/missing, etc.) in a window.

    Just wanted it so you wouldn't just throw money at the guy in case he needs some rare ores to upgrade the weapon, haha.

    And just some more ideas that would be cool (but not muh request!):

    - Percentage of success for an upgrade(for example, +10 might only have a 20% chance of success, whereas +1 has a 100% chance)

    -- If said upgrade fails, whether weapon is destroyed or is broken.

    --- If broken, if it retains its current upgrade tier upon being repaired.

    -- Ability to use items(catalysts) to boost success % (I realize the screen might be cramped, so perhaps another window after selecting the weapon, confirming whether or not the player wants to use an item to boost the success chance)

    --- Displays current and new success % with catalyst applied

    --- Different items having different success boost chance - Catalyst A = +10%, Catalyst B + 30%, etc.

    I typed a lot, didn't I :|

    Anyways, it'd be pretty cool if you could add the materials thing up there. Loving the script!
     
    #3
  4. Selchar

    Selchar Veteran Veteran

    Messages:
    297
    Likes Received:
    77
    First Language:
    English
    1: Using items/materials in the upgrade process (like metals, and other whatnot like that).

    If I can figure out how to implement it properly I'll do it, been kind of stuck on some parts of the planning, so I can't give any guarantees.  You are free to request the changes to the provided scene from someone else, or even a completely different scene(if moving windows and such to fit stuff is unavoidable) from someone else if I keep drawing blanks.  Maybe if I looked at how crafting scripts do their checking...

    2: Percentage of success for an upgrade(for example, +10 might only have a 20% chance of success, whereas +1 has a 100% chance)

    I considered making an add-on to do this, and should be relatively simple, it's just a matter of deciding how to set success rates since there are a few ways of doing it, want to try and make it flexible if I do it.

    3a: If said upgrade fails, whether weapon is destroyed or is broken.

    I'm more of a de-leveling person myself... (lost too many gears in games)

    3b: If broken, if it retains its current upgrade tier upon being repaired.

    With this in mind tho, it could be done by "borrowing" a few changes from my durability script, since I'd need to make sure a "broken" equip can't be equipped... would need a "rate of destruction/broken" to be checked on failure.

    4: Ability to use items(catalysts) to boost success % (I realize the screen might be cramped, so perhaps another window after selecting the weapon, confirming whether or not the player wants to use an item to boost the success chance)

    Relatively speaking, same answer as #1, I'm already getting headaches thinking about it @.@, 1 step at a time! Depends on however I do the number 2 if I do it, now would also be a good time for me to learn how to add a standard confirm window.

    Scene/Window making is serious business, full of blood, sweat, tears, headaches... oh the headaches, especially when they get more complicated and you don't know how to do a particular thing.  I count myself lucky that I made the scene seen in my screenshot ^^  Anyways I'll see what I can do when I have time, but I can't really give any guarantees.

    Edit: Doesn't look like I'll have the time to figure it out.
     
    Last edited by a moderator: Feb 10, 2014
    #4
  5. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,020
    Location:
    Toronto
    First Language:
    English
    Found an issue while testing equip formulas.

    http://www.rpgmakervxace.net/topic/22618-equip-param-formulas/

    Basic formula:

    50 * levelAnd it crashes because the level was not initialized.It is not obvious how the level is initialized, but I put in a

    def level @level ||= 1endfor RPG::EquipItem.My assumption is that all equips start at level 1, even if they don't actually level.
     
    Last edited by a moderator: Mar 16, 2014
    #5
  6. Selchar

    Selchar Veteran Veteran

    Messages:
    297
    Likes Received:
    77
    First Language:
    English
    It's done when the instance it actually made, and starts at 0, but I went ahead and added your little snippet with that change to fix the issue,
     
    #6
  7. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,020
    Location:
    Toronto
    First Language:
    English
    I see the problem now.

    My script accesses the template at some point.

    So the reason why initializing level for a template works, because it was trying to check the template's level.

    As for why it's doing that, the problem lies with the way instance items are refreshed

    "def refresh_#{ivar} var = InstanceManager.get_template(self).#{ivar} @#{ivar} = make_#{ivar}(InstanceManager.make_full_copy(var))end"The way instances are refreshed is to first grab the template and then use all those `make` methods to modify variables.My assumption for any scripts based on instances was that you didn't have to worry about templates, but that assumption does not hold during the actual refresh process: if some script was trying to access attributes that were not initialized in the templates, it would crash.

    I'm not sure if there is a way to address this issue without requiring all custom variables to be at the very least initialized.
     
    Last edited by a moderator: Mar 16, 2014
    #7
  8. oldbone

    oldbone Veteran Veteran

    Messages:
    101
    Likes Received:
    4
    Location:
    New England
    First Language:
    English
    Having trouble with this one... Cannot get items to level without the custom scene (ie: from experience).

    I have these scripts in place (in this order):

    Instance Items

    Instance Equip Leveling Base Ver. 1.05

    Instance Equip Leveling by Exp Ver. 1.02

    Equip Upgrade Scene

    In Instance Items, I have it set like so:

        Enable_Items = false    Enable_Weapons = true    Enable_Armors = trueIn Leveling base, I have it set like so:

     

      module Equip    #Set this to the default maximum level of your choice.    Default_Max_Level = 10        #Change this to how you wish for your weapon's level to be shown.    #'+' will show it as 'Name+1', while 'LV ' will show as 'Name LV 1'    Level_Prefix = ' +%s'        #Default Multipler bonus    Default_Mult_Bonus = 1.25    #Mult bonus for price    Default_Mult_Price = 1.25        #Determines the default availability of an equip's ability to level.    #The <can level> notetag will always do the opposite    Default_Can_Level = true

    I didn't change anything in the Leveling XP script.

    I didn't add notetags to anything (as I thought if I had default leveling set to TRUE, I'd be all set).

    If I use the scene, I can level up items just fine.

    But if I grant XP to the party or have them win a fight with monsters with gobs of XP, the items don't level.

    I must be missing something...

    EDIT: I'm using Yanfly's Equip engine, wonder if that's the problem?
     
    Last edited by a moderator: Oct 3, 2014
    #8
  9. Selchar

    Selchar Veteran Veteran

    Messages:
    297
    Likes Received:
    77
    First Language:
    English
    1: I just tried the scripts you mentioned in a new project and was able to level up equips without problems save for 1 which has been addressed.

    2: Slight adjustment to the Upgrade Scene to automatically correct an equip's exp amount if used in conjunction with the leveling by exp script.(didn't think anyone would use both before)

    3: Default_Can_Level = true does indeed mean you don't need to use the notetag <can_level> to enable it.

    4: Currently only exp from Battle is added on to equipment exp.

    Not sure what could be causing your problems.
     
    #9
  10. oldbone

    oldbone Veteran Veteran

    Messages:
    101
    Likes Received:
    4
    Location:
    New England
    First Language:
    English
    Nice - it was actually Yanfly Battle Aftermath causing the issue. 

    Guess I'll find a new way to simply strip out the after-battle message. 

    Thanks!
     
    #10
  11. oldbone

    oldbone Veteran Veteran

    Messages:
    101
    Likes Received:
    4
    Location:
    New England
    First Language:
    English
    Hmm... Shields & Weapons gain XP fine... but things like Bodygear, Headgear, etc do not. 
     
    #11
  12. Selchar

    Selchar Veteran Veteran

    Messages:
    297
    Likes Received:
    77
    First Language:
    English
    I can see where there would be a problem if Yanfly's Aftermath is after my scripts, but if you have it before mine, then your equips will level up properly.

    I got everything to level up properly, so doublecheck for notetags?  I'm not sure what else would prevent your equips from leveling.
     
    #12
  13. BMASTER

    BMASTER Villager Member

    Messages:
    7
    Likes Received:
    1
    First Language:
    German
    Hi Selchar

    I have a small issue with the script.

    First: No matter what I do, if I pick up the equipment it has no level. But it levels up with even 0exp and gets the atk+4 bonus I set for level up.

    For those of you who want let's say for each level 100exp more than the level before.

    Example:

    Level 1=100exp to next level

    Level 2=200exp to next level

    Level 3=300exp to next level

    and so on

    Here is the formula for this case.

    if self.level <= 1100 * self.levelelse self.level * 100 * (self.level - (0.5 * (self.level-1)))endIf you want an other number to be accumulated to the previous exp.

    Example

    Level 1=50exp to next level

    Level 2=100exp to next level

    Level 3=150exp to next level

    Just change the 100 to the number you like to accumulate to the exp needed the level before.
     
    Last edited by a moderator: Nov 16, 2014
    #13
  14. Selchar

    Selchar Veteran Veteran

    Messages:
    297
    Likes Received:
    77
    First Language:
    English
    1: An equip's level always starts at 0.(I have yet to see a game where it actually starts at 1 and the first 'level up' puts the equip at level 2, but maybe I wasn't looking hard enough.)
     
    2: With the above in mind, the original exp formula of '(level+1)*100' shows that you would need 100 exp per level.(Yes I can see now that that formula is pointless unless you use very low amounts of exp per monster throughout the game.  In any event focus on the (level+1) part.  You should have fewer problems with your exp formula is you add 1 to the equip's level at each point in the calculation it's used... or start off with a = self.level+1 and substitute all self.level in your formula with a.

    Just keep that information in mind and you should have fewer problems deciding on a formula to use and debugging it.

    Now that I think about it tho perhaps I should make an 'AP' version of the leveling by exp script, probably using Fomar's basic AP system, or I can make my own since he doesn't have a $imported for compatibility checks.  AP would be easier to manage compared to exp in this case, or maybe call it EP for equip points? *shrugs*

    Edit: Or I can make an alternative Base script that starts at level 1, pushing stat calculations to start at level 2.  That's another option I suppose.
     
    Last edited by a moderator: Nov 17, 2014
    #14
  15. BMASTER

    BMASTER Villager Member

    Messages:
    7
    Likes Received:
    1
    First Language:
    German
    Have a look at Fomar0153's Equipment Level Up. He uses a Notetag to determine the min_level of an Item. I tried to use it before, but couldn't get it to work with all those scripts I use.
     
    #15
  16. Selchar

    Selchar Veteran Veteran

    Messages:
    297
    Likes Received:
    77
    First Language:
    English
    I meant an actual game, not a script, tho looking at SES Equip Level script that's another one that has levels start at 1.  Personally it just looks weird to have all equips that haven't leveled have +1 or LV 1 at the end of it's name.
     
    Try the following Base Script instead of the one in the opening post.
    https://drive.google.com/file/d/0BywhvOtY4_H9dmdKV0tlbDJybmc/view?usp=sharing

    Edit: Fixed an obvious error on my part, just updated.
     
    Last edited by a moderator: Nov 17, 2014
    #16
  17. BMASTER

    BMASTER Villager Member

    Messages:
    7
    Likes Received:
    1
    First Language:
    German
    Now I get an error on line 117:

    unexpected keyword_do, expecting keyword_end

    (@level.times - 1) do

    If this takes to much time, you don't need to do it. It's nothing major and I can explain that within my game just fine.
     
    Last edited by a moderator: Nov 17, 2014
    #17
  18. Selchar

    Selchar Veteran Veteran

    Messages:
    297
    Likes Received:
    77
    First Language:
    English
    Try grabbing it again, I made a rather obvious error when you grabbed it, the very line you copied.
     
    #18
    BMASTER likes this.
  19. BMASTER

    BMASTER Villager Member

    Messages:
    7
    Likes Received:
    1
    First Language:
    German
    Now it works. Really appreciate your work.

    Would it be much work to show Lv 1 behind the Items once picked up?

    Only if it's not too much trouble :D
     
    #19
  20. Selchar

    Selchar Veteran Veteran

    Messages:
    297
    Likes Received:
    77
    First Language:
    English
    Sorry for the delay, updated again to address with what I think you were referring to.
     
    #20
    BMASTER likes this.

Share This Page