-
Snowboarder
The use of 'random' in an RPG
Hi all!
What I am trying to do is to make a final fantasy/pokemon RPG type battle scene where you selected the attack u want then the computer chooses theirs.
But how do I go about the random attack made by the computer?
Hope you understand what I mean!
Regards,
Stibily
-
Lurker at Heart
I would give a weight to each type of attack for each monster and then work from there. For example, if a monster had two types of attacks, physical and magical, you could give a weight of 70 to physical and 30 to magical, and then pick from there based on a random number.
It would look something like this:
code:
physicalChance = 70;
magicalChance = 30;
monsterAttack = random(99)+1;
if (monsterAttack <= physicalChance){
showMonsterAttack("physical");
}else{
showMonsterAttack("magical");
}
Now this is just a loose sort of example. A lot more could be added to it that would make it a lot cooler.
If you are using MX 2004 then I could go into a whole way of doing it that would be way better, as well as allow for more attack types, by using an object for the attack types, but I think that's for another day... Or at least for later in the day once I've had some coffee.
-
Snowboarder
-
Snowboarder
although...reading through wot u've said....im still not sure how I would set it up...could u send a .fla file?
it would really help
Regards,
Stibily
-
Lurker at Heart
Hahaha, yeah, I could totally do that. Actually I have an RPG sample online that might prove useful to you, just go here:
Xenotrader RPG Sample
Bear in mind that this probably isn't exactly what you are looking for, but it might have some things in it you can use. I will try to get a sample .fla posted that will show exactly what you are looking for. Oh, by the way, what version of flash are you using?
-
Snowboarder
Thx...Im using Flash MX, not 2004.
Hope this isn't too much trouble!
Regards,
Stibily
-
Snowboarder
-
.: Weirded Out :.
How about you take some time out to look at some tutorials, maybe not specifically for making final fantasy in flash, but each aspect of the game. For example, movement, randomization, etc.
I'm sure if you try you could come up with something without relying on someone giving you a .fla.
Oh, and you can EDIT posts.
-
Lurker at Heart
Ah, but if someone is willing to give him the .fla file, why not? I'll never understand why everyone gets so upset when people ask for help.
Anyway, it's late, I just got home, and I still have work to do before bed, but I will try to get something online tomorrow.
-
Snowboarder
-
x2i
I have nearly finished an FFX-2 style ATB engine, i used the example i have included to tell enemies which character to attack using a random number (1 being character 1, 2 being character 2).
You will hopefully be able to incorporate this method into other things like how much HP to take off in 1 hit.
For Example:
hp = random(100)+101;
Will generate a random number between 100 and 200
Hope this helps!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|