![]() |
![]() ![]() ![]() ![]() ![]()
|
Author | Topic: My battle egine. Dont touch my socks |
Jakk |
![]() I was wondering on something. I am putting together a bigger, more complete battle engine. I already made junk like players HP and players attack and defence, and whatever other things I might need. But i need some help with the random combat chooseing... I have it so your attack normal power starts out as a random number between 5 and 10, but I cant figure out how I would sum it up in a attack. Should I make it something like this? if $rand(1; %attackpower%)$ <= 5 then if $rand(1; %defencepower%)$ => 5 The thing does $rand(1;15)$ damage on you. else if %attackpower% => 5 you hit the creature. This is just something i thought up at the top of my head, i am at the library currently, so it isnt very well done. Help will be loved. |
Gautier UK |
![]() personally i dont like using 'Then If' or 'Else If'. last time i tried things like that it didnt work properly. if it works for you then, cool. As far as i can tell, the code looks ok, and should work with only little changes to it |
Computer Whizz |
![]() I wouldn't use strength to decide if you hit or the monster hits. I'd use an accuracy & agility property and compare them. Quite how to calculate the who hits who I don't know really - this is (AFAIK) the single hardest thing about a battle system... Deciding how often a player/monster hits/misses their target. To get the damage then have a strength stat multiplied, have a random number generated, either add or take this away from the number you got from the strength stat, then devide by the defense stat - or something similar. total strength = #strength# (10) * 10... = 100 That's probably the system I will use for damage! Computer Whizz |
I think Im Back |
![]() Ok, since I'm fairly sure I'm one of the few who have made a combat system I'll give a few tips. For single player games you have status variables which you've probably used for your stats. I'm assuming from the demo the basic combat stats you are using are 'attackpower' and 'defensepower'. There are a few different ways to determine if the attack is successfull, the most common in muds and rpgs is dicerolls. In my combat system demo, I used a sum of 100 as a basis for a successful and a random 100-sided dice roll to determine the success rate of the attack. The formula was like this... ATTACKPOWER - DEFENSEPOWER + Dice(1-100) = SUCCESSRATE This means ANYTHING over 100 was a successfull attack, anything under it was a miss. Examples of how it played out clipped straight from my demo are as follows... > attack I think I'm Back > attack stinky > attack stinky I felt the random 1-100 left enough room so that a weak player could still get lucky and hit a player stronger than them, but also it provided for weak hits as well as very strong hits in like strength players and also it was a system that had a look and feel I was familiar with, as some of you may be as well. A more classic rpg way of doing things would be to simply be able to hit anything with a lower 'defensepower' than your 'attackpower'. The damage dealt to the target could be figured out by dividing the 'attackpower' by the 'defensepower'. This would make situations like 'attackpower=6' vs 'defensepower=5' result in very little damage dealt to the target, but as your attack grew, fighting weaker opponents would be easier and easier untill only requiring one blow. This does cause a problem though when dealing with opponents with a higher 'defensepower'. I don't know what all this meant or if it was helpful, but realistically, a combat system can be anything you want, just as your game can be anything you want. If you want your player to have a 25% chance of hitting the target, then just... SET NUMERIC <chance; $rand(1;4)$> However you want it. If you want them to have a 75% chance then just do... SET NUMERIC <chance; $rand(1;4)$> I don't know. I'm retarded, have fun. |
I think Im Back |
![]() P.S. > attack I think I'm Back |
Gautier UK |
![]() so, you do the same thing as you did with the stats. make a numeric variable, when you type /a player or wotever, u make the random number generate, like the stat roller, and if the number is greater than 50, attack from 1-15, if less than 50, miss. you could increase the numeric variable when the player levels up, as well as the attack rating as well. i dont actually know if this may work lol, but its something Cass will probably work on to make better, if not already. |