Manipulating Parameter and Element Rate without using traits or states

KimiRaven

Veteran
Veteran
Joined
Sep 26, 2016
Messages
44
Reaction score
17
First Language
English
Primarily Uses
RMMV
Hello there! I am working in something that allow the player to choose a buff during game start, i have done successfully for the ex and sp parameter, but getting stuck on the normal parameter (MaxHP, Agility, so on...) and element rate. Thing is, I want to make them dynamically change as in at level 1, 100 hp will get 20% buff so it goes 120 and level 2, 200 hp will goes 240 hp. For element rate, choosing which element the player will get damage reduction it.

I know I can place a states but is there any other way without using it?

Please and thank you..
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,932
Reaction score
3,161
First Language
English
Primarily Uses
RMMZ
Well you can get a dynamic 20% HP buff just by giving them a Max HP - 120% trait. But are you saying you want the player to choose what the trait is so that's why you can't put it in the database directly?
 

KimiRaven

Veteran
Veteran
Joined
Sep 26, 2016
Messages
44
Reaction score
17
First Language
English
Primarily Uses
RMMV
Well you can get a dynamic 20% HP buff just by giving them a Max HP - 120% trait. But are you saying you want the player to choose what the trait is so that's why you can't put it in the database directly?

Yes, that's the plan. I am getting stuck on this for few hours. If I am out of option might as well place the buff, but if there's any idea how to do without it i be grateful
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,932
Reaction score
3,161
First Language
English
Primarily Uses
RMMZ
If you want to add a trait to a given actor:

Code:
$gameActors.actor(ACTOR ID).actor().traits.push({code: CODE, dataId: ID, value: VALUE})

If you want to add one to the actor's class:

Code:
$gameActors.actor(ACTOR ID).currentClass().traits.push({code: CODE, dataId: ID, value: VALUE})

If you want to add one to the party leader:

Code:
$gameParty.leader().actor().traits.push({code: CODE, dataId: ID, value: VALUE})

Or party leader's class:

Code:
$gameParty.leader().currentClass().traits.push({code: CODE, dataId: ID, value: VALUE})

Where CODE, ID and VALUE are determined as follows:

Element rate = 11 (ID starts at 1 for "physical", increasing by 1 for each element ID you've defined)
Debuff rate = 12 (ID start at 0 - Max HP, Max MP, Attack, Defence, M Attack, M Defence, Agility, Luck)
State rate = 13 (ID starts at 1 for "death", increasing by 1 for each state you've defined)
State resist = 14 (ID starts at 1 for "death" increasing by 1 for each state you've defined)
Param = 21 (ID starts at 0 - Max HP, Max MP, Attack, Defence, M Attack, M Defence, Agility, Luck)
Ex-Param = 22 (ID starts at 0 - Hit Rate, Evasion Rate, Critical Rate, Critical Evasion, Magic Evasion, Magic Reflection, Counter Attack, HP Regeneration, MP Regeneration, TP Regeneration)
Sp-Param = 23 (ID starts at 0 - Target Rate, Guard Effect, Recovery Effect, Pharmacology, MP Cost Rate, TP Charge Rate, Physical Damage, Magical Damage, Floor Damage, Experience)
Attack element = 31 (ID starts at 1 for "physical", increasing by 1 for each element ID you've defined)
Attack state = 32 (ID starts at 1 for "death", increasing by 1 for each state you've defined)
Attack speed = 33 (ID will always be 0)
Attack times = 34 (ID will always be 0)
Add skill type = 41 (ID starts at 1, increasing by 1 for each skill type defined)
Seal skill type = 42 (ID starts at 1, increasing by 1 for each skill type defined)
Add skill = 43 (ID starts at 1, increasing by 1 for each skill defined)
Seal skill = 44 (ID starts at 1, increasing by 1 for each skill defined)
Add weapon type = 51 (ID starts at 1, +1 for each weapon)
Add armour type = 52 (ID starts at 1, +1 for each armour)
Lock equip = 53 (ID starts at 1, +1 for each equip slot)
Seal equip = 54 (ID starts at 1, +1 for each equip slot
Slot type = 55 (ID will always be 0)
Action+ = 61 (ID will always be 0)
Special flag = 62 (ID starts at 0 - Auto Battle, Guard, Substitute, Preserve TP)
Collapse type = 63 (ID starts at 0 - Normal, Boss, Instant, No Disappear)
Party ability = 64 (ID starts at 0 - Encounter Half, Encounter None, Cancel Surprise, Raise Preemptive, Gold Double, Item Drop Double)

For percentage-based traits (Element rate, debuff rate etc.) VALUE is a percentage expressed as a fraction, 1 being 100%. So for 50% you'd put 0.5, for 150% you'd put 1.5, and so on.

For flat rate traits like attack speed, the VALUE is the amount you want to raise/lower it by. So if you wanted +5 attack speed, you'd just put 5. For -5 attack speed, you'd put -5.

For traits that add skill types, skills, flags etc. VALUE will always be 1.
 

KimiRaven

Veteran
Veteran
Joined
Sep 26, 2016
Messages
44
Reaction score
17
First Language
English
Primarily Uses
RMMV
If you want to add a trait to a given actor:

Code:
$gameActors.actor(ACTOR ID).actor().traits.push({code: CODE, dataId: ID, value: VALUE})

If you want to add one to the actor's class:

Code:
$gameActors.actor(ACTOR ID).currentClass().traits.push({code: CODE, dataId: ID, value: VALUE})

If you want to add one to the party leader:

Code:
$gameParty.leader().actor().traits.push({code: CODE, dataId: ID, value: VALUE})

Or party leader's class:

Code:
$gameParty.leader().currentClass().traits.push({code: CODE, dataId: ID, value: VALUE})

Where CODE, ID and VALUE are determined as follows:

Element rate = 11 (ID starts at 1 for "physical", increasing by 1 for each element ID you've defined)
Debuff rate = 12 (ID start at 0 - Max HP, Max MP, Attack, Defence, M Attack, M Defence, Agility, Luck)
State rate = 13 (ID starts at 1 for "death", increasing by 1 for each state you've defined)
State resist = 14 (ID starts at 1 for "death" increasing by 1 for each state you've defined)
Param = 21 (ID starts at 0 - Max HP, Max MP, Attack, Defence, M Attack, M Defence, Agility, Luck)
Ex-Param = 22 (ID starts at 0 - Hit Rate, Evasion Rate, Critical Rate, Critical Evasion, Magic Evasion, Magic Reflection, Counter Attack, HP Regeneration, MP Regeneration, TP Regeneration)
Sp-Param = 23 (ID starts at 0 - Target Rate, Guard Effect, Recovery Effect, Pharmacology, MP Cost Rate, TP Charge Rate, Physical Damage, Magical Damage, Floor Damage, Experience)
Attack element = 31 (ID starts at 1 for "physical", increasing by 1 for each element ID you've defined)
Attack state = 32 (ID starts at 1 for "death", increasing by 1 for each state you've defined)
Attack speed = 33 (ID will always be 0)
Attack times = 34 (ID will always be 0)
Add skill type = 41 (ID starts at 1, increasing by 1 for each skill type defined)
Seal skill type = 42 (ID starts at 1, increasing by 1 for each skill type defined)
Add skill = 43 (ID starts at 1, increasing by 1 for each skill defined)
Seal skill = 44 (ID starts at 1, increasing by 1 for each skill defined)
Add weapon type = 51 (ID starts at 1, +1 for each weapon)
Add armour type = 52 (ID starts at 1, +1 for each armour)
Lock equip = 53 (ID starts at 1, +1 for each equip slot)
Seal equip = 54 (ID starts at 1, +1 for each equip slot
Slot type = 55 (ID will always be 0)
Action+ = 61 (ID will always be 0)
Special flag = 62 (ID starts at 0 - Auto Battle, Guard, Substitute, Preserve TP)
Collapse type = 63 (ID starts at 0 - Normal, Boss, Instant, No Disappear)
Party ability = 64 (ID starts at 0 - Encounter Half, Encounter None, Cancel Surprise, Raise Preemptive, Gold Double, Item Drop Double)

For percentage-based traits (Element rate, debuff rate etc.) VALUE is a percentage expressed as a fraction, 1 being 100%. So for 50% you'd put 0.5, for 150% you'd put 1.5, and so on.

For flat rate traits like attack speed, the VALUE is the amount you want to raise/lower it by. So if you wanted +5 attack speed, you'd just put 5. For -5 attack speed, you'd put -5.

For traits that add skill types, skills, flags etc. VALUE will always be 1.

Wao thanks man, this is clearly defined and will seriously help me.. thank you
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,932
Reaction score
3,161
First Language
English
Primarily Uses
RMMZ
I'm considering posting a more in-depth version of this as a tutorial in its own right, what do you think?
 

KimiRaven

Veteran
Veteran
Joined
Sep 26, 2016
Messages
44
Reaction score
17
First Language
English
Primarily Uses
RMMV
I'm considering posting a more in-depth version of this as a tutorial in its own right, what do you think?

I think this will help plenty of people with their game, go for it. :)
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,932
Reaction score
3,161
First Language
English
Primarily Uses
RMMZ
Oh, forgot to mention: because this is modifying the $data___ variables, which initially get their data from the database values, the new traits won't persist when loading a saved game. I'll cover this in the tutorial about it.
 

KimiRaven

Veteran
Veteran
Joined
Sep 26, 2016
Messages
44
Reaction score
17
First Language
English
Primarily Uses
RMMV
Oh, forgot to mention: because this is modifying the $data___ variables, which initially get their data from the database values, the new traits won't persist when loading a saved game. I'll cover this in the tutorial about it.

So the data need to be recalled again during game load? Won't the data stick to what it being saved?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,932
Reaction score
3,161
First Language
English
Primarily Uses
RMMZ
No, because the traits aren't actually saved anywhere; the game just grabs them from the database fields. You can change them during play, but then when you reload a save it'll be like "Okay, for traits I need to look at the database. There they are." and overwrite your changes.
 

KimiRaven

Veteran
Veteran
Joined
Sep 26, 2016
Messages
44
Reaction score
17
First Language
English
Primarily Uses
RMMV
No, because the traits aren't actually saved anywhere; the game just grabs them from the database fields. You can change them during play, but then when you reload a save it'll be like "Okay, for traits I need to look at the database. There they are." and overwrite your changes.

ah, that's too bad.. Will creating a plugin help store the data? Maybe through reverse engineering the game javascript.. or creating some function. I don't know.. I am consider amateur in the world of javascript. Just learning bits by bits whenever I have the time..
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,932
Reaction score
3,161
First Language
English
Primarily Uses
RMMZ
I will explain how to do this to you, I just haven't had the time yet. XD
 

KimiRaven

Veteran
Veteran
Joined
Sep 26, 2016
Messages
44
Reaction score
17
First Language
English
Primarily Uses
RMMV
2.PNG 1.PNG
By the way, I finally have time to test the code.. It somehow didn't work.. Did I wrongly input the code.. or am i missing something :p
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,932
Reaction score
3,161
First Language
English
Primarily Uses
RMMZ
If you did it with the menu open, you'll have to close/reopen the menu to see the change.
 

KimiRaven

Veteran
Veteran
Joined
Sep 26, 2016
Messages
44
Reaction score
17
First Language
English
Primarily Uses
RMMV
If you did it with the menu open, you'll have to close/reopen the menu to see the change.

Nevermind, it collide with Yanfly Base Parameter. So turning it off make it functional. :p
and yes you are correct, loading the game after you close the game (e.g. taking rest from game) reset the value to normal.
 

JamesRyan

Game Designer
Veteran
Joined
Sep 13, 2014
Messages
735
Reaction score
242
First Language
Vietnamese
Primarily Uses
RMMV
Excuse me, but what about getting the actor's extra or special params? I just need a code which returns the current value of one extra or special param of an actor (like return actor 1's HIT) for later use, so what should i write?
 

KimiRaven

Veteran
Veteran
Joined
Sep 26, 2016
Messages
44
Reaction score
17
First Language
English
Primarily Uses
RMMV
Excuse me, but what about getting the actor's extra or special params? I just need a code which returns the current value of one extra or special param of an actor (like return actor 1's HIT) for later use, so what should i write?

I use Yanfly plugins to add or reduce it through script if that's what you asking. :)
 

JamesRyan

Game Designer
Veteran
Joined
Sep 13, 2014
Messages
735
Reaction score
242
First Language
Vietnamese
Primarily Uses
RMMV
I use Yanfly plugins to add or reduce it through script if that's what you asking. :)

I also use the Ex and Sp params control plugins to add and reduce those params. However, i just need a script code to get the current value of one of those params to display for players in a text message somewhere else. I know this is a bit off-topic, but it is also quite related.
 

Gastin

Villager
Member
Joined
Mar 6, 2017
Messages
20
Reaction score
12
First Language
English
Primarily Uses
RMMV
I'm considering posting a more in-depth version of this as a tutorial in its own right, Yes !!!!!PPPPPPPPpPPpLLLLEEEEAAASSSSEEEEE!!!!!
 

JamesRyan

Game Designer
Veteran
Joined
Sep 13, 2014
Messages
735
Reaction score
242
First Language
Vietnamese
Primarily Uses
RMMV
I have figured out how to return actor's extra or special params. It turns out to be so easy like this (I hope it is right because i know next to nothing about Javascript):
- If i want to return HIT value of a specific actor: $gameActors.actor(actor id).hit (did a try and it did return me the value)

The param codes should be in the list below. Change hit to whatever you need:
Params: (All flat numbers, e.g.: 1337, 7331, 156)
mhp - max hp
mmp - max MP
atk - attack
def - defence
mat - magic attack
mdf - magic defence
agi - agility
luk - luck

XParams: (All decimal numbers symbolizing percent, e.g. 1.0, 0.5, 0.75, 2.44 would be 100%, 50%, 75%, 244%)
hit - Hit rate
eva - Evasion rate
cri - Critical rate
cev - Critical evasion rate
mev - Magic evasion rate
mrf - Magic reflection rate
cnt - Counter attack rate
hrg - HP regeneration rate
mrg - MP regeneration rate
trg - TP regeneration rate

SParams: (All decimal numbers symbolizing percent, e.g. 1.0, 0.5, 0.75, 2.44 would be 100%, 50%, 75%, 244%)
tgr - Target Rate
grd - Guard effect rate
rec - Recovery effect rate
pha - Pharmacology
mcr - MP Cost rate
tcr - TP Charge rate
pdr - Physical damage rate
mdr - Magical damage rate
fdr - Floor damage rate
exr - Experience rate
 

Latest Threads

Latest Posts

Latest Profile Posts

In the review stages for Pixacrea to be put up on Steam :) Coming Soon page... hopefully coming soon ;)
since all my maps are hand drawn... I admit, I super envy those who can make the tileset's work. I'm garbage at mapping, but slightly less bad at just drawing my own areas. plus it's easier to draw my own sprites than edit others to look like my characters.
Guys, I made a trailer! And, I also launched the Steam page! If you would like to support the game, please Wishlist it :ahappy: ->
working on some tilesets _ノ乙(、ン、)_

CIBl8xT.png


Oq8WKHX.png
aww man, color hex code #C4C4C4 doesn't work for the tint value in this scene I need something darker, which stinks just because I liked that one it was my favorite plastic explosive three times...#696969 (nice) should work better (WHY IS MY BRAIN LIKE THIS)

Forum statistics

Threads
117,285
Messages
1,106,142
Members
153,473
Latest member
anzz
Top