SolemnDream

Veteran
Veteran
Joined
Jan 15, 2016
Messages
81
Reaction score
4
First Language
English
Primarily Uses
Hiya! I am trying to set up a buff/debuff system that emulates Pokémon Gen VI. I don't think I'll need a script for this if I use a combination of states and variables, but we'll see.


In the following large spoiler tag, I explain what I'm trying to do, the overall goal. However, it can be a bit overwhelming; and since I already figured out some of how it works, you can skip the rest of this post and go down a few if you want, where I'll be asking how to do specific things towards the larger goal. You can still read the spoiler though if you want to see the bigger picture.

So imagine you have a scale like this, one for each of the following stats: ATK, DEF, MAT, MDF, and AGI.

Code:
-6    -5    -4    -3    -2    -1    +0    +1    +2    +3    +4    +5    +6
 |-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|
2/8   2/7   2/6   2/5   2/4   2/3   2/2   3/2   4/2   5/2   6/2   7/2   8/2

As well as one more scale like this, shared for HIT and EVA:

Code:
-6    -5    -4    -3    -2    -1    +0    +1    +2    +3    +4    +5    +6
 |-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|
3/9   3/8   3/7   3/6   3/5   3/4   3/3   4/3   5/3   6/3   7/3   8/3   9/3



We're going to use HIT vs. EVA for our example, which is the bottom of the two scales. Let's pretend the HIT and EVA percentage options that are built into the database don't exist for a second, just to avoid confusion.


Instead, just look at the bottom scale above and imagine an "accuracy" marker at +0. That is where it starts at the beginning of every battle. (Below +0 on the scale is the fraction 3/3, determining a 100% accuracy.) Then if someone buffs the user's HIT, the marker goes up the scale to +1. If they buff HIT again, it goes up to +2, and so on. EVA basically makes the marker go the opposite direction. If the scale is up to +2 due to the aforementioned buffs, then buffing the enemy's EVA once would bring it back down on the scale to +1. Then if EVA is buffed again, it goes back down to +0. And so on. So basically we're sliding a marker up and down the scale every time a particular stat is buffed or debuffed-- although it should be noted that HIT and EVA use the same scale.


So now that that is visualized, we can calculate the accuracy of a skill as such: "Skill's Success %" times "whatever fraction is below the current point on the scale". So if we started at +0 and had two EVA buffs, we'd be down on the scale to -2; and the fraction listed below that is 3/5, which would mean the chance of successfully hitting with a Skill with a Success % of 100 would be 100% * 3/5, which equals 60%.


It appears I will need two separate scale types-- one type for shared HIT and EVA, and one type for the other stats.


So first things first-- how much of this is doable with just a combination of states, skills, and/or variables? If I can avoid a script, I will try to do so so I can maximize compatibility chances and future-proofing, as well as flexibility and user-friendliness to people who are not me. Also, while there are two Pokémon engines out there already, I am making a very different kind of game; and also the scripts those engines use are not plug-and-play.



Thanks a bunch for any support!
 
Last edited by a moderator:

Chaos17

Dreamer
Veteran
Joined
Mar 13, 2012
Messages
1,318
Reaction score
492
First Language
French
Edit : sorry, I confused with Rpg maker Mv, ignore me please.
 
Last edited by a moderator:

SolemnDream

Veteran
Veteran
Joined
Jan 15, 2016
Messages
81
Reaction score
4
First Language
English
Primarily Uses
Alright, I've been trying to do it through variables; but in the event, I can't select the state to be applied to the target-- only an actor or a variable.


What I want to try now is some way for a skill to check if a state is active on the target, and if it is, to remove it and apply a new state. And if a different state is applied, then it would remove THAT state and apply a different new state. Is that possible?


Update! What if I put this as the damage formula? Say I'm using a Skill that is supposed to decrease ATK by 1 stage (point on the scale) per use. "State 113" is ATK stage +6. "State 112" is ATK stage +5. Etc. Will this work?


Basically it's supposed to be "if target has state 113, remove state 113 and apply state 112". If not, move onto the next state check.

Code:
damage_formula:
b.state?(113) b.remove_state(113) b.state(112);
b.state?(112) b.remove_state(112) b.state(111);
b.state?(111) b.remove_state(111) b.state(110)

And on up to state 101.


Second update!


This isn't working. The idea is basically, if target has state A, remove state A and apply state B. What am I doing wrong?

Code:
damage_formula:
if (b.isStateAffected(113)) b.remove_state(113); b.addState(112);
else if (b.isStateAffected(112)) b.remove_state(112); b.addState(111);
else if (b.isStateAffected(111)) b.remove_state(111); b.addState(110);
else if (b.isStateAffected(110)) b.remove_state(110); b.addState(109);
else if (b.isStateAffected(109)) b.remove_state(109); b.addState(108);
else if (b.isStateAffected(108)) b.remove_state(108); b.addState(107);
else if (b.isStateAffected(107)) b.remove_state(107); b.addState(106);
else if (b.isStateAffected(106)) b.remove_state(106); b.addState(105);
else if (b.isStateAffected(105)) b.remove_state(105); b.addState(104);
else if (b.isStateAffected(104)) b.remove_state(104); b.addState(103);
else if (b.isStateAffected(103)) b.remove_state(103); b.addState(102);
else if (b.isStateAffected(102)) b.remove_state(102); b.addState(101);
 
Last edited by a moderator:

SolemnDream

Veteran
Veteran
Joined
Jan 15, 2016
Messages
81
Reaction score
4
First Language
English
Primarily Uses
Alright, it's been 72 hours and I've updated. It's okay for me to bump, if I read the rules right!
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
608
Reaction score
320
First Language
German
Primarily Uses
Hi there,


You should use  b.state?(n)  instead of  b.isStateAffected(n). The latter is only used in the RPG Maker MV and not defined in VXAce by default.


Also, Ruby requires you to close your "if" statements with an "end":


if b.state?(113)


  ...


else


  ...


end


You can use "elsif" instead of "else if" to create a series of cases. Otherwise you would have to add an "end" for each "if" used:


if b.state?(113)


  ...


elsif b.state?(112)


  ...


elsif b.state?(111)


  ...


end
 

SolemnDream

Veteran
Veteran
Joined
Jan 15, 2016
Messages
81
Reaction score
4
First Language
English
Primarily Uses
Alright, it's been 72 hours and I want to say I still haven't gotten it working. Here's my damage formula:


damage_formula:
if b.state?(313); b.remove_state(313); b.addState(312)
elseif b.state?(312); b.remove_state(312); b.addState(311)
elseif b.state?(311); b.remove_state(311); b.addState(310)
elseif b.state?(310); b.remove_state(310); b.addState(309)
elseif b.state?(309); b.remove_state(309); b.addState(308)
elseif b.state?(308); b.remove_state(308); b.addState(307)
elseif b.state?(307); b.remove_state(307); b.addState(306)
elseif b.state?(306); b.remove_state(306); b.addState(305)
elseif b.state?(305); b.remove_state(305); b.addState(304)
elseif b.state?(304); b.remove_state(304); b.addState(303)
elseif b.state?(303); b.remove_state(303); b.addState(302)
elseif b.state?(302); b.remove_state(302); b.addState(301)
end




"If enemy is in this state, remove that state and add a different state." I used an icon to show when states are supposed to change, but no states change. It just doesn't work!


I'm using no gameplay-affecting scripts except one to add levels to enemies.


Update: After getting support from another board, it turns out it's "elsif" instead of "elseif" and it's "add_state" instead of "addState". Figured it out!
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

I'm so annoyed with myself...I can't get this code to work so it looks like I'm going the plugin route for a problem I should be able to do myself :kaolivid:Great. Now I get to murder save file compatibility. Again.
Can't believe my code from four years ago is still working! Did some expansions, and...
1635194553179.png
In related news, I may have an update for my old Extra status window plugin ready. That is, once I manage to sit down and update the documentation... and the demo project... :kaoswt:
How does one pronounce Godot? I've heard it pronounced a couple of different ways, and I genuinely don't know the proper way.
March 2020 ...
1635188823939.jpeg
... vs October 2021
You look like you had a rough day...Here, have a Baby Panda!

Forum statistics

Threads
116,077
Messages
1,095,542
Members
151,441
Latest member
guertena_1
Top