Hi guys, im trying to develop an rpg engine. now i have no idea where to start. ive looked at a few examples here but ive got nothing. ive been able to initiate a battle with random enemys to fight but when one enemy is destroyed how does the programming know who goes next. i just have no idea how to do this turn system so if anyone knows that would be awsome. heres a screeny
Though they are written for 1.5. Often while writing the code, I found myself thinking, 'gosh I wish there was an or funtion'. Hope that's of some use. Nice looking btw.
All platforming problems can be mostly solved here:
Don't know where to start? Do what real programmers do, write some pseudocode first, then write the code. Most people try to write code in their head, which is easy when the code is easy, but when you make something bigger, you really have to sort things. It might seem boring to write pseudocode, but 20 mins writing it down saves you 2 months of headaches
Also, pseudocode really helps when you're trying to expand the code and add new features, so you know what to change and where you put it. Doesn't have to be formal or anything, just notes you understand.
Example..
1. Do Player's turn
2. Do Enemy's turn
3. Check HP of Enemy and HP of player
3.1. If both Enemy and Player have > 0 HP, go back to 1
3.2. If Enemy HP < 0, player wins..
3.3. If player HP < 0, player loses..
3.2.1. On win, player dances like a monkey
3.2.2. On win, player gets Random(1000) gold
3.2.3. On win, player gets candy
3.2.4. After they get the lewt, go back to the town map frame
3.4. If both HP < 0, the person with lowest HP loses
..and so on. If you still can't think of a way to do it, add more detail. Like, you could put a note for 3.2.3, e.g.
Comment: 3.2.3 player gets candy, when they win and don't already have a lot
Conditions: Counter("Win")==1, Counter("Candy") < 99
Actions: Add Random(3)+1 to Counter("Candy")
Obviously here, you're going to put a lot more detail in 1 and 2, so go write some separate stuff for them.
E.g.
On player's turn:
1. Is it player's turn to move?
1.1. Set Flag 0 on if it's their turn. Turn off later after player's turn.
2. Display options for player
2.1. If player has "Fireball", show "Fireball" button
2.2. If player knows Healing, show "Heal" button
3. Wait for input from player
4. Check if the input is legal
4.1. If player presses Fireball, but doesn't have enough Mana, go back to 2.
5. Calculate damage, etc
6. End player's turn, turn on enemy's turn
6.1. Turn off Flag 0
And then so on for the enemy's turn. If xhunterko's articles don't help you, be specific about which part you're having trouble with.
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.