User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: RPG battle engine help.

  1. #1
    No Products Registered

    Join Date
    May 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    RPG battle engine help.

    I am currently working on a simple turn-based RPG (I know, I know, bad choice) and I am having a little trouble working out the most efficient means of going about a certain aspect of the battle system; specifically, the enemy actions.

    Let's say there are three enemies, and enemy 1 is ready to act. (Determined when a counter, increased over time, reaches a certain value.) At the moment, I just want it to select a character at random and attack it.

    The problem is that "enemy 1" could be one of any number of objects. Suppose I have three enemies called "monster", "creature" and "thing". Enemy 1 could be any one of those. Setting the "monster" object to play it's attack animation when enemy 1's action counter is maxed won't do me any good, because enemy 1 might not be "monster".

    How would I go about making this generic, so that when enemy 1's action counter is full, enemy 1 will act?

    I'm sorry if this isn't particularly clear. It's late, and I'm having trouble articulating. If you need me to go into additional detail on something, please ask.

  2. #2
    No Products Registered

    Join Date
    Feb 2008
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RPG battle engine help.

    Add a qualifier to the enemy 1's, then tell it to pick 1 of them at random.

  3. #3
    Clicker Multimedia Fusion 2

    Join Date
    Jun 2007
    Location
    Suffolk, UK
    Posts
    435
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RPG battle engine help.

    Are you using a specific screen for the battles? If you are and if your enemies will all be standing in specific positions, you could place invisible active objects on the positions for Enemy 1, 2 and 3. Give all your enemy types (monster, creature, thing etc) a qualifier, say enemies and then in your code select the enemy with qualifier enemy that is standing on enemy position 1

    Code:
    * Enemy1 Action Counter = 100
    + Group.Enemies is overlapping Active("Enemy position 1")
    = Group.Enemies do stuff (Change Animation Sequence, calculate damage etc)

  4. #4
    No Products Registered

    Join Date
    May 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RPG battle engine help.

    Aaand now I'm kicking myself. I actually had the aforementioned invisible active objects set in place already, but for some reason I just could not slot that last mental piece into place.

    Thanks, everyone.

  5. #5
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Paul_Boland's Avatar
    Join Date
    Jun 2006
    Location
    Waterford, Ireland.
    Posts
    2,739
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RPG battle engine help.

    It's a very complex piece of coded software, but if you check out Part 4 - Battle Systems of the NightFall RPG Tutorial on my website, it will show you how to handle enemy AI. But be warned, a TBBS is a beast to program and get working.
    KnightTrek Productions
    http://www.knighttrek.com

  6. #6
    No Products Registered

    Join Date
    May 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RPG battle engine help.

    I've actually been using that, although I'm reluctant to just copy it wholesale, so I'm trying to refer to it only when I'm completely stumped.

    Unfortunately it's coded under the assumption that you'll always be fighting the same number and type of enemies, so it didn't contain the answer to this particular problem. Nevertheless, it has been a great help so far, and since I have the opportunity, I'd like to thank you for creating it.

  7. #7
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RPG battle engine help.

    An idea might be to store the enemies in a magicdeque and refer to them by an ID, that you spread at the start of the battle.
    The magic deque allows you to run a "for each" on every item in it. So if it contains the IDs of the enemies, even if you add or remove enemies later, it will only call those that are actually stored in it.
    E.g. enemy 0, enemy 1, enemy 2
    "For each" would give you 0, 1, 2, each on a separate call, which you can use to identify the according object.
    Now let's say enemy 1 dies - then the "for each" would give you 0, 2. Only if you need to add enemies during battles (let's say you can summon creatures or whatever), then you need a counter to track the highest ID, so when a new enemy is added, the counter is raised by 1 and the new value is used for the ID.
    _________
    MagicDeque rules!

  8. #8
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Paul_Boland's Avatar
    Join Date
    Jun 2006
    Location
    Waterford, Ireland.
    Posts
    2,739
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RPG battle engine help.

    Quote Originally Posted by Meanderer
    I've actually been using that, although I'm reluctant to just copy it wholesale, so I'm trying to refer to it only when I'm completely stumped.

    Unfortunately it's coded under the assumption that you'll always be fighting the same number and type of enemies, so it didn't contain the answer to this particular problem. Nevertheless, it has been a great help so far, and since I have the opportunity, I'd like to thank you for creating it.
    Thanks very much, much appreciated.
    Random has given you a suggestion there. To alter my TBBS look at how the system functions when a character dies. Although it begins with five characters battling, it does widdle its way down as they die.
    KnightTrek Productions
    http://www.knighttrek.com

  9. #9
    No Products Registered

    Join Date
    May 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RPG battle engine help.

    Rather than add any more RPG help threads to the forum than there currently are, I'm just going to go ahead and bump this one.

    I have reached the stage of coding attacks for each of the characters, and I find myself in a bit of difficulty.

    Let's suppose that there are 9 characters to choose from and each of them have 10 special attacks with differing effects, in addition to the standard "Attack" action. Obviously, writing an individual event for each and every attack would be an extremely inelegant way of going about this.

    What I want to do, therefore, is have each attack stored in an external file, with data containing certain parameters that the program itself will check against. For example, one parameter may tell the program whether the attack hits a single target or all enemies on the screen. This in and of itself wouldn't be too difficult, but the problem lies in expressions and calculations.

    Suppose I have one attack that causes damage equal to the character's "Strength" stat x10. For the sake of this example we'll assume that the strength of this character is stored in a Global Value, "Char1Strength". (That's not how I'm actually doing it, but it'll work to illustrate my point.)

    Now suppose I had an ini file, and I set the "Damage" item of this attack to "Char1Strength * 10". Would MMF actually interpret this as a calculation and work out the result of the "Char1Strength" value multiplied by 10, or would it just assume that the "Damage" item is a string saying "Char1Strength * 10"?

    If it's the latter, is there some other means of setting such expressions externally? Or does anyone have any alternative suggestions as to how to go about solving the problem?

  10. #10
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RPG battle engine help.

    That won't work indeed. I recommend, for your purpose, use the lua or .net extension. There you can do such things. "Just" write a script that maintains objects for your characters and holds their attributes (e.g. strength).. and another that contains functions for the attack rules.
    e.g. some pseudo code:

    Code:
    function Attack1Damage (char : Character) : int {
      return(char.Strength * 10);
    }

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Boss battle help
    By pyrothos in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 18th December 2011, 10:48 PM
  2. Battle damage
    By Twario in forum The Games Factory 2 - Technical Support
    Replies: 4
    Last Post: 5th July 2010, 06:36 AM
  3. Card Battle!!
    By Gimbabwe in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 31st May 2010, 06:30 PM
  4. I need help with a battle menu thingy
    By Ganryu in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 16th October 2008, 03:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •