Ex-Turn

Status
Not open for further replies.

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
98
First Language
Español
Primarily Uses
RMVXA
Hello, I'm trying to implement a mechanic in my project called Ex-Turn. At the start of the battle, I made a common event which checks if player/enemy initial speed is at least 1.5 times higher than the average enemy/player speed, it'll gain the Ex-Turn state will let them to do a extra action this turn.

This work perfectly for player, the state adds the Action Times +100% flag, but the problem comes when I do this for enemies.

First I give it the same state with the same flag, but that means the enemy will repeat twice the pattern you give them, and even when under normal conditions that'd be acceptable, in cases like, for example, each 5 turns an enemy will make Meteor always, that'd imply under Ex-Turn state, the enemy would make twice Meteor, and that's undesired.

The other alternative I had is adding a different state just to use as a check to force enemies actions via eventing, but the trouble is the action is forced at the mere start of the turn (when characters haven't even been able to use Guard) or at the end, if I select the flag At the end of the turn in the event triggering , when all have made their moves (which kind of works but looks weird)

What I'm trying to do is having control of the second action the enemy will have if it has the Ex-Turn state, but I want it to make more natural, (I mean, right after the enemy executes the regular action) Is there a way to do that? Am I missing another way to solve it? Thanks for the help
 
Last edited:

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
if you're using *states*, make sure you remove it after it has served it's purpose.
just to be on the safe side.
I mean, not by the state's own "remove by turn" feature, but manually, from your common event.
 

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
98
First Language
Español
Primarily Uses
RMVXA
if you're using *states*, make sure you remove it after it has served it's purpose.
just to be on the safe side.
I mean, not by the state's own "remove by turn" feature, but manually, from your common event.
It removes at the end of the battle, so yes, I checked that :)
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
no, not at the end of batte, at the end of the application of the ex turn.
see the difference?
you're always running the extra initiative during the whole battle.
 

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
98
First Language
Español
Primarily Uses
RMVXA
no, not at the end of batte, at the end of the application of the ex turn.
see the difference?
you're always running the extra initiative during the whole battle.
That's actually the point, the idea is if the enemy/player gets it in the battle, it last the whole battle, but the effect decides who gets/doesn't get this state only happens at start of the battle
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
then you need something like a cooldown system for skills.
that would prevent any spamming of skills.
as it is, they're recieving the chance to go twice in a row, and they're taking it.... nothing prevents them from using a skill twice, within the conditions you give them.

another solution would be to apply a state lasting 1 turn or action, sealing the already used skill.

in that case, you need to grab the used skill somehow, and create states sealing each individual skill.
or, dynamically create states sealing *the skill just used*
that's harder to do.
sealing each individual state takes a lot of states, but it's easier to do.
 

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
98
First Language
Español
Primarily Uses
RMVXA
That sounds like a good solution, but if I'm forcing an action with the Force Action command, it's just putting the right conditions

What actually bothers me is the fact the action is forced at the mere start of the turn or at the very end, is there a way to fix that? Maybe a scripted solution?
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
with the stock battle system, with queued actions by the enemies (or, both parties for that matter), everything will be processed in sequence.
the only issue being, when an enemy queues two skills of "Skill", the first iteration of "Skill" would seal itself, which will negate the second queued action, which is already queued as "Use 'Skill'", which won't happen because it's locked.
that will happen for players as well.
nothing will prevent you from queuing the action for a second go, because at queuing time the skill is not locked.

seems like the most logical solution (if you want to have both actions available), is a new battle system.
or, a redesign of the AI, or something that will specifically lock skills *after* being queued the first time.
code-wise, it shouldn't be hard to plug *the fix* into *the battle system* itself.
IIRC, since all the actions are queued in sequence, it's all a matter of calling the function to lock the skill right after it's queued.
that'd work for enemies and players alike.
once you have the function for locking and unlocking the skill, you just add a call to it between processing of actions and the AI will pick the next action based on the new (skillset-1) set of skills.
the trick is, working out the locking and unlocking.

Force Action will run (if I'm not mistaken) at processing time.
if you use the stock battle system, you'll still queue the actions first, and then pass them to be run, in between which, the Force Action will be evaluated.

find the process that queues the actions
that's the key there.
 

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
98
First Language
Español
Primarily Uses
RMVXA
the only issue being, when an enemy queues two skills of "Skill", the first iteration of "Skill" would seal itself, which will negate the second queued action, which is already queued as "Use 'Skill'", which won't happen because it's locked.
that will happen for players as well
That's not too much of a trouble, I can create another skill only for player (most of the skills enemy use are enemy exclusive anyways)

So I guess I can use the damage formula to add to the enemy this state after using this attack, so when it uses it, it seals the skill and for the second action in this turn, the enemy selects another skill is in the same turn pattern, right?
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
I was going to say "yes, exactly" but then I realized I might have messed the whole thing.
I had it as the AI reading the damage formula first, at queueing time, but why would that happen before having to actually use the damage result to calculate the damage proper? it's ridiculous, it makes no sense.
no, what you need is an intermediate step at queuing time.
something that will add a seal skill state to *the skill just queued*.
for that, you have to hook into the make_actions part of the battle

I just went and checked, the last skill object is already grabbed by default.
you can use something like this.
Code:
class Scene_Batte

def on_skill_ok
    @skill = @skill_window.item
    BattleManager.actor.input.set_skill(@skill.id)
    BattleManager.actor.last_skill.object = @skill #grab the skill
    if !@skill.need_selection?
      @skill_window.hide
      next_command                 #skill is valid, no target needed
    elsif @skill.for_opponent?
      select_enemy_selection  #
    else                    # skill is valid, target needed
      select_actor_selection    # next_command called from target selection
    end                    # window.
  end

 def next_command
    if BattleManager.next_command
                                  # < your sealing routine goes here
      start_actor_command_selection
                                  # -> from here on, set of skills minus sealed skill.
    else
      turn_start
    end
  end
end

assuming you're using the stock system
 

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
98
First Language
Español
Primarily Uses
RMVXA
Ok, I tested my solution idea in default battle system and it seals it, but that doesn't mean it it chooses the other attack, it just doesn't execute in case the RNG decides this is the attack the enemy will use...

you can use something like this.
I honestly don't understand how to configure it, could you give me an example, please?
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
the skill used is grabbed by action.last_skill_object = skill.
then it invokes next_command.
next_command is nothing more than "if actions still available, remain with this actor, if not, pass to next actor"
either way, next_command makes effective the adding of the previous skill to the queue.
that is where you seal that skill for good.
you come up with the sealing routine the best it fits to your game.... I'm only telling you where you have to hook it up to the game.
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,354
Reaction score
8,533
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,038
Members
137,568
Latest member
invidious
Top