Sektor

Villager
Member
Joined
Dec 29, 2018
Messages
19
Reaction score
1
First Language
French
Primarily Uses
RMMV
Hello,

I have added the YEP_StatAllocation script on my project, and i would like to add some Critical damage to a player when
he talk to a npc, or when he use an item in the menu.

I would like to call a script like this.actor.gaincri(20)... but i'm too noob to understand the code and the right syntax...

Maybe anyone can help me ?

Thanks to all of you in advance.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,633
Reaction score
2,007
First Language
EN
Primarily Uses
RMMZ
YEP_StatAllocation works by storing the number of allocations per stat. Each stat has a specified allocationBonus value determined via the Plugin Manager. The bonus for a given stat equals the number of allocations multiplied by the corresponding bonus value.

To manually increase the number of allocations for a particular Ex-param (like CRI), try this:
JavaScript:
var actor = $gameParty.members()[0];
var paramId = 2;
var allocations = 5;
actor.gainXParamAllocateTimes(paramId, allocations);
Explanation:
  • $gameParty.members()[0] is the party leader. Swap 0 for 1 to reference party member 2, etc. Alternatively you can refer to the actor by their ID, e.g. $gameActors.actor(1) (actor ID 1).

  • paramId = 2 - here are parameter IDs as used by this plugin:
    • Basic params:
      Code:
       0    1    2    3    4    5    6    7
      mhp  mmp  atk  def  mat  mdf  agi  luk
    • Ex-params:
      Code:
       0    1    2    3    4    5    6    7    8    9
      hit  eva  cri  cev  mev  mrf  cnt  hrg  mrg  trg
    • Sp-params:
      Code:
       0    1    2    3    4    5    6    7    8    9
      tgr  grd  rec  pha  mcr  tcr  pdr  mdr  fdr  exr

  • allocations = 5 - the number of allocations to add to this actor for this param.

  • gainXParamAllocateTimes is for Ex-params (like CRI).
    • For basic params use gainParamAllocateTimes instead.
    • For Sp-params use gainSParamAllocateTimes instead.
:kaophew:
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
4,169
Reaction score
1,595
First Language
Dutch
Primarily Uses
RMMV
didn't know, only the plugin name, I will save this as well, in case of need :)
 

Matrien

Villager
Member
Joined
Aug 23, 2020
Messages
8
Reaction score
3
First Language
English
Primarily Uses
RMMV
I played around with this a bit, and discovered there is a potential downside to this solution in that if you leave the plugin's Revert command enabled, the allocations added through the script call will be lost along with all normal allocations, and no Allocation Points will be returned for the allocations added through the script, so there is potential for players to permanently lose the intended bonus.

If you disable the revert command in your project this is not an issue, but if you do plan to provide this option to players, you should be able to achieve the same CRI bonus effect using a passive state plugin (like Yanfly's) without the risk of unintentionally removing the bonus.
 

Sektor

Villager
Member
Joined
Dec 29, 2018
Messages
19
Reaction score
1
First Language
French
Primarily Uses
RMMV
I'll use it in a skill tree menu so I don't think there will be a problem.
we'll see that in the future.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,633
Reaction score
2,007
First Language
EN
Primarily Uses
RMMZ
Yea, I just assumed you wanted to tie it into the stat allocation system... :kaoswt:

In case it's helpful: YEP_ExtraParamFormula (not free) has a script call for this, e.g.
JavaScript:
$gameActors.actor(1).addCri(0.2);
This typically acts like the default Change Parameter command, except for ex-params (CRI in this case).
 

Latest Threads

Latest Posts

Latest Profile Posts

Artists out there, is there something RPG maker related you wish your graphics software had but doesn't? (Something like automatically transform a wall tile into a cylindrical tower). I want to give a boost to WecTools, but I'm dry of ideas right now...
having anxiety during all this virus stuff is the absolute worst. I'm the only one missing out on my friend's wedding in Sept. because I can't be in large groups of people anymore due to anxiety.
Well... I just spent most of the day making something I cant even use xD

Hero_1.png
The idea was to look at the original but at a medium distance.
In hindsight, I might as well have just edited the original lol... I didn't intend for it to end up so similar.
does anyone else feel tired after completing a sprite?

Forum statistics

Threads
113,906
Messages
1,078,338
Members
148,011
Latest member
minh0408
Top