Tray

Villager
Member
Joined
Sep 7, 2018
Messages
22
Reaction score
6
First Language
English
Primarily Uses
RMMV
soo trying to make a exp ring with charges like from ffxi.

there might be a better way but so far what ive got is - I used yanfly limited skill uses and just added the EXP skill to the ring that works fine charges run out and have to get a new ring. the skill adds a state effect that increases the xp. what I'm having issues with is tracking the xp and removing the state

id like the effect to only last for like 10,000 xp then remove i know this is done with variables but cant seem to get it to work properly XD sorry for the trouble again. trying to learn >.<
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,971
Reaction score
3,160
First Language
English
Primarily Uses
RMMV
It would be more helpful if you showed the code that you already have, then we could tell you how to modify it.
 

Tray

Villager
Member
Joined
Sep 7, 2018
Messages
22
Reaction score
6
First Language
English
Primarily Uses
RMMV
It would be more helpful if you showed the code that you already have, then we could tell you how to modify it.
sorry.

i just up a skill named - Trainers Ring
sat it to its own skill type
scope - all allies
occasion - always
everything else is just default or off

in effects it runs a common event

note tag has the yanfly limited skill uses set up to be used 7 times

in the common event i have the variable to set xp to the user after that blank atm cause I've been messing with it trying to get it to work xD i don't know how to get the variable to track the 10,000 XP added to what the user already has i know that part would be put into a conditional branch so that once the 10,000 xp was gained it removes the state i just don't know how to work the variables to get it to work XD
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,971
Reaction score
3,160
First Language
English
Primarily Uses
RMMV
I am still having an awfully hard time trying to figure out exactly what you want to happen.

In different places, you say:
scope - all allies
then
i have the variable to set xp to the user
So is it giving experience to everyone or to just the user? And if it's a ring, an actual item that you get, why are you setting it up as a skill?
once the 10,000 xp was gained it removes the state
What state? Why do you have a state, and what is it doing?

You need to slow down and in concise, proper English, with sentences, describe what you want to do. Not everyone has played Final Fantasy XI, so just tell us what you're trying to accomplish, because this explanation was not helpful at all :stickytongue:

I mean, the very best I can figure out from what you're saying, it should be basic math - you have this thing with 7 charges, so each one gives 1,429 EXP.

After 7 charges have been used that's just over 10,000 EXP (because the kind of random 7 charges doesn't divide equally...you can easily choose a number which does).
 

Tray

Villager
Member
Joined
Sep 7, 2018
Messages
22
Reaction score
6
First Language
English
Primarily Uses
RMMV
@ATT_Turan sorry >.< im not very good with eplanning

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) 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

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
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,971
Reaction score
3,160
First Language
English
Primarily Uses
RMMV
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.
 

Tray

Villager
Member
Joined
Sep 7, 2018
Messages
22
Reaction score
6
First Language
English
Primarily Uses
RMMV
@ATT_Turan again i can't thank you enough for all the help you have given.

ok so an issue. the script command doesn't allow enough space for it all to be placed it cuts off just after the last undefined so the brackets Arnt there

again thank you so much
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,971
Reaction score
3,160
First Language
English
Primarily Uses
RMMV
Just delete the line breaks until it fits.
 

Tray

Villager
Member
Joined
Sep 7, 2018
Messages
22
Reaction score
6
First Language
English
Primarily Uses
RMMV
@ATT_Turan

im sorry to keep bugging you xD but i still cant get it to work im not sure if i missed something or not or did something wrong so

i used var 4, 5, 6 i made the 2 events

Event 1 - Var 4 = con 0
self switch A on

then on 2nd page instead of leaving it blank i sat up the condition to reset the var 4 back to 0 so it can be repeated after the ring was destoryed

If switch 413 is on
Self switch A off

then for the 2nd event


Code:
var ringBearer = $gameParty.members().find(member => member.isStateAffected(15));
if (ringBearer) {   
        $gameVariables.setValue(var6, ringBearer.currentExp());
    if ($gameVariables.value(var5)==undefined) $gameVariables.setValue(var5, ringBearer.currentExp());
    if ($gameVariables.value(var6)>$gameVariables.value(var5)) {
        $gameVariables.setValue(var4, $gameVariables.value(var4)+Math.round($gameVariables.value(var6)-$gameVariables.value(var5)/2));
        $gameVariables.setValue(var5, $gameVariables.value(var6));
        if ($gameVariables.value(var4)>=100) {
            $gameParty.loseItem($dataItems[6], 1, true);
            $gameSwitches.setValue(413, true);
            $gameVariables.setValue(var5, undefined);
        }}}
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,971
Reaction score
3,160
First Language
English
Primarily Uses
RMMV
i still cant get it to work
I feel like we've been through this before. And if I'm wrong, and I'm confusing you with another user, then I apologize. But that feedback is useless. What does "can't get it to work" mean? Do you not get the double experience while wearing the ring? Does it not break after you've earned enough experience? Does the game crash and there's an error? What doesn't work?
then on 2nd page instead of leaving it blank i sat up the condition to reset the var 4 back to 0 so it can be repeated after the ring was destoryed
I don't see how that's useful. How are you going to make sure the player goes back to that map to repeat the event? Or did you make it into a common event?

Also, if you followed my instructions, you're going to be turning the switch on and then immediately off again within the same event, it will never be on long enough to trigger anything else.
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
6,003
Reaction score
2,347
First Language
Dutch
Primarily Uses
RMMV
@Tray here is a usefull tip on scriptcalls.

if a scriptcall is larger than 11 lines, place it in a JS file or .txt to read the code better,
ingame, make it 1-3 lines long and it works.

if you ever need to change something, alter it in the txt file or js file, after altering it,
make it a 1-3 liner and copy paste it.

as height of lines is 11, the lenght of the line is unlimited (so far I know).
 

Tray

Villager
Member
Joined
Sep 7, 2018
Messages
22
Reaction score
6
First Language
English
Primarily Uses
RMMV
@ATT_Turan

again sorry and no I'm pretty sure it was me

i never got to test the switch but now that you pointed that out yeah that wouldn't work anyway XD

but what's not working is the 2nd event. the ring does increase the exp as its suppose to. but once it reach`s the 100 xp (sat to 100 to test) it doesn't break and remove like its suppose to it just keeps going

@ShadowDragon

thank you im still pretty new to JavaScript sure that's obvious at this point XD this is the first thing that's required more then 1 line to achieve soo sorry if this should be more simple then im making it >.<
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,971
Reaction score
3,160
First Language
English
Primarily Uses
RMMV
Well, troubleshoot it.

If you press F8 and go to the Console tab while play testing, are there any errors?

Put an NPC on your map and when you talk to him have him tell you the current value of whatever variable ID you put in for var1, see if that's being properly tracked.
 

Tray

Villager
Member
Joined
Sep 7, 2018
Messages
22
Reaction score
6
First Language
English
Primarily Uses
RMMV
@ATT_Turan

nothing showed up in f8

and as for the var it just stays at 0
i also tryed var 3 which is suppose to keep track of the total exp it stays at 0 too
 

Latest Threads

Latest Posts

Latest Profile Posts

Coin Locker title screen:
Still in progress...

Screenshot_134.png
the girls.png
So, these are all the girls of the party =3 (beside the protagonist if you play as a female.)
Now, I just have one more character sheet of the guys left and I'm done with their presentations =3
Can you recognize where this area is from? :kaocry:
Mq9QM3h.png
For those with up to 9 elements of magic; how do you structure your database. By element? Or by what is offensive vs supportive spells?
would anyone here be interested in rough concept art for the main protagonist of my game that might get changed later? :kaoswt2:

Forum statistics

Threads
124,442
Messages
1,163,677
Members
163,256
Latest member
onbetltd
Top