[YEP_BuffStatesCore]"Origin.param" returns the wrong actor's parameter

Randor01

Veteran
Veteran
Joined
Dec 24, 2018
Messages
88
Reaction score
15
First Language
Italian
Primarily Uses
RMMV
Hello!
I'm making a State that regenerates an Actor's health every turn based on the Luk parameter of the actor that afflicted it to him. To do this i'm using a few of Yanfly's plugins, such as the BuffStatesCore.

This is the code written for the State:
Code:
<Custom Apply Effect>
// Calculate the damage to be dealt by the formula.
target._Guidato = Math.floor((origin.param(7) - 10) / 2);
</Custom Apply Effect>

<Custom Remove Effect>
// Remove the damage effect.
target._Guidato = undefined;
</Custom Remove Effect>

<Custom Regenerate Effect>
// Default the DoT formula.
target._Guidato = target._Guidato || Math.floor((origin.param(7) - 10) / 2);
// Increases the target's HP
target.gainHp(target._Guidato);
// Start the damage popup.
target.startDamagePopup();
// Clear the target's results.
target.clearResult();
</Custom Regenerate Effect>
In theory, this code should take the Luk parameter of the actor that applied the skill, and use it as a base for the Health Regeneration effect. Apparently it doesn't work that way, and instead uses the Luk parameter of the actor that receives the State. I remember that "origin" served the exact purpose that i need, but perhaps it works differently?
EDIT: I should add, the skill that applies this State works outside of battle as well. Maybe it has something to do with that?
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
It works fine for me, even with a state that isn't removed at battle end.

FYI you can use .luk rather than .param(7).
 

Randor01

Veteran
Veteran
Joined
Dec 24, 2018
Messages
88
Reaction score
15
First Language
Italian
Primarily Uses
RMMV
It works fine for me, even with a state that isn't removed at battle end.

FYI you can use .luk rather than .param(7).
Yeah i put "param(7)" just to see if that was the issue.
Do you perhaps know if "origin" doesn't work if you're outside of battle?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
I'm not 100% sure as Custom Regenerate Effects don't seem to trigger outside of battle anyway, but it looks like origin on the map is considered to be the actor with the state rather than the one who applied it to begin with.
 

Randor01

Veteran
Veteran
Joined
Dec 24, 2018
Messages
88
Reaction score
15
First Language
Italian
Primarily Uses
RMMV
I'm not 100% sure as Custom Regenerate Effects don't seem to trigger outside of battle anyway, but it looks like origin on the map is considered to be the actor with the state rather than the one who applied it to begin with.
I see. I think i can circumvent this by assigning the value of the caster to an external variable with the Action Sequence plugin. I'll see if it works.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
That should work, yeah.
 

Randor01

Veteran
Veteran
Joined
Dec 24, 2018
Messages
88
Reaction score
15
First Language
Italian
Primarily Uses
RMMV
Aight, now i'm having another problem ^^"
I made this action sequence for the skill that applies the State:

Code:
<setup action>
display action
wait: 40
clear battle log
change variable 2 = user.luk
</setup action>
<finish action>
</finish action>
But apparently when the state is applied the game reads the variable like it's equal to 0. Does perhaps the state application happen before the variable is set with the parameter?

EDIT: It would be more helpful if I showed the changed State's code too:
Code:
<Custom Apply Effect>
// Calculate the damage to be dealt by the formula.
console.log($gameVariables.value(2));
var guide = Math.floor(($gameVariables.value(2) - 10) / 2);
target._Guidato = guide;
</Custom Apply Effect>

<Custom Remove Effect>
// Remove the damage effect.
target._Guidato = undefined;
</Custom Remove Effect>

<Custom Regenerate Effect>
// Default the DoT formula.
target._Guidato = target._Guidato || Math.floor((origin.param(7) - 10) / 2);
// Increases the target's HP
target.gainHp(target._Guidato);
// Start the damage popup.
target.startDamagePopup();
// Clear the target's results.
target.clearResult();
</Custom Regenerate Effect>
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
Quite possibly, yeah.
 

Randor01

Veteran
Veteran
Joined
Dec 24, 2018
Messages
88
Reaction score
15
First Language
Italian
Primarily Uses
RMMV
Quite possibly, yeah.
It doesn't seem like the case tho. I tried returning Var 2's value from the Console after using the attack. and it returns me zero. It seems that there's something else that is wrong here.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
I don't have the time at the moment to properly delve into this, but if I get a chance I'll see if I can figure out what's going on.
 

Randor01

Veteran
Veteran
Joined
Dec 24, 2018
Messages
88
Reaction score
15
First Language
Italian
Primarily Uses
RMMV
I don't have the time at the moment to properly delve into this, but if I get a chance I'll see if I can figure out what's going on.
Thanks!
EDIT: Just that i'm sure: Do action effects work outside of battle?
EDIT2: No they don't. I think i'm a bit lost here.
 
Last edited:

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
603
First Language
English
Primarily Uses
RMMV
Have you tried setting the variable in the skill note tag using <Before Eval> ?

edit: sorry, you would need Yanfly skill core for this, not sure if you utilize that plugin as well
 

Randor01

Veteran
Veteran
Joined
Dec 24, 2018
Messages
88
Reaction score
15
First Language
Italian
Primarily Uses
RMMV
Have you tried setting the variable in the skill note tag using <Before Eval> ?

edit: sorry, you would need Yanfly skill core for this, not sure if you utilize that plugin as well
YES! It worked!
I put this code in the <Before Eval> tag:


Code:
<Before Eval>
if(!$gameParty.inBattle())
{
   $gameVariables.setValue(2, user.luk);
}
</Before Eval>
So it takes the luk value of the user only if not in battle.
Then there's this code for the State:


Code:
<Custom Apply Effect>
var luk = 0;
if(!$gameParty.inBattle())
{
   luk = $gameVariables.value(2);
}
else
{
   luk = origin.luk;
}
// Calculate the damage to be dealt by the formula.
target._Guidato = Math.max(Math.floor((luk - 10) / 2), 1);
</Custom Apply Effect>
Which uses var2 as the luk value if, again, outside battle.
Thank you so much!

EDIT: Then again, it is pointless to use "origin" in this case if i can use <Before Eval>.

Code:
<Before Eval>
$gameVariables.setValue(2, user.luk);
</Before Eval>
Code:
<Custom Apply Effect>
var luk = $gameVariables.value(2);
// Calculate the damage to be dealt by the formula.
target._Guidato = Math.max(Math.floor((luk - 10) / 2), 1);
</Custom Apply Effect>
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!

Forum statistics

Threads
106,036
Messages
1,018,461
Members
137,821
Latest member
Capterson
Top