Skill works in battle, but not outside battle, even with "occasion: always"

cuby

Perpetual Toil
Veteran
Joined
Jun 20, 2015
Messages
119
Reaction score
19
First Language
English
Primarily Uses
RMMV
I have a slightly convoluted healing skill that works fine in battle, but doesn't heal outside of battle the way I would like. I suspect it comes down to my incomplete understanding of the "Force Action" command.

The skill is a pretty basic healing skill, but I've introduced a bunch of randomness and failures and messages and conditions to it, all of which take place in a common event which the skill calls. (Couldn't see any way possible to do it within the skill page).

Happy to run through the entire rigmarole of the skill, but since I suspect the issue can be traced to Force Action, I'll start there.

The skill runs a common event which ends with a "Force Action", forcing a healing skill on "Last Target". In battle, it works, outside battle, it does not, which makes me think that I don't understand how "Last Target" works -- does target mean something specific to battle, but not outside battle? Both the instigating skill, and the one it's common event calls, are set to Occasion: Always.

Would anyone have any thoughts about this? If Force Action: Last Target doesn't explain the skill's failure outside battle, I can provide more info, but I didn't want to clutter what might be a straightforward issue.

Thanks!!!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,713
Reaction score
2,830
First Language
English
Primarily Uses
RMMZ
You're not far off the mark in terms of the first place to look as a failure point. "last target" uses a particular object property which is set when you choose a target in battle but not when you choose a target in the item menu.
 

cuby

Perpetual Toil
Veteran
Joined
Jun 20, 2015
Messages
119
Reaction score
19
First Language
English
Primarily Uses
RMMV
You're not far off the mark in terms of the first place to look as a failure point. "last target" uses a particular object property which is set when you choose a target in battle but not when you choose a target in the item menu.

Well that's definitely a starting point. Is there any way to force the action on a specific actor in that case, without a plugin anyway? I'm lucky in that this skill can only be used on one specific actor, so I'd love it if I could just specify the target somehow. But looking at the "target" field of Force Action fills me with confusion -- what on earth are all those "indexes"?

I'm a little confused that Force Action allows you to choose a skill as the action, but withholds any reasonable choice of arguments ...
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,713
Reaction score
2,830
First Language
English
Primarily Uses
RMMZ
Well that's definitely a starting point. Is there any way to force the action on a specific actor in that case, without a plugin anyway? I'm lucky in that this skill can only be used on one specific actor, so I'd love it if I could just specify the target somehow. But looking at the "target" field of Force Action fills me with confusion -- what on earth are all those "indexes"?

I'm a little confused that Force Action allows you to choose a skill as the action, but withholds any reasonable choice of arguments ...
Your problem is that "force action" commands are only executed in battle. Internally, there are two forceAction functions: one for Game_Battler which takes as its parameters the skill ID and the target ID; and one in BattleManager, which takes the battler as a parameter. They work together to execute the actual effect. It logically follows that outside of battle this tandem functionality can't happen, because BattleManager doesn't do anything out of battle.

What you need to do is have your common event have a branching effect based on whether the party is in battle or not. Thankfully that is easy to do.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,372
Reaction score
8,395
First Language
German
Primarily Uses
RMMV
what on earth are all those "indexes"?
as explained above, the indices assume that you are in battle.
But each battle can have different enemies, so outside a troop event the engine can't determine which index stands for which enemy.
so inside a troop event the actual enemies are listed where the index stands - outside it remains the index and simply means "first enemy of the troop", "second enemy of the troop" and so on, or "first party member", "second party member" etc for the other side.
 

cuby

Perpetual Toil
Veteran
Joined
Jun 20, 2015
Messages
119
Reaction score
19
First Language
English
Primarily Uses
RMMV
Thanks @Andar and @Trihan, I understand how Force Action works much better now.

The question remains though, how to force the skill to be used on a party member outside of battle.

I've searched through the Conditional Branch options, and actually cannot find anything there that is obvious to create that "battle/notbattle" branch.

And although I'm wracking my brain, even if I can create the two conditional branches -- one for in battle (which can use the Force Action), and one outside of battle -- I still cannot figure out how to get that skill cast on my party member.

I suppose I would just handle the healing outside the skill entirely? Just use "Change HP"? I guess I would need to find a way to replicate the healing formula outside of the skill, but that would technically work. I imagine I would need a script call to account for all the attributes that go into it? But that seems like something of a solution.

But how to get there -- how do I create the conditional branch to check if we're in battle, first and foremost? Because otherwise, my guy will get healed twice when in battle :)

Many thanks for your help!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,713
Reaction score
2,830
First Language
English
Primarily Uses
RMMZ
Your condition needs to be script => $gameParty.inBattle()
 

cuby

Perpetual Toil
Veteran
Joined
Jun 20, 2015
Messages
119
Reaction score
19
First Language
English
Primarily Uses
RMMV
Thank you @Trihan! I can make this work.
 

Latest Threads

Latest Profile Posts

how does everybody even finish anything

i have like 5 projects in the backburner and it's just so sad that i probably won't get to finish all or maybe even any of them
Did you know that 90% of people in the world use the number in their sentence as they see fit?
It's been a long time since I was here but I have a lot of updates... btw I am teaching again about game programming and game design in some schools here in Brazil hahahaha It's good to see kids and teens learning this kind of thing!
welp, I literally can't continue working on ALEX now that my MZ trial is up (unless I somehow place in the jam which I don't remotely deserve to for my unfinished crap) so I am back on my bullshit

Forum statistics

Threads
113,891
Messages
1,078,235
Members
147,983
Latest member
H3ctorGH
Top