Archived

This topic is now archived and is closed to further replies.

Vegadam

Battles like in FF games

Recommended Posts

Ok, I was wondering if someone could point me in the right direction here. Im not asking for code, just hints as to how they do it. All I need to know is how to the make it so that when you are walking around, you will get in fights ocasionaly. And the time between each fight differs. I cant figure out how to make it that random, and I could use some help please. Thanks in advance.

Share this post


Link to post
Share on other sites
There are several ways I can think of doing it. One is time based and the other is movement based.

If I rememeber correctly, you wouldn''t enter a battle in the old FF games if you simply stood still. It seemed like the game would randomly assign a battle every couple of steps. Whenever the player moves, simply generate a random number between 1 and 100:

battle_chance = rand()%100;

If you want the player to enter a battle roughly every 3 steps, see if battle_chance is between 0 and 33. Vary the numbers for different battle frequencies.

Time based could be similar. Say you want the player to enter a battle within 4 to 10 seconds.

int battle_time = rand()%7 + 4;

Once the appropriate number of seconds have passed, enter battle.

Share this post


Link to post
Share on other sites
You might want to extend this to include a modifier based on the tile you are walking on to -- some areas are guaranteed to have NO battles while some are guaranteed to ALWAYS have battles.

Additionally, the modifier could be used to make it so some areas have HARDER monsters and some EASIER.

Share this post


Link to post
Share on other sites