? Battle system. (RPG Style) (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password
💀

Battle system. (RPG Style)

1 2
  • #1 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself I've seen this discussed before but can someone please help me with a battle system. I just need some pointers like. How would I make multiple enemies of different types. I want to create one similar to earthbound. Posted
  • #2 ✎ 478 ToadIsTheBest Video Games I like to play video games! Hobbies Drawing I like to draw! Hobbies Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Maybe store the enemy types in an array or something *Medley of Earthbound™ battle music starts playing In head* Posted
  • #3 ✎ 74 KingCo Avatar Taboo I didn't change my avatar for 180 days Website RNG Hidden Easter Eggs Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength You could have some randomly generated number thing for multiple enemies to load them into the battle system, though that may not be the best way to go about making it. Also, could you specify what you mean exactly by "How would I make multiple enemies of different types"? All that I think it would involve is maybe having different sprites and attacks honestly. And I'm not completely sure how one would go about making a roulette hp bar thing. This just reminds of how I was thinking about making a simple battle engine for a game I was making, so maybe I could try implementing some of the stuff you mentioned in it. Posted
  • #4 ✎ 89 Krondelo There are many ways you could do this. Likely the best way, as mentioned by Toad would be to use an array. DIM TYPE DIM ATTACK[A,AM] Where TYPE is the type of enemy. When you get into a battle use RND, so if a 1 comes up, that's enemy type 1 and so on. Then ATTACK is 2-dimensional, where A is which attack is being used, and AM is the attack damage amount. This is just the beginning though and would not suffice as a very good system on it's own. Rather than just doing a random attack each time you could use a series of IF statements (in lue of a SWITCH CASE) to determine which attack should be used in certain scenarios. Something like: EHP = Enemy HP IF EHP<20 THEN A = DEFENSEUP; ENDIF Also, rather than using a set damage amount or even random, you can use some fairly simple formulas to determine the amount. You can also do something like: If to hit < Toughness/Deflection: Damage = Random(Weapon's min damage, weapons, max damage) - opponent's armor value Else: Damage = Random(Weapon's min damage, weapon's max damage) However, you should start simple, and then decide if you want to implement more complicated formulas. Once you start basing damage calculations on character levels it gets a bit complicated. You can start with a fixed damage system, where damage varies only by weapon. (The damage still varies, it just doesn't matter who uses said weapon) Posted
  • #5 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself
    You could have some randomly generated number thing for multiple enemies to load them into the battle system, though that may not be the best way to go about making it. Also, could you specify what you mean exactly by "How would I make multiple enemies of different types"? All that I think it would involve is maybe having different sprites and attacks honestly. And I'm not completely sure how one would go about making a roulette hp bar thing. This just reminds of how I was thinking about making a simple battle engine for a game I was making, so maybe I could try implementing some of the stuff you mentioned in it.
    I was asking about How would I make each enemy differ from the others. Its kinda hard to explain. I'm not really good with data And when it comes to things like making battle systems I'm no good. What I mean is like have 5 enemy slots And when you have an encounter The slots are filled with random enemy data Such as If EnemyGroup==1 then E1=5:E2=3 Then Slot one would be a bird monster And slot 2 would be a beast. I just don't know how I would go about giving each one a separate HP While making them do the same thing (Battle,heal themselves and etc,) I have trouble will slot things too because idk how data works.
    Posted
  • #6 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself
    There are many ways you could do this. Likely the best way, as mentioned by Toad would be to use an array. DIM TYPE DIM ATTACK[A,AM] Where TYPE is the type of enemy. When you get into a battle use RND, so if a 1 comes up, that's enemy type 1 and so on. Then ATTACK is 2-dimensional, where A is which attack is being used, and AM is the attack damage amount. This is just the beginning though and would not suffice as a very good system on it's own. Rather than just doing a random attack each time you could use a series of IF statements (in lue of a SWITCH CASE) to determine which attack should be used in certain scenarios. Something like: EHP = Enemy HP IF EHP<20 THEN A = DEFENSEUP; ENDIF Also, rather than using a set damage amount or even random, you can use some fairly simple formulas to determine the amount. You can also do something like: If to hit < Toughness/Deflection: Damage = Random(Weapon's min damage, weapons, max damage) - opponent's armor value Else: Damage = Random(Weapon's min damage, weapon's max damage) However, you should start simple, and then decide if you want to implement more complicated formulas. Once you start basing damage calculations on character levels it gets a bit complicated. You can start with a fixed damage system, where damage varies only by weapon. (The damage still varies, it just doesn't matter who uses said weapon)
    Yeah I use a formula like this Attack=Atk+Weapon damage-Enemydefense EnemyHp=EnemyHp-attack I really like your way too though, I might combine the two
    Posted Edited by Z_E_R_O
  • #7 ✎ 89 Krondelo Awesome, yeah just experiment, it will come to you eventually! Posted
  • #8 ✎ 33 Plancake Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies Reading I like to read books! Hobbies Try this: DIM ENGROUP[3,3] RESTORE @GROUPDATA FOR J=0 TO 2 FOR I=0 TO 2 READ ENGROUP[I,J] NEXT NEXT @GROUPDATA DATA 1,5,1 DATA 3,2,5 DATA 1,1,1 You can then set the monster types like this: DIM EN[3] GROUP=0 FOR I=0 TO 2 EN[I]=ENGROUP[GROUP,I] NEXT Can't test it right now, but it should work. Also, don't be afraid to use arrays for everything, the Nintendo 3DS basically has unlimited memory when it comes to making things with SmileBASIC. Posted
  • #9 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself
    Awesome, yeah just experiment, it will come to you eventually!
    Thank you for your help!
    Try this: DIM ENGROUP[3,3] RESTORE @GROUPDATA FOR J=0 TO 2 FOR I=0 TO 2 READ ENGROUP[I,J] NEXT NEXT @GROUPDATA DATA 1,5,1 DATA 3,2,5 DATA 1,1,1 You can then set the monster types like this: DIM EN[3] GROUP=0 FOR I=0 TO 2 EN[I]=ENGROUP[GROUP,I] NEXT Can't test it right now, but it should work. Also, don't be afraid to use arrays for everything, the Nintendo 3DS basically has unlimited memory when it comes to making things with SmileBASIC.
    I'm gonna try that. I haven't been good with arrays but you broke it down really well so I'm gonna try it, Thank you!
    Posted
  • #10 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself
    Try this: DIM ENGROUP[3,3] RESTORE @GROUPDATA FOR J=0 TO 2 FOR I=0 TO 2 READ ENGROUP[I,J] NEXT NEXT @GROUPDATA DATA 1,5,1 DATA 3,2,5 DATA 1,1,1 You can then set the monster types like this: DIM EN[3] GROUP=0 FOR I=0 TO 2 EN[I]=ENGROUP[GROUP,I] NEXT Can't test it right now, but it should work. Also, don't be afraid to use arrays for everything, the Nintendo 3DS basically has unlimited memory when it comes to making things with SmileBASIC.
    So the data setup works how would I use the data arrays Like how would I use this to setup the enemies.
    Posted
  • #11 ✎ 33 Plancake Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies Reading I like to read books! Hobbies Do you mean HP and stuff? This is just for enemy groups. So if enemy 1 was a skeleton and enemy 5 was a goblin, then this: DATA 1,5,1 would make the enemies appear in the order skeleton, goblin, skeleton, in battle. That's all it does. Of course, the enemies that appear would be the ones you make yourself. Posted
  • #12 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself
    Do you mean HP and stuff? This is just for enemy groups. So if enemy 1 was a skeleton and enemy 5 was a goblin, then this: DATA 1,5,1 would make the enemies appear in the order skeleton, goblin, skeleton, in battle. That's all it does. Of course, the enemies that appear would be the ones you make yourself.
    Oh okay, In one case I know how to make them appear like : If EnemyN==1 then spset 0,678 (monster 1) I just don't know how I would take the Data and use it to do something like that Like how would I take the number 1,5,1 and use it Sorry if its annoying I really appreciate your help
    Posted Edited by Z_E_R_O
  • #13 ✎ 33 Plancake Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies Reading I like to read books! Hobbies It's okay, I'll help whenever I'm not busy (with homework and stuff). You don't need to use 1 or 5, it was just an example, you can use sprite numbers, but it'd be hard to remember them if you use them them a lot. I hope that I haven't confused you, and good luck with your game! Posted
  • #14 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself
    It's okay, I'll help whenever I'm not busy (with homework and stuff). You don't need to use 1 or 5, it was just an example, you can use sprite numbers, but it'd be hard to remember them if you use them them a lot. I hope that I haven't confused you, and good luck with your game!
    Would I use the read command to use the numbers Like how would I use the numbers... How would I take the numbers from the array and use them for player data
    Posted
  • #15 ✎ 33 Plancake Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies Reading I like to read books! Hobbies The READ command is for filling the array with data, not reading from it, silly, right? Instead we'd do something like this: DEC HP,EN[0,3]' Decrease player's HP by enemy's attack power 'or this: HP = HEAL[3] 'Player's HP variable becomes the fourth value in the HEAL array Sorry for the extremely late reply, I don't use this site very much. Posted
  • #16 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself
    The READ command is for filling the array with data, not reading from it, silly, right? Instead we'd do something like this: DEC HP,EN[0,3]' Decrease player's HP by enemy's attack power 'or this: HP = HEAL[3] 'Player's HP variable becomes the fourth value in the HEAL array Sorry for the extremely late reply, I don't use this site very much.
    Its okay I appreciate you answering my questions. This is what I needed thank you!
    Posted
  • #17 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself How would I use the Data for making the enemies appear in the battle... Nothing I try is working. Like Say 1= Goblin 2= Beast 3= Snake I set up a data array like @Edata Data 1,2,3 How would I use the data in the loop to make the enemy appear. Posted
  • #18 ✎ 283 spaceturtles Video Games I like to play video games! Hobbies Avatar Block I didn't change my avatar for 30 days. Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Either you READ VAR1,VAR2,VAR3 or READ ARR I think. I haven't messed with multiple data values on the same line. Posted
  • #19 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself I kinda wanna do a slot system. There are four empty slots where enemies could be. Each slot contains a blank enemy HP,Atk,Def,Mana,Sp,Hit rate. Then it fills the slots when data is read, The problem is.. I'm clueless. I don't even know how to start. Posted
  • #20 ✎ 283 spaceturtles Video Games I like to play video games! Hobbies Avatar Block I didn't change my avatar for 30 days. Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Well one way I know how to do that is by loading a dat file with custom data. I'm using something similar for my emulator (load a text-based config which defines a custom instruction set and emulation parameters and load a dat-based BIOS file which contains custom boot code). You can define your enemy data using a text-based configuration file or you can save/load it in the dat format. For an unencrypted text format configuration system you can do the slot thing in a few different ways. One way is to store each slot's data in a separate text file. Let's say it contains the text data "1:1;10" where the first number is level, the second is attack damage, and the third is hp count. The ":" and the ";" designate separation points". You can also use the newline character (CHR$(10)) to make the data multiline. You can even use tags such as "ENEMY0:" which is useful in a single multiline configuration file which contains all the enemy slot data. This can be a bit complicated but it does make editing your enemy data without editing the main code easier. (option 2) A more easier and compact way to do that is to store arrays in dat files. Because it's so easy and simple I'll make a little code example: DIM ENEMY[4,3] 'Four enemy types, three variables per enemy. Of course you don't really need to define the dimensions when loading a file unless you're creating a new one. IF CHKFILE("DAT:ETYPE") THEN LOAD "DAT:ETYPE",ENEMY 'Code for whatever... ENDIF 'More code for whatever such as what to do if there is a missing file (you might want to change ENDIF to ELSEIF)... As you can see the second option is very simple. The first option woulld require a lot more code such as code for determining tags, string management, etc. If you want to make the second option load different files for different slots make multiple 1d arrays and do a bunch of save/load operations for how many slots you want. That's not a good idea because it would get messy. If you don't want to mess around with code each time you want to make changes to an enemy you can make a separate program (or DEF function in the main code) which loads the dat file and has a gui of some type so you can see what stored data there is so you can manipulate it with said gui. TL;DR read everything below (option 2) Posted
1 2