Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Can an enemy attack twice in one round.

I have a boss battle that I'm writing and I'd like to be able to make the enemy attack first and last in each round. I've tried setting this up with troop events and am having difficulty getting it right. I want him to choose his attacks like normal, not force a move on him, and have him get two attacks per round. Is there a way to do this with events or do I need to have a piece of script? Thanks.


-Rob
 
It appears that you will have to mimic the "make_action" method from Game_Enemy that decides which action to use.
Store a random number in a variable, then use Conditional Branches to determine which action to force.
This could get tricky if you have a lot of actions & conditions for that enemy.
And, the "What's this" is a bit misleading & vague.

After studying the method for a few minutes, a better explanation for 'rating' would be:

The action's priority of use. Of all actions meeting the conditions, the one with the highest rating will be the standard, and the ones within 2 rating points below the standard can also be used.
Each valid action (meets conditions, and is within 2 points of the 'standard') gets a value.
The standard gets a '3', the action whose rating is one less gets a '2', and an action with a rating 2 less than the standard gets a '1'.
Add the values to get the range for your random number.
Then, each actions value over the total equals the probability that it gets used.

In the "What's this" example, they claim that a valid action whose rating is one less than the standard will be used 2/3 of the time, only applies if there are 3 valid actions, and it really means 2/3 of the remaining time.

For example, If I have 3 valid actions with ratings of 7, 6, 5. The first one will be used 50% (3/6), the 2nd: 33% (2/6), and the 3rd: 17% (the remaining 1/6).

If I have 2 actions that are 10 & 8, the frequency will be 75% (3/4), and 25% (1/4)
If I have 2 actions that are 5 & 4, the frequency will be 60% (3/5), and 40% (2/5)

I hope that helps more than it confuses....

If you list the Bosses Action list with conditions & ratings, I can help you with the math & logic if necessary.

Be Well
 
OK, my boss has four attacks.

Demon's Bite 5
Attack 3
Claw 3
Bite 3

The idea is that I want him to use Demon's Bite most often, and one third of the time choose one of the three other attacks to commit. It works in combat just fine, but now I want him to perform this action twice per round, once at the beginning before any of the characters perform their actions, and once at the end after all the characters have performed their actions. Any ideas?


-Rob
 
Yep, I think we can do that.

I gotta go get my teeth cleaned. I'll update this in about an hour.

[ edit again..]

It looks like a "Force Action" takes the place of the default action rather than in addition to it.
I can get 2 "Execute Now" actions to take place, but any other combination using "Normal Sequence" only results in one attack.
The best I think we can do without a script edit is to double up starting on the 2nd turn.

Ok, so your battle event for the Boss troop should look like:
Condition: Turn 2 + 1X
Span: Turn
Code:
@>Control Variables: [0003: D6] = Random No.(1..6)
@>Conditional Branch: Variable [0003: D6] == 1
    @>Force Action: [1. Boss], Attack, Random, Execute Now
    @>
  : Branch End
@>Conditional Branch: Variable [0003: D6] == 2
    @>Force Action: [1. Boss], [Claw], Random, Execute Now
    @>
  : Branch End
@>Conditional Branch: Variable [0003: D6] == 3
    @>Force Action: [1. Boss], [Bite], Random, Execute Now
    @>
  : Branch End
@>Conditional Branch: Variable [0003: D6] > 3
    @>Force Action: [1. Boss], [Demon Bite], Random, Execute Now
    @>
  : Branch End
@>
@>Control Variables: [0003: D6] = Random No.(1..6)
@>Conditional Branch: Variable [0003: D6] == 1
    @>Force Action: [1. Boss], Attack, Random, Execute Now
    @>
  : Branch End
@>Conditional Branch: Variable [0003: D6] == 2
    @>Force Action: [1. Boss], [Claw], Random, Execute Now
    @>
  : Branch End
@>Conditional Branch: Variable [0003: D6] == 3
    @>Force Action: [1. Boss], [Bite], Random, Execute Now
    @>
  : Branch End
@>Conditional Branch: Variable [0003: D6] > 3
    @>Force Action: [1. Boss], [Demon Bite], Random, Execute Now
    @>
  : Branch End
@>

I used D6 (6 sided die) for the variable.
Your ratings & description contradict each other. Based on your ratings, the actions would have the following values:

Demon's Bite 3
Attack 1
Claw 1
Bite 1

With a total of 6, meaning the odds would be:

Demon's Bite 3/6 (50%)
Attack 1/6 (16%)
Claw 1/6 (16%)
Bite 1/6 (16%)

Or, descriptively... "one half of the time choose one of the three other attacks"

To make it match your description, change the random value to (1..9)

Also, to make the Boss always attack 1st, set his agility to 999

Be Well
 
Ok, that's something I guess. I now have a boss character who will attack twice in a round, but he attacks twice in a row. Is there any way to get him to attack once at the beginning and once at the end? Thanks for your help so far.


-Rob
 
I don't think so, not without scripting.
Trickster did a 'multi-attack' script, but I think it allows multiple hits in a single attack.
We're going to need to enlist the assistance of someone who knows the battle system better than I.

I would suggest posting a request in "Script Requests".
 
Well, I have a little code that's a BIT messy, but might help :)

Make a new state and call it "Slow" or something like that. Set the rating to be 0 (so the name won't show), check nonresistance, and set Agi % to 0. This'll make it so an enemy will be last in every turn when the state is inflicted.

Now, back to the code Brewmeister made, here are the changes:
Code:
@>Control Variables: [0003: D6] = Random No.(1..6)
@>Conditional Branch: Variable [0003: D6] == 1
    @>Force Action: [1. Boss], Attack, Random, Execute Now
    @>Change Enemy State:[1. Boss], + [Slow]
    @>
  : Branch End
@>Conditional Branch: Variable [0003: D6] == 2
    @>Force Action: [1. Boss], [Claw], Random, Execute Now
    @>Change Enemy State:[1. Boss], + [Slow]
    @>
  : Branch End
@>Conditional Branch: Variable [0003: D6] == 3
    @>Force Action: [1. Boss], [Bite], Random, Execute Now
    @>Change Enemy State:[1. Boss], + [Slow]
    @>
  : Branch End
@>Conditional Branch: Variable [0003: D6] > 3
    @>Force Action: [1. Boss], [Demon Bite], Random, Execute Now
    @>Change Enemy State:[1. Boss], + [Slow]
    @>
  : Branch End
@>
@>Control Variables: [0003: D6] = Random No.(1..6)
@>Conditional Branch: Variable [0003: D6] == 1
    @>Force Action: [1. Boss], Attack, Random, Execute Now
    @>Change Enemy State:[1. Boss], - [Slow]
    @>
  : Branch End
@>Conditional Branch: Variable [0003: D6] == 2
    @>Force Action: [1. Boss], [Claw], Random, Execute Now
    @>Change Enemy State:[1. Boss], + [Slow]
    @>
  : Branch End
@>Conditional Branch: Variable [0003: D6] == 3
    @>Force Action: [1. Boss], [Bite], Random, Execute Now
    @>Change Enemy State:[1. Boss], + [Slow]
    @>
  : Branch End
@>Conditional Branch: Variable [0003: D6] > 3
    @>Force Action: [1. Boss], [Demon Bite], Random, Execute Now
    @>Change Enemy State:[1. Boss], + [Slow]
    @>
  : Branch End
@>

And there you have it. The first attack, the boss will attack first no matter what, since his agility is 999; the second attack will be last, since his agility is now 0 because of the state inflicted.
 
Reg, I see your logic, but it still doesn't work.  (you didn't test this, did you?) :smile:
If you leave them all at "Execute Now", you get 2 attacks together at the beginning of the turn.  If you change either one to "Normal Sequence", you only get one attack.

Nice try, though.

Be well
 
Ahh... never mind, I was just throwing out an idea. I never really understood the "Force Action" commands fully, since they work funny in the CBS I use  :tongue:

I guess if that doesn't work you'll just have to stick with scripting. If you want, I can tell me a mod to move this to script requests so you can get more replies.

Hope all goes well  :smile:
Regimos
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top