[Explanation, if curious]
I'm trying to add xparam plusses. My reason for doing so is I'm trying to make an aggro (target rate by a certain enemy, aka rage/threat) system using a custom enemy AI script, where the xparams are going to be used as rage by a certain enemy, then I'm going to use a custom stat script, which has its own stats, xstats, for defining of things like hit and evasion rate. xparam(0) for an actor would be the aggro for enemy index 0 for that particular actor, xparam(1) would be the aggro for enemy index 1, and so forth, and whenever you use an action like buffing the party, healing an ally, or damaging an enemy, you will gain aggro from every conscious enemy that's relevant, thus boosting your xparams of numeric ids. So if actor 3 attacked $game_troop.members[4], their xparam(4) would be boosted by a certain amount, usually by 1000 on average. I can't just use variables because variables would need to refer to an actor of a given index, which if you switch the positions of members in battle using a script, then you'd mess up the variables, among other issues.
Like the way the weighted random encounter system works, where you're more likely to encounter an enemy with a higher encounter weight, with my process, an enemy would select a target actor, of which an actor with a higher aggro, be it, the xparam of an id of the index of the enemy, the more likely they'd be targetted.
I don't think the scripts used in this instance are relevant as it is not the process I'm going to achieve it with, but the fact that the xparam_plus addition is the step I need in order to achieve what I'm going for, and the scripts used don't change that.
No added scripts define or alias the xparam process.
---
I added two processes,
def xparam_plus(xparam_id) @xparam_plus[xparam_id] endwhich is based off of
def param_plus(param_id) @param_plus[param_id] endand
def add_xparam(xparam_id, value) @xparam_plus[xparam_id] += value refresh endwhich is based off of
def add_param(param_id, value) @param_plus[param_id] += value refresh endand then defined xparam
# def xparam(xparam_id)# features_sum(FEATURE_XPARAM, xparam_id)# end def xparam(xparam_id) value = 0 + features_sum(FEATURE_XPARAM, xparam_id) + xparam_plus(xparam_id) value endbased off of
def param(param_id) value = param_base(param_id) + param_plus(param_id) value *= param_rate(param_id) * param_buff_rate(param_id) [[value, param_max(param_id)].min, param_min(param_id)].max.to_i end However, whenever I try to reference xparam, or add in a script that allows you to view an actor's xparams, the game returns this error
Game_BattlerBase:243:in 'xparam_plus': undefined method '[]' for nil:NilClass, NoMethodErrorwhich is referring to def xparam_plus(xparam_id).
So I'm not sure how to do this. I assume it's a casual mistake.
I'm trying to add xparam plusses. My reason for doing so is I'm trying to make an aggro (target rate by a certain enemy, aka rage/threat) system using a custom enemy AI script, where the xparams are going to be used as rage by a certain enemy, then I'm going to use a custom stat script, which has its own stats, xstats, for defining of things like hit and evasion rate. xparam(0) for an actor would be the aggro for enemy index 0 for that particular actor, xparam(1) would be the aggro for enemy index 1, and so forth, and whenever you use an action like buffing the party, healing an ally, or damaging an enemy, you will gain aggro from every conscious enemy that's relevant, thus boosting your xparams of numeric ids. So if actor 3 attacked $game_troop.members[4], their xparam(4) would be boosted by a certain amount, usually by 1000 on average. I can't just use variables because variables would need to refer to an actor of a given index, which if you switch the positions of members in battle using a script, then you'd mess up the variables, among other issues.
Like the way the weighted random encounter system works, where you're more likely to encounter an enemy with a higher encounter weight, with my process, an enemy would select a target actor, of which an actor with a higher aggro, be it, the xparam of an id of the index of the enemy, the more likely they'd be targetted.
I don't think the scripts used in this instance are relevant as it is not the process I'm going to achieve it with, but the fact that the xparam_plus addition is the step I need in order to achieve what I'm going for, and the scripts used don't change that.
No added scripts define or alias the xparam process.
---
I added two processes,
def xparam_plus(xparam_id) @xparam_plus[xparam_id] endwhich is based off of
def param_plus(param_id) @param_plus[param_id] endand
def add_xparam(xparam_id, value) @xparam_plus[xparam_id] += value refresh endwhich is based off of
def add_param(param_id, value) @param_plus[param_id] += value refresh endand then defined xparam
# def xparam(xparam_id)# features_sum(FEATURE_XPARAM, xparam_id)# end def xparam(xparam_id) value = 0 + features_sum(FEATURE_XPARAM, xparam_id) + xparam_plus(xparam_id) value endbased off of
def param(param_id) value = param_base(param_id) + param_plus(param_id) value *= param_rate(param_id) * param_buff_rate(param_id) [[value, param_max(param_id)].min, param_min(param_id)].max.to_i end However, whenever I try to reference xparam, or add in a script that allows you to view an actor's xparams, the game returns this error
Game_BattlerBase:243:in 'xparam_plus': undefined method '[]' for nil:NilClass, NoMethodErrorwhich is referring to def xparam_plus(xparam_id).
So I'm not sure how to do this. I assume it's a casual mistake.