7/27/19

Who to Smack

Don't have a pic right now, but I managed to work the Vore DBS into the Rubber project.  As a reminder, the Vore DBS's key feature would change what you can target.  For this project, your targets are mainly influenced by your skill type.

Currently, there are three skill types planned:
-Fun- These only target rubber-bound enemies.
-Fight- These only target normal enemies.
-Survive- Aside from skills that help your party, the skills here can target any enemy (but can't damage them).
-Items- Pretty standard in any project.


And now, let me attempt a tutorial on how to change your targets.

1. Under Window_BattleEnemy, you want to change the selectable enemies, and the methods are item_max, draw_item and enemy.  Let's call our replacement group $game_party.choose_your_foes.

2.  Let's say that you're going Hearthstone and want enemies with state Taunt to be targeted first.  By default, the methods above uses alive_members to select alive enemies.  For our choose_your_foes method (under Game_Party/Game_Unit), we would have alive members as our first choice.  However, we then .select members that have the state if any of them exists ({|enemy| enemy.state?(TAUNT)}

A.  Now that we selected our targets, we need to specify our targets.  Most of the magic happens in Game_Action, though I like to use Game_Unit to work closely with the members (You could probably use Game_Battler too).  Anyway, Game_Action's methods for selecting the targets starts with item_target_candidates and make targets, which in turn boils down to confusion_targets, decide_random_targets, target_for_friends and target_for_opponents.  These ultimately boil down to opponents_unit and friends_unit, both which uses the subject's definition of said groups.

3.  Anyway, let's take opponents_unit.alive_members as as example.  This translates to subject.opponents_unit.alive_members which would be the enemy troop if the subject is an actor.  We could change this to opponent_units.choose_your_foes (or equivalent if you want to keep that method separate).  Under item.for_all? (usually the else of an item.for_one?), this skill will hit Taunt enemies if they exist or normal enemies if they don't.

4.  opponents_unit.smooth_target(index)  is different as it's designed to target a specific enemy.  The index is mainly determined by the troop's size, not your targeting window.  Hence if you have xnTnn, the T is [2] instead of [0].  These smooth targets are found under Game_Unit  and it's designed to take the current index of the whole group then decide if the member of that index is alive.  Through that structure, our group should take the whole group, then check if our target is part of the choose_your_foes group and if they're alive before we decide if we use that target or if we redirect them to a member of the choose_your_foes group.

B.  Let's say you want your actor to choose enemies based on the actor's state or the type of skill they're using.  If I recall correctly, I would take Window_Actor Command's data as it's the most relevant, which you can access from @actor_command_window in Scene_Battle.  After creating variables/methods in Scene_Battle, I would then access them through SceneManager.scene.??? after seeing if the scene is a battle.

No comments:

Post a Comment