Re: RPG battle engine help.
Add a qualifier to the enemy 1's, then tell it to pick 1 of them at random.
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)
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.
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.
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.
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! :D
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.
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?
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);
}
Re: RPG battle engine help.
Ah. That is unfortunate. I was rather hoping that there'd be a way to pull this off without having to learn a programming language I've never used before.
All I can say is I hope this is easy to pick up. Thanks for the suggestion.
Re: RPG battle engine help.
Well, couldn't you store the multipliers in the ini, then have Char1Strength * (pull value from ini)?
You'd have to have a separate event for each totally different equation (like for all Ax + 3, Ax^2, etc.) but it would still be a lot less than one for each attack for each character.
Re: RPG battle engine help.
I could do that and I had considered it, but the problem is that not everything will necessarily conform to a straightforward "This value multiplied by this other value" equation. Heck, not everything will even inflict damage. Some "attacks" may boost your speed or inflict a status effect on your enemies or something entirely different.
Planning out all those parameters in an ini file would be difficult, but then so would learning a new programming language and trying to use that, so I suppose there isn't really an easy way out.
I'll have to do a little more experimentation. Thanks for the responses.
Re: RPG battle engine help.
Well you could state the attack rules within MMF. But for the sake of maintainability I'd recommend against.
Before you make your choice between lua and .net, I'd like to give the hint that the .net extension is more stable (in my experience) and also actively worked on. So I would recommend that one. Besides that I found C# very very easy to learn and knowing it can't hurt (it's the future of windows app development anyway).
Oh well. Those troubles you have here have me ring the "do not make an RPG (and especially not with MMF)" in my ears.. this stuff is clearly tricky to do and there is no easy or straightforward solution, for all I know.
Okay, one thing I could think of, that would work in the "MMF ways" is this - create one different object per attack type. The object creating the attack object would fill in the relevant data (strength, etc.) and the object has events that calculate it's damage / effect upon hitting (or whatever) another object and apply it.