Jump to content

Recommended Posts

My other thread apparently is not working so I think it's ok for me to repost this.

 

Upgradable Equipment 0.1

Introduction This script allows Equipment to be upgraded through a new gui. It was written in response to a request.

 

Features

- Equipment can now have its stats increased and have states applied to theem

- Success and fail rates for upgrading equipment which can be modified at runtime

 

Screenshots

 

 

old

 

 

GUI

upgequips1.png

 

 

Updated

GUI

upgequipstextmovedover.png

 

Notetag

examplenotetag2.png

Notetag

examplenotetag1.png

 

 

 

How to Use

 

 

To install the script place it below the materials section in your script editor. This script requires Tsuki-Custom Database and Numeric Form Regex to work.

You can now place notetags on items to use them as upgraders for equipment that you have marked as upgradable.

To mark a piece of equipment as upgradable use this notetag:

<Upgradable>

You can also specify a number like this:

<Upgradable14>

 

If no number is specified, the equipment will be able to have any number of upgrades applied to it. Otherwise, the equipment will only be able to have the specified number of upgrades applied to it before you can no longer upgrade it.

 

To make an upgradable item use these notetags:

 

<Mod STAT=5 +90>

 

<Mod STAT=8 +90%>

 

<Mod STAT=all +90%>

 

<Mod STATE=5 15%>

 

The numbers can be replaced by your own numbers and any + signs shown can be replaced by minus signs (a hyphen).

The number appearing after STAT= is the id number of the stat that will b modified when the item with this notetag is used as an upgrader.

The default stat values in ace are:

Max HP: 0 Max MP: 1 Attack Power: 2 Defense: 3 Magic Power: 4 Magic Defense: 5 Agility: 6 Luck: 7

 

The second number that appears is either the raw value that will be applied to the specified stat, or, if there is a percent sign following that stat it is the percentage that it will be increased by.

STAT= can also be followed by the word all in this case all stats will be modified according to the second number.

 

The second style of notetag uses the keyword state= the first number in this notetag is the state that will be applied to the armor or weapon, the second number is the percent chance that the state will be inflicted when the upgraded equipment is used.

 

There is also a failure system implemented if you do not want the player to be able to successfully upgrade their equipment each time they try. Modify the value DefaultFailRate inside the module Player inside the module EquipUpgrades to increase or decrease the players failure rate. The fail rate can be modified at runtime by accessing $game_player.fail_rate_for_upgrades

 

Update Sept 20, you can now correlate upgradable items and the upgraders that can be used on them to prevent certain upgraders from being used on certain items.

 

add this tag:

<Upgrader sheild>

 

to the item you want to use as an upgrader for a specific equipment ("sheild" can be replaced with any word). This upgrader will only be able to upgrade equips with the tag <Upgraded by sheild>

 

add this tag:

<Upgraded by sheild>

to the item you want to correlate with the upgrader ("sheild" can be replaced with any word, it should correspond to the item you want to be able to upgrade it).

 

These tags can be used multiple times on items/equips.

By default, if these tags aren't specified for the upgrader it will be able to be used on any equip, similarly by default, if these tags aren't used on the upgradable equipment it will be able to be upgraded by any upgrader.

 

 

 

Demo

Demo MOST RECENT -

 

 

Demo 0.7/0.8

Demo 0.6 - Updated script can now specify which upgrades are usable on which equips

Demo 0.5 - Bug fix Sept 3

Demo 0.4 - Updated Aug 29

Demo 0.3 - Fixed overlapping text

Demo 0.2 - Minor Bug fixes and the ability to restrict the amount of upgrades that can be applied to an equipment piece.

 

Script

Before installing the script you will need Tsuki-Custom_Database and Numeric Form Regex

both of those scripts should be placed above the Upgradable Equipment Script in your script editor.

 

Upgradable Equipment 0.1

 

Known Issues

Equipment deleted when game saved and then reloaded while it is equipped, I'm fixing this right now.

 

Credits and Thanks:

 

Chigoo - made the script request

Tsukihime - Custom Database

Eshra

Edited by eshra

Share this post


Link to post
Share on other sites

Looks cool. Does the script still have that overlapping text shown in the screenshot?

 

How easily do you think the script would be able to provide support for projects using individual equips?

It would likely require a compatibility patch in order to change all references to point to the specific equips, but then the next question is how much of the script assumes that the equips come from the database?

 

Since I've seen many equip scripts assume that the equips are stored a specific way and will access it as such. A simple example

 

def upgrade_weapon(weapon_id, ...)
end

 

And usually this weapon_id is the ID in the database.

Which means I have to overwrite the method, but then weapon_id isn't enough to identify a specific instance of the weapon either, so I would have to change the signature and change all of the methods that call it.

 

When it probably wouldn't hurt to just say

 

def upgrade_weapon(weapon, ...)
end

 

OR, better...

 

def get_weapon(...)
 # returns the appropriate weapon
end

def upgrade_weapon(weapon)
 # execute upgrade
end

Edited by Tsukihime

Share this post


Link to post
Share on other sites

Ok right, I see what you're getting at. The only time I found (after breifly skimming the code) that I was assuming the item was in the database (aside from loading notetags) was when I was using the gain_item method inside class Game_Party (this method gets the item's id and looks in the associated $data_(type) structure for the item).

 

Other than that, I added a method to the RPG::Weapon and RPG::Armor classes and am calling item.deep_copy_clone_2544 to get the actual object I'm going to be modifying:

 

def deep_copy_clone_2544
wep = Marshal.load(Marshal.dump(self))
wep.id = $data_weapons.size

wep.orig_name = @orig_name ? @orig_name : (@orig_name = wep.name)
wep.name = "Upgraded " + wep.orig_name + "(#{wep.id})"
wep.description = wep.description + " (Upgraded)"
$custom_weapons.push(wep)
$data_weapons.push(wep) # temporarily in data_weapons for use with methods
						# such as gain_item
wep
 end # End - deep_copy_clone_2544

 

When I'm upgrading the item I remove it from the party's inventory, then make a deep copy of it, then perform the actual upgrade, all references are made directly to the object I'm upgrading. So there shouldn't be too many compatibility issues.

 

Here's the upgrade method, the Scene has a field called @equipment_to_upgrade which is accessed directly to make the upgrade:

def perform_upgrade
# Check if the current upgrade is valid, if not then return
if @upgraders[0] == nil || !@equipment_to_upgrade.is_a?(RPG::EquipItem)
  turn_on_upgrades_selection
  return
end # End if

# Make a deep copy
@equipment_to_upgrade = @equipment_to_upgrade.deep_copy_clone_2544

r_val = rand(EquipUpgrades::Max::BaseRVal)
failed = 1+r_val <= $game_player.fail_rate_for_upgrades
modify_stats(failed)
add_new_features(13) unless failed# 13 is the default code for state features

set_player_animation(failed)
$game_party.gain_item(@equipment_to_upgrade, 1)
SceneManager.return
 end # End - perform_upgrade

 

(Updated the screenshots and code so that the text isn't overlapping anymore in the item list window)

Edited by eshra

Share this post


Link to post
Share on other sites

a little question. does this upgrading thing upgrades all the armor/ weapon with that name. for example:

i upgrade short sword to have poison state/increased its attack properties. then all short sword would have that upgrade?

if that so... any individual equipment script that compatible with this and yanfly script ? :D

 

or does this upgrade that only short sword and other not?

Share this post


Link to post
Share on other sites

a little question. does this upgrading thing upgrades all the armor/ weapon with that name. for example:

i upgrade short sword to have poison state/increased its attack properties. then all short sword would have that upgrade?

if that so... any individual equipment script that compatible with this and yanfly script ? :D

 

or does this upgrade that only short sword and other not?

 

The script will only upgrade the one equipment. I'll try my best to make it compatible with as many scripts as possible.

 

Very good and useful, I will need this in my game.

 

Awesome! I'm glad you like it :)

Share this post


Link to post
Share on other sites

The script will only upgrade the one equipment. I'll try my best to make it compatible with as many scripts as possible.

 

oh lol now I see why you're using the custom database. I'm guessing everytime you upgrade, you remove the old equip, create a new entry and add that to the party.

 

What about space-efficiency? You might end up with very large save files if you upgrade a lot.

 

So if I had like short sword --> short sword +1

That would create a new entry so that you can distinguish the generic short sword from this upgraded one.

 

What if I upgraded the new short sword to +2? Would you create a new entry?

Share this post


Link to post
Share on other sites

^Yeah it would add a new entry and I don't think I'm taking the old one out of the database either. I'll fix that. What's a better approach to this to conserve space?

 

Edit: I updated the script:

Updates

2012 Aug 29 - The name of an upgraded item has been changed to display how many upgrades have been used on it.

Bug Fixes

2012 Aug 29 - Upgraded equipment is now removed from the database when it is removed from the party's inventory

2012 Aug 29 - Text now fits correctly in the equipment selection options window

Edited by eshra

Share this post


Link to post
Share on other sites
:D keeping fingers crossed for the next update, to see if your adding the things i left out in the original request.

Share this post


Link to post
Share on other sites

Very nice script, but i do have one question.

Is there any way to make the items for upgrades to be specific ( ex : only weapons or only armors )?

I don't want to let the players to just insert attack upgrades in all their equipament, it would ruin the gameplay ( at least for what i have in mind ).

Share this post


Link to post
Share on other sites

Thank you very much then, i'll be waiting for it.

I have to say that from all the scripts that let you play around with weapons and armors, yours is the one that i like the most.

 

Edit:

 

I seem to get this error:

 

 

Error.png

 

 

 

I get this when i try to equip some of the armors. I was only testing this on weapons until now, so i did not notice this earlier. I have the scripts in the right order, and everithing works ok ( when upgrading weapons ), but as soon as i try to equip some armor ( be it bought from store, or found, or even the ones equiped on me, after i remove them ) i get that. It dose'nt seem to affect the number 1 from database armors tab though, i can equip that just fine.

Edited by VenomTDA

Share this post


Link to post
Share on other sites

Alright, sorry about the late reply, it should work now, I had misnamed the method as update_data_base_upg_equips.

 

Updated the script, you can now specify upgrades so that they can only be used on certain equipment:

 

add this tag:

<Upgrader sheild>

 

to the item you want to use as an upgrader for a specific equipment ("sheild" can be replaced with any word).

 

add this tag:

<Upgraded by sheild>

to the item you want to correlate with the upgrader ("sheild" can be replaced with any word, it should correspond to the item you want to be able to upgrade it)

 

These tags can be used multiple times on items/equips.

Edited by eshra

Share this post


Link to post
Share on other sites

No problem, take your time, and thank you.

 

Edit:

 

Yes, thank you for that. To be hones, i just noticed you upgraded the script., mostly because you edited yourr post, and there where no new one, and i was just expectin a new repky :).

But anyway, it works perfectly now, and thank you again.

Edited by VenomTDA

Share this post


Link to post
Share on other sites

This is pretty nifty script. ;)

 

how can I make it to where only certain NPC will allow certain weapons to be upgraded and to certain level so that way every blacksmith is unique on their own ways?

Share this post


Link to post
Share on other sites

I added the functionality you wanted, links are updated.

 

Use the script call:

ra_upg

 

to call the upgrade scene.

 

Use:

ra_upg(ARRAY)

-replace "ARRAY" with an array of strings. Each string should be an upgrader type-

to call the upgrade scene while restricting which upgraders can be used during the scene.

 

For example, if you had three upgrader items marked with three different notetags:

<upgrader shield>, <upgrader staff>, and <upgrader helmet>

 

and you only wanted upgraders that upgraded helmets and shields to be used during the upgrade scene you would use the script

call:

ra_upg(["shield","helmet"])

Chigoo had originally requested this functionality, I just never got around to doing it, sorry about that.

If it's not clear what I mean, see the demo. If you're not familiar with what an array is in ruby you can learn about them here.

 

If you need more room to define your array, define a constant inside of a module in a new script under the materials section and then just pass in that constant:

module LongerArray
 Data1 = ["Shield", "Staff", "Helmet", "Bracelet", "Ring", "Necklace", "Anklet"]
end

the script call would then look like:

ra_upg(LongerArray::Data1)

Share this post


Link to post
Share on other sites

Possible suggestion for this script as well.

 

I use some other scripts for my gear in my game. For example I use sockets on my gear. This is derived from the note box field. The copied item does not carry over anything from the note box. An example is I use <sockets: 3> in the note box for the original, but the upgraded item will not have sockets.

 

Is it possible to allow the copied item to copy over the note field instead of trying to find patches for several different scripts?

Share this post


Link to post
Share on other sites

Possible suggestion for this script as well.

 

I use some other scripts for my gear in my game. For example I use sockets on my gear. This is derived from the note box field. The copied item does not carry over anything from the note box. An example is I use <sockets: 3> in the note box for the original, but the upgraded item will not have sockets.

 

Is it possible to allow the copied item to copy over the note field instead of trying to find patches for several different scripts?

 

What's in the noteboxes is normally only relevant when the database is being loaded, the noteboxes usually aren't accessed after that so the problem is going to be something other than that. Send me a link to the socket script and I'll see if I can fix mine to work with it.

 

You can get the compatibility patch here .

Edited by eshra

Share this post


Link to post
Share on other sites

This is a fantastic script and it works wonderfully!

 

I do have a suggestion/request if you are looking to expand on it further. Right now, when you upgrade a weapon or piece of armor, it gets the "+1" "+2" etc suffix, so if you upgrade your Iron Sword with a Flame Rune (for example), it turns into Iron Sword +1. My suggestion/request would be to allow upgrade items to grant prefixes/suffixes using notetags. So if I take that Flame Rune and put something like <Suffix: Of Flames> then when a piece of equipment is upgraded with the Flame Rune, instead of being named Iron Sword +1 it would be Iron Sword Of Flames.

 

Just a thought :-) Great script no matter what! Thank you very much.

Share this post


Link to post
Share on other sites

This is a fantastic script and it works wonderfully!

 

I do have a suggestion/request if you are looking to expand on it further. Right now, when you upgrade a weapon or piece of armor, it gets the "+1" "+2" etc suffix, so if you upgrade your Iron Sword with a Flame Rune (for example), it turns into Iron Sword +1. My suggestion/request would be to allow upgrade items to grant prefixes/suffixes using notetags. So if I take that Flame Rune and put something like <Suffix: Of Flames> then when a piece of equipment is upgraded with the Flame Rune, instead of being named Iron Sword +1 it would be Iron Sword Of Flames.

 

Just a thought :-) Great script no matter what! Thank you very much.

 

I can also see something like this a nice addition to the script. I know you can personally go into the code and edit some of the string that is shown and concatenated together, but the ability to add this sounds like a nice polish.

Share this post


Link to post
Share on other sites

There was a pretty big bug in the script, I made a fix for it, updated several other scripts, and added the suffixes option.

<upg suffix ANYTHING>

 

Everything is updated on the blog (to keep all the links in one place).

 

I neatened up the documentation today as well, it was getting pretty messy.

Edited by eshra

Share this post


Link to post
Share on other sites

I've updated Custom Database and changed the custom arrays to hashes. It will likely affect your script.

 

EDIT: oh you have a backed up version on pastebin on your blog post. Then that's fine.

 

 

 

The only change you need to make is to change any references to $custom_ variables to the appropriate CustomData.add_ call (in your case, you would probably use add_weapon and add_armor).

 

For example,

 

old

def update_database_upg_equips(wep=nil)
  $custom_weapons.push(wep) unless !wep
  $data_weapons.push(wep) unless !wep # update database
end

new

 

def update_database_upg_equips(wep=nil)
  CustomData.add_weapon(wep) unless !wep
end

Fortunately all my script provided were those data structures so it should be a quick fix.

 

Edited by Tsukihime

Share this post


Link to post
Share on other sites

I've updated Custom Database and changed the custom arrays to hashes. It will likely affect your script.

 

EDIT: oh you have a backed up version on pastebin on your blog post. Then that's fine.

 

 

 

The only change you need to make is to change any references to $custom_ variables to the appropriate CustomData.add_ call (in your case, you would probably use add_weapon and add_armor).

 

For example,

 

old

def update_database_upg_equips(wep=nil)
  $custom_weapons.push(wep) unless !wep
  $data_weapons.push(wep) unless !wep # update database
end
new

 

def update_database_upg_equips(wep=nil)
  CustomData.add_weapon(wep) unless !wep
end
Fortunately all my script provided were those data structures so it should be a quick fix.

 

Lol :) my bad I'm lazy. I hope you don't mind I'm linking to an older version of the script. I'll probably get around to updating things one day.

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.

×