BUGMENOT'S PROFILE

Search

Filter

[Rm2k3] Best way to make a variable-comparing calculation?

author=s_w
but this line
<> Change Variable: [0501:TOrder_1st] - 384
Why is this necessary (-384)?
If you have listed all the SPEED values after Var[0385], this will get the participant_ID / Battler_ID that belongs to the referenced SPD value. Yes, to show the player what moves next. In hindsight... this would lead to something like a "global turn" in which the fastest battler would get another turn after everyone else already did. Then the next global turn starts.


author=s_w
I just need to change the "greater" comparison to "lower" right?
Yes. Or lower/equal to not have A be considered slower than E if their SPD is the same (prioritize the player).

author=s_w
Your code is amazing.
Nah. It's just simple. And it does not seem to help making a smooth turn order.

author=s_w
how to create similar battle system like Grandia
Haven't played Grandia, yet.

author=s_w
" ACT gauge" based on character's speed, but since the value varies the icon would probably jump
A solution might be to get the average SPD of everyone participating (everyone still alive, that is) in battle and basing the increase in a battler's "ACT gauge" on the quotient of battlerSPD x100 divided by AvgSPD x10 getting a decimal value times 10 (or else there would only be 0|1|2 ...)

SPD(A) = 10
SPD(B) = 8
SPD(C) = 9
SPD(D) = 8
SPD(all) = 35
AvgSPD(x10) = SPD(all) x10 /4
AvgSPD(x10) = 350 /4
AvgSPD(x10) = 88 (the decimal would be AvgSPD = 8.75)

So in an ACT+ cycle (every 0.5 second or so):
ACT+(A) = SPD(A) x100 / AvgSPD(x10)
ACT+(A) = 1000 / 88 = 11 (= 1.1 times faster than the average)
... and so on. Adding ACT+ to someone's ACT value.

Let's say someone gets a turn when their ACT value reaches 100. It would take up to 10 seconds + turn execution time until someone that's half as fast as the average has its turn. It might be a good idea to have the ACT+ increased by an additional x2.0 when nobody has an ACT value above 40(%) so it's faster. Increase ACT+ by x1.5 when noone's above 60%. Factor x1.0 when someone's above 80%.
That's where the sorting FUNCTION can help (getting the highest ACT value). And it can be used to get the participant that is the furthest down the shared "ACT gauge" to highlight its icon or whatever.


That's just an idea. And it sure needs work.

edit:
As it is, low SPD against high SPD will not get sufficient turns... maybe have the amount at which the ACT value is filled be somewhat logarithmic:
SPD = 1 = 10 ACT+
SPD = 2 = 15 ACT+
SPD = 3 = 19 ACT+
SPD = 4 = 22 ACT+
SPD = 5 = 24 ACT+
...
SPD = 8 = 28 ACT+
SPD = 9 = 29 ACT+
SPD = 10 = 30 ACT+
(Or the other way around, meaning that the higher the SPD the more ACT will be filled. You did say that there are abilities that lower SPD, so it would have a bigger effect on fast enemies/allies when shot in the foot (or what can be considered a foot) whereas the slow 'n' steady units will more ore less shrug it off.)


Or add +3 to SPD before calculating the AvgSPD to avoid B getting a turn after A finally had 9 turns in case of:
A : 10 SPD +3
B : 1 SPD +3
So that it's 2 or 3 turns.

[Rm2k3] Best way to make a variable-comparing calculation?

author=s_w
Also, RMXP can't do this VarA=VarB?
You'd have to know some Ruby or someone that knows Ruby to get that working. (Probably... dunno)
Also, it's about getting a variable_ID into VarB so VarA is set to the contents of the variable that is referenced in VarB.


author=s_w
I am still trying to understand how it works.
Sorry. I need to up my software documentation skills.

Let's go by the Var_IDs I stated in my first post here (you can, of course, change them). Let's say you have your participants' SPEED values in Var[0385] to Var[0394] and only 3 participants in battle:

A = Var[0385] = 10
B = Var[0386] = 8
C = Var[0387] = 9
D = Var[0388] = 0
...
K = Var[0394] = 0

Var[0021:VC_ID_First/Now] should be set to the first variable that has to be considered (= 385 in this example) and Var[0022:VC_ID_Last] should be set to the last variable (= 387 in this example).
That's why it might be a better idea to assign 'ID_First/Now' and 'ID_Last' before calling the CallEvent / function.
Yes, the event code cycles through the variables from 'ID_First/Now' up to 'ID_Last' and only memorizes a variable_ID if its value is higher than the previously memorized one.


1. You set 'ID_First/Now' and 'ID_Last' (to refer to where any values that you want to get the highest value from are stored in variables).

2. You call the Event with the VarCheck FUNCTION (either CommonEvent or MapEvent if on a CBS map).

3. The result gets written into Var[0023:VC_ID_Memory], which states the variable that contains the highest value amidst 'ID_First/Now' and 'ID_Last' (= 385 in this example).

4. You have your turn order in, for example, Var[0501] and the consecutive variables. You make a
<> Change Variable: [0501:TOrder_1st] = V[0023]
<> Change Variable: [0501:TOrder_1st] - 384
So Var[0501:TOrder_1st] = 1(A)

5. To get the next highest number you have to knock the already tested values out of the system by multiplying the variable that is referenced in Var[0023:VC_ID_Memory] by -1.

6. 'ID_First/Now' and 'ID_Last' stay the same as in step 1. and you call the Event with the VarCheck FUNCTION again, which outputs 387 in Var[0023:VC_ID_Memory] this time.

7.
<> Change Variable: [0502:TOrder_2nd] = V[0023]
<> Change Variable: [0502:TOrder_2nd] - 384
So Var[0502:TOrder_2nd] = 3(C)

8. Multiply the variable referenced in Var[0023] by -1, and rinse and repeat until you get to the last participant.

X. Multiply every variable in the range between 'ID_First/Now' and 'ID_Last' by -1 to get back to the initial SPEED values, so you can work with them normally again.


Bear in mind that this event code FUNCTION thingy considers only positive values.
(you would have to change the first conditional branch after the <Label> to ask for another digital cue... for example if a value is still within -1.000.000 and +1.000.000 when working with 6 digit numbers... marking negative numbers by reducing them by 1.000.000 and marking positive numbers by adding 1.000.000 to them. Like, thinking up an easy way to make variables into pseudo-booleans without making it too complicated (like comparing it with what's already in the TOrder list))

author=s_w
when I got the highest value, which say, var3 = [9]
I just multiply it by -1 so it becomes -9, and gets ignored?
Indeed. Reusable and revertable (instead of wasting other variables to make backups of values to work with 'em)

Likewise you can use this to ignore variables beforehand that interrupt the range of values you want to test (for example you have the participants stats not ordered as "SPD(A) SPD(B) SPD(C) ..." but in a sequence of "ATK(A) DEF(A) SPD(A) ATK(B) ...")

RM2K3 Crashes when i use item!! O_O

Delete the "dynrpg_normal_skill_window_duration.ips" in the folder DynPatches. It's already integrated into the recent versions of DynRPG (0.20 if not earlier).

[Rm2k3] Best way to make a variable-comparing calculation?

author=NeverSilent
With a maximum number of 10 partcipants in battle, you will have to set up at least 200 Conditional Branches
Bollocks. I say 3.

If there is no sorting FUNCTION, you make one (as a CallEvent):

<> Comment: VarCheck FUNCTION
<> Change Variable: [0021:VC_ID_First/Now] = 1
<> Change Variable: [0022:VC_ID_Last] = 10
<> Change Variable: [0023:VC_ID_Memory] = V[0021]
<> Label: 1
<> Change Variable: [0024:VC_Value] = Var[V[0021]] value
<> Fork Condition: If Variable [0024:VC_Value] is 0 or more
<> Comment: Variables with negative values are ignored.
<> Change Variable: [0025:VC_Temp] = Var[V[0023]] value
<> Fork Condition: If Variable [0024:VC_Value] is V[0025] greater
<> Comment: Memorize new Var_ID if the value is higher than the highest
: memorized value.
<> Change Variable: [0023:VC_ID_Memory] = V[0021]
<>
: End
<>
: End
<> Fork Condition: If Variable [0021:VC_ID_First/Now] not V[0022]
<> Change Variable: [0021:VC_ID_First/Now] + 1
<> Jump To Label: 1
<> Comment: FUNCTION loops from Var_ID_First/Now to Var_ID_Last.
<>
: End
<> Change Variable: [0025:VC_Temp] = Var[V[0023]] value
<> Show Message: The highest value of \v[0025] is in Variable No. \v[0023].
You could also delete

<> Change Variable: [0021:VC_ID_First/Now] = 1
<> Change Variable: [0022:VC_ID_Last] = 10
from the CallEvent and assign those values before calling the CallEvent.




This picks the highest number (if equal, it's prioritizing participants with a lower ID) out of a range of values stored in variables referenced by Var[0021:VC_ID_First/Now] (participant A) and Var[0022:VC_ID_Last] (participant XYZ).

You can use this to make a list of turn orders by taking the participant_ID from Var[0023], put it into your list, go one position down your list, multiplying Var[V[0023]] by -1 (that 'marks' the participant as 'ignore me' in the sorting function and can be easily reverted by multiplying every participants SPEED value by -1 when all the sorting was done.) and calling the sorting function again, getting the next highest number (while ignoring the marked values).

Or just go turn-by-turn (sort once -> do turn -> sort next turn) without a list of turn orders (if turn order is not shown).


edit:
To reduce lag: AntiLagSwitch

+++ DynRPG - The RM2k3 Plugin SDK +++

You would have to tinker a bit with the names of the menu options/commands and assign the desired choice (of whatever goes after an option menu) to the last position (by use of the MenuManipulator).

[QuickPatches]
IndentEnd=476D9E,7F,4A24D1,50,4A24D6,83E80039C20F840B020000,4A24D8,%1

Quit is at the 1st position (from the bottom) by default. So just change the number after the %

+++ DynRPG - The RM2k3 Plugin SDK +++

+disengaging vacation mode+
Awfully quiet here...


author=GhostRider
Is there no way at all to move the "Quit" option from the last spot?

To what position?


Or are you talking about removing?
[QuickPatches]
NoEnd=4A0FE8,90,4A24D9,909090909090


Or replacing it? Pepsi's QuitSwitch Plugin allows for other stuff/menus to be opened up instead.

PepsiOtaku's DynRPG Plugin Emporium!

I know that you mean this.

What I didn't get was why you needed to mention it in a formula that you wanted to be changed - to which you did not mention Int as that "pseudo magic def" - and things got out of hand. Now there's a giant picture above my post.

Interpreted your words as "can I have a proper 'armor pierce' in my game".
Sorry.

PepsiOtaku's DynRPG Plugin Emporium!

I still don't get what you mean by "- Target defence (if unchecked)." Was that just default stuff you mentioned that didn't require any changes?

Or do you mean that this should only apply to physical defense (if the AtkMod is above 0) instead of both phys.defense and magic defense?

[QuickPatches]
IgnorePhysDefense=4C0E0D,15

And keep in mind, that "magic defense" as it is in the code of the rpg maker is not a reduction of damage caused purely by the Int stat but a reduction of the total damage.

So with your Def(target) divisor set to #2 and the Int(target) divisor set to #1 the "magic defense" may thwart the attacker's Atk stat on a Skill with AtkMod=1 IntMod=1 if the target has high enough of an Int stat (much higher than the Skill user's Atk stat).

PepsiOtaku's DynRPG Plugin Emporium!

author=bulmabriefs144
(Int score x Int Modifier) + (Str score x Str modifier) + Skill Damage - Target defence (if unchecked).
What? Having those atk/int influence sliders be whole numbers?
And what do you mean "if unchecked"?

Okay, the default damage formula for skills is:
[QuickPatches]
SkillDmgRevamp=4C0DE4,#20,4C0DF8,#40,4C0E1A,#40,4C0E2F,#80
Which equals to:
[1/1]EffectRating +
( [1/20]Str(user) - [1/40]Def(target) ) x Atk Influence +
( [1/40]Int(user) - [1/80]Int(target) ) x Int Influence


So to get your damage formula (Int x IntMod) + (Str x StrMod) + EffectRating - Def
...you'd just have to set the divisors to 1, no?
[QuickPatches]
SkillDmgRevamp=4C0DE4,#1,4C0DF8,#1,4C0E1A,#1,4C0E2F,#1


Magic defense is already based on int. Where did you get that thing with agi from? Or do you want the agi stat to be considered as MagicDef?

+++ DynRPG - The RM2k3 Plugin SDK +++

He meant battle animations. Not battler sprites.

Something like this:
download BattleAnimationPointer