[SB4] BG tile rotating and RPG battle programming?
Root / Programming Questions / [.]
the_squat1115Created:
Hi there, I have a question. (Well, two) I'm working on a new RPG using the map reading and converter engine by rando.
Ok, the first question is: how do I rotate a BG tile as a DATA tile?
I think this should be more explanatory:
Second question: this is a bit more advanced. I need code for an RPG battle complete with enemy AI. Thats too much for me so a bit of help could be appreciated.
My perspective of the RPG Battle system is:
- Turn-based.
- You can use attacks of your characters at any order. (e.g. character 1 attacks, character 3 attacks, character 2 attacks, character 4 attacks, etc.)
- Environmental advantage (e.g. character 1, water element, gets power up because its raining or we are on water)
- Guard-crushing (The enemy is protecting itself from the attacks of character 1, but in one of the attacks, the guard should be cancelled.) (Must be a random event.)
One thing I noticed with your DATA is that you have 355 as your tile. In SB4, that will print the wrong character. You’ll need to add &HE800 to it.Oh, I'm sorry, I didn't told you I was using the SB3 Prototype program as a base for the screenshot I've took.
When it comes to a turn based battle system, I haven’t tried that out before, so I definitely don’t know everything about it. I’d probably have a BATTLE function that lets the player decide a move, then calls a function for the enemy’s turn, then the player’s turn, then checks if it should end the battle. I don’t know if this approach works well, but that’s how I’d go about it.Yeah I think its a good idea to use a BATTLE function and so on. It would be less coding for the menus and its easier to determine if its the turn of the player, or the turn of the enemy. EDIT: Ok so I've tried what you explained to me:
To rotate 90 degrees, you’d want to add &H10000 to the tile number. Like if you had tile &HE801 (or just 1 in SB3) it would become &H1E801 to rotate it 90 degrees in SB4. You probably want to play with the rotation values because I can’t remember them off the top of my head. All I remember is that &H10000 is 90 degrees and they go from &H10000 to &HF0000. About adding things after DATA, I’m unsure about that. I know adding variables does not work, but I haven’t tried constants or numbers.However, this error popped up: Any workaround for this? Thanks in advance.
I’ve made a decent demo of a turn based system for an RPG I was working on. It went well but one thing I found difficult was keeping track of various character/enemy statuses (I.e Strength Up, Poison, etc).
I used a speed stat to determine player order that was similar to an ATB system. Basically, each character and enemy had a timer that was increased by their respective speed stat. When that timer variable reached 100, they would act (instead of a progress bar, the function was instantaneous and timers were paused when an action was being decided). I thought this was a great idea because when you incorporate speed + action frequency, it adds another level of depth rather than player go then enemy go. But added to the complexity of player statuses.
Anyway, I recommend having a plan to incorporate statuses before building the engine. Retroactively adding it creates a nightmare to deal with.
Also, I thought AI was pretty simple by creating behaviors as user defined functions and just assigning those to the enemy sprites (called when the enemy timer reached 100).
Anyway, I recommend having a plan to incorporate statuses before building the engine.What do you mean by statuses? Did you mean that if the enemy attacks with a special type of ability (e.g. electricity) and if a chance of 1/10 happens, the character who was attacked would be paralyzed? Something like that?
What do you mean by statuses? Did you mean that if the enemy attacks with a special type of ability (e.g. electricity) and if a chance of 1/10 happens, the character who was attacked would be paralyzed? Something like that?Yup! It was difficult for me in SB3 because I created the battle function before implementing status effects. So I had to go back through my code and add it... Also, for each status there was a turn counter, so the status effect would disappear after a certain amount of turns passed. It was a pain and more effort than I anticipated. So managing ~10 status effects, timers, and when they were used became cumbersome and I just rebooted the whole thing (never did finish it though).
Yup! It was difficult for me in SB3 because I created the battle function before implementing status effects. So I had to go back through my code and add it... Also, for each status there was a turn counter, so the status effect would disappear after a certain amount of turns passed. It was a pain and more effort than I anticipated. So managing ~10 status effects, timers, and when they were used became cumbersome and I just rebooted the whole thing (never did finish it though).Ok, I think I got the code to do this. The game will detect the type of terrain you are using (e.g. normal grass = &HE8C9). If the game detects that type of grass (normal grass) there would be no power ups for your characters, as that grass is neutral. However, if the snow grass is detected (&HE8CF), the snow attribute will be triggered, which means, if you have a character that has the ice attribute, the power up effect will be triggered. Is my code right? Did I have done something wrong? Thanks in advance.
Ok, I think I got the code to do this. The game will detect the type of terrain you are using (e.g. normal grass = &HE8C9). If the game detects that type of grass (normal grass) there would be no power ups for your characters, as that grass is neutral. However, if the snow grass is detected (&HE8CF), the snow attribute will be triggered, which means, if you have a character that has the ice attribute, the power up effect will be triggered. Is my code right? Did I have done something wrong? Thanks in advance.Ah, is this a tactical turn based game (like Fire Emblem)? If so then yes, the concept should work. Also, I was thinking turn based as in JRPGs like Final Fantasy. I think in the tactical turn based RPG, AI is much more difficult to do.
Ah, is this a tactical turn based game (like Fire Emblem)? If so then yes, the concept should work. Also, I was thinking turn based as in JRPGs like Final Fantasy. I think in the tactical turn based RPG, AI is much more difficult to do.Yup! The RPG is based on the classics of the past (Valkyrie Profile, Final Fantasy...) and the classics of today (Hyperdimension Neptunia, Pokemon...) But in the battle system, its based on the ones you mentioned. You guessed what I was thinking... Here is an example of what I want to achieve: https://www.youtube.com/watch?v=xn-tDQ4hdb0
What are you plugging in TLOAD?Honestly I dont know what are you trying to mean.