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.

[Resolved]Initiate Attack

I've developed an enhanced AI script, and so far everything's working well--except that none of the battlers actually do anything. They're smart about it, at least, consuming a lot of system resources choosing the best target and the best skill. But that's all they do. Think about it. They never actually attack or defend or do anything. It's like they've got a Hamlet complex.

So how do I take the next step? Currently they have a target and skill to use against that target. The question is, how do I command them to use it? I've looked at a couple other AI scripts, and it seems that these lines should do the trick:

self.current_action.skill_id = chosen_skill
self.current_action.target_index = target.index

Problem is, they don't seem to be doing anything. Perhaps there's another component I'm not aware of?
 
That does it! In order to use a skill, you first have to set self.current_action.kind = 1. So from the example above, it should actually read:

self.current_action.kind = 1
self.current_action.skill_id = chosen_skill
self.current_action.target_index = target.index

Thanks, gerrtunk. My battlers have finally gotten out of their depressive funk and started killing eachother again. Joy!
 

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