Okay...that's a bit more legible.
in ffxi they have armors/gears that charges on them that cna be used (basicly skill on them that have a limited number of uses)
You have to realize that what
you interpret as "items with basically a skill on them" is, in RPG Maker,
not the same as a skill. If you want an item that's going to be used via the equip menu, you're programming an item, not a skill.
And in RPG Maker, unless you're using a plugin I'm not familiar with, you can't activate items that you equip, only Items from your inventory (like potions). So you can call it a ring, but that might be confusing to your players because you can't equip it like an accessory or whatever slots you have.
You could work around this by making it an Armor. This also allows you to work around one of the big flaws in your plan, which is that states go away when an actor dies - so getting knocked out in combat would remove your extra experience state, regardless of how much they've earned.
If it's actually an item that you can equip, then that item can grant a passive state.
in this case a ring that incresses xp by double for 10,000 xp per use on the charge after you gain 10,000 the effect gained from the skill is then removed
Okay, I understand what you want. Now what you're trying to do is not simple, because the plugins that have to do with states don't have any way to track when experience is received. So you're either going to get into more complicated stuff and make an entire, small plugin just for this one item, or you're going to change some stuff.
I strongly suggest you take away the using the item (because you can't use it and also be able to wear it), and the charges idea, and just say wearing the ring gives 200% experience to the person, to a total of 10,000 across all wearers.
So make your ring. Make a state that has the EXP *200% Trait.
In the ring, using Yanfly's Auto Passive States, give it the
<Passive State: x>
notetag using the ID of your state.
Now the jury-rigging part. You're going to have to make two events. One goes near the beginning of your game, autoruns, and sets a variable to 0 (I'll call it var1, because you need two more later), then sets a self switch. The second page, with the condition of that self switch, is blank.
Then you make an event that you copy onto every single map in your game where you can possibly have battles.
Stick it someplace innocuous and set it to Autorun. In the event, enter a Script command that says:
Code:
var ringBearer = $gameParty.members().find(member => member.isStateAffected(stateId));
if (ringBearer) {
$gameVariables.setValue(var3, ringBearer.currentExp());
if ($gameVariables.value(var2)==undefined)
$gameVariables.setValue(var2, ringBearer.currentExp());
if ($gameVariables.value(var3)>$gameVariables.value(var2)) {
$gameVariables.setValue(var1, $gameVariables.value(var1)+Math.round($gameVariables.value(var3)-$gameVariables.value(var2)/2));
$gameVariables.setValue(var2, $gameVariables.value(var3));
if ($gameVariables.value(var1)>=10000) {
$gameParty.loseItem($dataItems[ringId], 1, true);
$gameSwitches.setValue(switchId, true);
$gameVariables.setValue(var2, undefined);
}
}
}
where you replace all var1, var2, var3 instances with the appropriate variable IDs, ringId with the item ID of your ring, and switchId with the ID of an unused switch. Then:
Conditional Branch -> switchId is ON
- Show Text "Your ring crumbles into dust!"
- Control Switch -> switchId -> OFF
Erase Event
Then you make an event that will go into all of your troops (you can use Yanfly Base Troop Events to help with this), set to a condition of Turn 0. Enter a Script command:
so thats why i have the ring with a skill on it with limted uses. and the skill just adds a stat to the player that incresses the XP gained by double - part im having issue with is removing that stat after you gain 10,000 XP then you have to use the skill on the ring again and repeat this till you have no charges left and then have to get a new ring
and no i messed up with that i want it to only target a single person so that each charector will need a ring
Code:
var ringBearer = $gameParty.members().find(member => member.isStateAffected(stateId));
if (ringBearer)
$gameVariables.setValue(var2, ringBearer.currentExp());
As you can see, quite complex. Maybe someone else will have a different idea, what that's the method that came to me. The upsides to this are you don't have to screw around with charges or activating the item, just equip the ring and that actor will gain double experience while it's on.
The downsides are...it can't stop the person from going over 10,000 bonus experience. However much they gain in that last fight is what they get. It also can't handle more than one ring at a time. It should work correctly if you give a second ring later and reset var1 to 0, but if you allow two rings at once they'll both count toward the same limit.
To get around those downsides, as best I can think right now, you would have to commission a plugin with code that actually ties into the gainExp function and uses Yanfly's independent items.