As the title suggests, I've wanted to force Item Upgrades through Yanfly's Item Upgrade Plugin as I figured it would make the experience much more simple. Currently I've forgone item upgrades to just replace the weapons through chest interaction. But, if possible I'd prefer to upgrade them through an event.
MV Wishing to force item upgrades through Yanfly's Item Upgrade Plugin
Javascript/Plugin SupportMoved to: Plugin Support
Plugin Releases is for sharing plugins you have created.
Plugin Releases is for sharing plugins you have created.
You can use a script call to apply an upgrade item to an item.
Basically, replace 'item' with the actual item object you're upgrading, and replaced the $dataItems bit with the Id for the item upgrade item you want to use.
This will still use an upgrade slot on the item, so keep that in mind.
To use it in an event command, you'd have to figure out what item had just been given to the party. The $gameParty.weapons() or $gameParty.armors() function will return a list of all of the weapons or armors in the party's inventory, and the last one given is probably located in the last element of that array, so you could use something like $gameParty.weapons($gameParty.weapons().length-1) to get the most recent weapon.
Alternatively, you can use the above function with an <On Creation Eval> to automatically apply the upgrade item to an item as it is given to the party. You could paste something like the following onto an item:
If switch 1 is ON it will apply upgrade item 101 from the database to the item as it is given to the party. You can have multiple upgrade items, and different switches, and just paste the tags into whatever item you want too, which makes looting an upgraded item as easy as turning a switch on, giving the item, and turning the switch back off again.
ItemManager.checkIUSEffects(item, $dataItems[101])Basically, replace 'item' with the actual item object you're upgrading, and replaced the $dataItems bit with the Id for the item upgrade item you want to use.
This will still use an upgrade slot on the item, so keep that in mind.
To use it in an event command, you'd have to figure out what item had just been given to the party. The $gameParty.weapons() or $gameParty.armors() function will return a list of all of the weapons or armors in the party's inventory, and the last one given is probably located in the last element of that array, so you could use something like $gameParty.weapons($gameParty.weapons().length-1) to get the most recent weapon.
Alternatively, you can use the above function with an <On Creation Eval> to automatically apply the upgrade item to an item as it is given to the party. You could paste something like the following onto an item:
Code:
<On Creation Eval>
if ($gameSwitches.value(1)){
ItemManager.checkIUSEffects(item, $dataItems[101])
}
</On Creation Eval>
@ramza This is brilliant, I'll see about implementing this stuff. Follow up question, in regard to: ItemManager.checkIUSEffects(item, $dataItems[101]), If I wished to upgrade a weapon would it be for example: $dataWeapons[16],$dataItems[101])? Sorry if this is obvious.
@Shaz So sorry for posting incorrectly.
@Shaz So sorry for posting incorrectly.
If you're using it from the creation eval, 'item' is a standin for whatever item is being given, so you can just leave it as is.
If you're doing it from a script call in an event command, you need to use something similar to what I posted to get it to actually upgrade the item that was given to the party.
The code you've posted there specifies weapon 16 from the database as the weapon to be upgraded, and item 101 as the upgrade item, the problem is, weapon 16 is in the database, not in the player inventory, so upgrading it isn't likely to change anything (although it might change all instances of weapon 16 that the player already has, maybe).
You'd need to use $gameParty.weapons() in place of $dataWeapons. $gameParty.weapons() returns an array of all of the weapons in the party inventory (but not the ones that are equipped), and the last one in the array is the one that has most recently been picked up.
So you'd do an event command like the following:
◆Comment:Open chest
◆Change Weapons:Cane + 1
◆Script:var id = $gameParty.weapons().length
: :id -= 1
: :var item = $gameParty.weapons()[id]
: :ItemManager.checkIUSEffects(item, $dataItems[101])
The script command there is finding the location of the item it just gave the player in that array, then setting it as the weapon to be upgraded by the checkIUSEffects function.
Honestly, the on creation eval is probably the better route to go, since you can just turn a switch on to signify an upgrade should happen, and then turn it off after.
Original thread: https://forums.rpgmakerweb.com/threads/wishing-to-force-item-upgrades-through-yanflys-item-upgrade-plugin.132998/