Description: This script changes the battle system to one found in, say, D&D or d20.
Needs special weapon attack values, as Weapon ATK is radically changed to fit normal PnP procedures.
Demo showing some different style classes, some weapons to play around with, one set of armor that makes sense in the rules, and a quick and dirty way to collect statistic information from the player using events:
I'd post screenshots but it's more of an internal script, not much to see on the outside other than the different numbers that pop up.
Use the Battle Simulator to play around with monster attributes to get a handle on the system, or just start importing all your PnP monsters. The demo is an abandoned project with placeholder screens; scripting is much more fun for me so far.
Brief Explanation:
Statistics (except HP/SP) don't normally go up every level in these kind of systems; a maximum level of 20 sounds about right. You *might* want to hand out 5 bonus points over that span.
I would use a point-based system for magic, eg a first level spell costs 10 SP, a second level spell would cost 20, and so on. If you use items that use common events to learn "skills" for mages, you can also easily limit the amount of known spells by intelligence.
Strength, for normal characters, should be between 3 - 18, with 10 as normal. Some higher level strengths are included for monsters.
Dexterity should also be in the range of 3 - 18, with some higher levels included for completeness.
Both give a +1 bonus to hit per 2 points above 10 and -1 for every two below it. Strength adds damage (but low strength does not detract), dexterity adds/lowers defense.
PDEF --> Armor Class (AC) and should probably be changed via editor to reflect that. 10 is unarmored, 20 is a well-armored knight. A shield should give 1 or 2 AC bonus.
MDEF --> Damage Reduction (DR) and should definitely be changed via editor to avoid confusion. Don't make spells reduced by MDEF because MDEF is no longer really MDEF. It follows the following pattern: --------------------------------------- Damage Reduction Numbers and their Meanings number equals the number on the list +1/4 means damage reduction of four, only +1 magical weapons or better may hit 1-15 = +0/number 16-30 = +1/(number - 15) 31-45 = +2/(number - 30) 46-60 = +3/(number - 45) 61-75 = +4/(number - 60) 76-90 = +5/(number - 75) A +2 weapon will suffer no DR against a +1 enemy or +0 enemy, a +3 weapon will not suffer against a +2, +1, or +0 enemy, and so on. --------------------------------------- Intelligence also should probably go from 3 - 18, for consistency's sake. It is immaterial in normal battle. Agility --> Attack Bonus and should definitely be changed via editor to reflect the change. A good guide is 1 per level for warriors, down to 1 every other level for a mage or other weak fighter. HP should be, at the most, gained at 12 for level per a barbarian, 4 per level for a mage at the least. Wisdom and Charisma don't really factor into battles normally and so are not modelled. Use variables to store these if you want them or script them in. This script is a battle system script not a total conversion (not yet at least). Weapon ATK is no longer a normal numerical value but rather an indicator. See Damage Roll explanation.
To hit rolls are as so: (random number between 1 - 20) - defender's DEX bonus + attacker's STR bonus + attacker's attack bonus - defender's AC + enchantment bonus from weapon
A hit roll over 0 is a hit unless the random number is 1, which is always a miss. A random number of 20 is always a hit and always double damage.
Damage rolls are much more complicated. Damage depends on the weapon. Define the damage of a weapon by giving it an ATK value that corresponds to a defined damage range on the table below. Using a non-defined ATK value will either give zero damage or crash the game, so don't do it, it wouldn't make sense to do so anyway. Obviously states, accessories and armors that increase ATK value are non-sensical. Adding a damage range definition isn't hugely easy, but an example is provided (1d12) for those who wish to do so.
1d6 - 1, for an example, means a six-sided die is simulated, and the resulting value that results has 1 subtracted from it.
Some referrences: 1d3 = fist 1d6 = short sword 1d8 = longsword 2d8 might be an exotic weapon/demon natural weapon
Plans for future on this script: The next step is to make a turn-based Gold-Box style battle system (similar to a SRPG battle system) but that is *way* off in the distance, and would be a seperate script anyway that I would try to make compatible with this one, but not dependent on it. But this could be fun to play around with, so I'm putting it up.
Script Installation: Place in Battler3 replacing def attack_effect(attacker).
PnP Style Combat Script
CODE
def attack_effect(attacker) # Clear critical flag self.critical = false #Explanation: Uses normal PnP style combat #attack --> numerical indicator for damage dice #mdef --> magic damage reduction #for, eg, a succubus that cannot be hit by non- #magical weapons #keep in mind you need +1 weapons to hit +1 creatures #note that it isn't a perfect system for DR #as I use a single number, instead of the regular #2/5 or whatever. #pdef --> AC, base AC is PDEF in system #agi --> attack bonus #Define increase in attack bonus via the class #screen in the editor #Define attack bonuses
if(self.dex < 2) dexbonus = -4 end if(self.dex == 3) dexbonus = -4 end if(self.dex == 4) dexbonus = -3 end if(self.dex == 5) dexbonus = -2 end if(self.dex == 6) dexbonus = -2 end if(self.dex == 7) dexbonus = -1 end if(self.dex == 8) dexbonus = -1 end if(self.dex == 9) dexbonus = 0 end if(self.dex == 10) dexbonus = 0 end if(self.dex == 11) dexbonus = 0 end if(self.dex == 12) dexbonus = 1 end if(self.dex == 13) dexbonus = 1 end if(self.dex == 14) dexbonus = 2 end if(self.dex == 15) dexbonus = 2 end if(self.dex == 16) dexbonus = 3 end if(self.dex == 17) dexbonus = 3 end if(self.dex == 18) dexbonus = 4 end if(self.dex == 19) dexbonus = 4 end if(self.dex == 20) dexbonus = 5 end if(self.dex == 21) dexbonus = 5 end if(self.dex == 22) dexbonus = 6 end if(self.dex == 23) dexbonus = 6 end if(self.dex > 23) dexbonus = 7 end
if(attacker.str < 2) strbonus = -4 end if(attacker.str == 3) strbonus = -4 end if(attacker.str == 4) strbonus = -3 end if(attacker.str == 5) strbonus = -2 end if(attacker.str == 6) strbonus = -2 end if(attacker.str == 7) strbonus = -1 end if(attacker.str == 8) strbonus = -1 end if(attacker.str == 9) strbonus = 0 end if(attacker.str == 10) strbonus = 0 end if(attacker.str == 11) strbonus = 0 end if(attacker.str == 12) strbonus = 1 end if(attacker.str == 13) strbonus = 1 end if(attacker.str == 14) strbonus = 2 end if(attacker.str == 15) strbonus = 2 end if(attacker.str == 16) strbonus = 3 end if(attacker.str == 17) strbonus = 3 end if(attacker.str == 18) strbonus = 4 end if(attacker.str == 19) strbonus = 4 end if(attacker.str == 20) strbonus = 5 end if(attacker.str == 21) strbonus = 5 end if(attacker.str == 22) strbonus = 6 end if(attacker.str == 23) strbonus = 6 end if(attacker.str > 23) strbonus = 7 end #damage rolls #atk of 1 = 1d3 -1 #atk of 2 = 1d4 -1 #atk of 3 = 1d6 -1 #atk of 4 = 1d8 -1 #atk of 5 = 1d10 -1 #atk of 6 = 2d8 -1 #atk of 7 - 12 = corresponding earlier d +0 #atk of 13-18 = corresponding d +1 #and so on till 42 (or +5) #text file included helps with this #1d12 starts at 43 (0) and goes to 48 (+5) #as an example and template for adding #other damage dice #Also gives enchantment bonus enchbonus = 0 #default if attacker.atk == 0 damageroll = (rand(4) +1) end if attacker.atk == 1 damageroll = (rand(4) +0) end if attacker.atk == 2 damageroll = (rand(5) +0) end if attacker.atk == 3 damageroll = (rand(7) +0) end if attacker.atk == 4 damageroll = (rand(9) +0) end if attacker.atk == 5 damageroll = (rand(11) +0) end if attacker.atk == 6 damageroll = (rand(9) + rand(9) +1) end if attacker.atk == 7 damageroll = (rand(4) +1) end if attacker.atk == 8 damageroll = (rand(5) +1) end if attacker.atk == 9 damageroll = (rand(7) +1) end if attacker.atk == 10 damageroll = (rand(9) +1) end if attacker.atk == 11 damageroll = (rand(11) +1) end if attacker.atk == 12 damageroll = (rand(9) + rand(9) +2) end if attacker.atk == 13 damageroll = (rand(4) +2) enchbonus = 1 end if attacker.atk == 14 damageroll = (rand(5) +2) enchbonus = 1 end if attacker.atk == 15 damageroll = (rand(7) +2) enchbonus = 1 end if attacker.atk == 16 damageroll = (rand(9) +2) enchbonus = 1 end if attacker.atk == 17 damageroll = (rand(12) +2) enchbonus = 1 end if attacker.atk == 18 damageroll = (rand(9) + rand(9) +3) enchbonus = 1 end if attacker.atk == 19 damageroll = (rand(3) +3) enchbonus = 2 end if attacker.atk == 20 damageroll = (rand(5) +3) enchbonus = 2 end if attacker.atk == 21 damageroll = (rand(7) +3) enchbonus = 2 end if attacker.atk == 22 damageroll = (rand(9) +3) enchbonus = 2 end if attacker.atk == 23 damageroll = (rand(12) +3) enchbonus = 2 end if attacker.atk == 24 damageroll = (rand(9) + rand(9) +4) enchbonus = 2 end if attacker.atk == 25 damageroll = (rand(4) +4) enchbonus = 3 end if attacker.atk == 26 damageroll = (rand(5) +4) enchbonus = 3 end if attacker.atk == 27 damageroll = (rand(7) +4) enchbonus = 3 end if attacker.atk == 28 damageroll = (rand(9) +4) enchbonus = 3 end if attacker.atk == 29 damageroll = (rand(12) +4) enchbonus = 3 end if attacker.atk == 30 damageroll = (rand(9) + rand(9) +5) enchbonus = 3 end if attacker.atk == 31 damageroll = (rand(4) +5) enchbonus = 4 end if attacker.atk == 32 damageroll = (rand(5) +5) enchbonus = 4 end if attacker.atk == 33 damageroll = (rand(7) +5) enchbonus = 4 end if attacker.atk == 34 damageroll = (rand(9) +5) enchbonus = 4 end if attacker.atk == 35 damageroll = (rand(12) +5) enchbonus = 4 end if attacker.atk == 36 damageroll = (rand(9) + rand(9) +6) enchbonus = 4 end if attacker.atk == 37 damageroll = (rand(4) +6) enchbonus = 5 end if attacker.atk == 38 damageroll = (rand(5) +6) enchbonus = 5 end if attacker.atk == 39 damageroll = (rand(7) +6) enchbonus = 5 end if attacker.atk == 40 damageroll = (rand(9) +6) enchbonus = 5 end if attacker.atk == 41 damageroll = (rand(12) +6) enchbonus = 5 end if attacker.atk == 42 damageroll = (rand(9) + rand(9) +7) enchbonus = 5 end #example of custom added damage dice #this one is 1d12, +0 - +5 #VERY IMPORTANT: #You must add the proper attack numbers #at the check for damage reduction #for a +1 weapon to hit a +1 monster #or a +2 weapon to hit a +1 or +2 #monster if attacker.atk == 43 damageroll = (rand(13) +1) end if attacker.atk == 44 damageroll = (rand(13) +2) enchbonus = 1 end if attacker.atk == 45 damageroll = (rand(13) +3) enchbonus = 2 end if attacker.atk == 46 damageroll = (rand(13) +4) enchbonus = 3 end if attacker.atk == 47 damageroll = (rand(13) +5) enchbonus = 4 end if attacker.atk == 48 damageroll = (rand(13) +6) enchbonus = 5 end #damage reduction check (ugh) #warning many ifs ahead damageroll2 = 0 #default behavior
if self.mdef > 75 if attacker.atk > 36 if attacker.atk < 43 damageroll2 = (damageroll - self.mdef + 75) #takes care of #standard magic weps end end if attacker.atk == 48 #add custom damage dice +5 here like so damageroll2 = (damageroll - self.mdef + 75) end end if self.mdef > 60 if self.mdef < 76 if attacker.atk > 30 if attacker.atk < 37 damageroll2 = (damageroll - self.mdef + 60) end end if attacker.atk > 36 if attacker.atk < 43 damageroll2 = (damageroll) end end if attacker.atk == 47 #+4 for 1d12 custom example damageroll2 = (damageroll - self.mdef + 60) end if attacker.atk == 48 #+5 for 1d12 custom example damageroll2 = (damageroll) end end end if self.mdef > 45 if self.mdef <61 if attacker.atk > 24 if attacker.atk < 31 damageroll2 = (damageroll - self.mdef + 45) end end if attacker.atk > 30 if attacker.atk < 43 damageroll2 = (damageroll) end end if attacker.atk == 46 #+3 for custom example damageroll2 = (damageroll - self.mdef + 45) end if attacker.atk > 46 if attacker.atk <49 #+4, +5 for 1d12 custom example damageroll2 = (damageroll) end end end end if self.mdef > 30 if self.mdef < 46
if attacker.atk > 18 if attacker.atk < 25 damageroll2 = (damageroll - self.mdef + 30) end if attacker.atk > 24 if attacker.atk < 43 damageroll2 = (damageroll) end end end if attacker.atk == 45 #+2 for custom example damageroll2 = (damageroll - self.mdef + 30) end if attacker.atk > 45 if attacker.atk <49 #+3, +4, +5 for 1d12 custom example damageroll2 = (damageroll) end end end
end if self.mdef > 15 if self.mdef < 31 if attacker.atk > 12 if attacker.atk < 19 damageroll2 = (damageroll - self.mdef + 15) end end
if attacker.atk > 18 if attacker.atk < 43 damageroll2 = (damageroll) end end
if attacker.atk == 44 #+1 for custom example damageroll2 = (damageroll - self.mdef + 15) end if attacker.atk > 44 if attacker.atk <49 #+2 +3, +4, +5 for 1d12 custom example damageroll2 = (damageroll) end end end
end if self.mdef > 0 if self.mdef < 16 if attacker.atk < 13 damageroll2 = (damageroll - self.mdef) end if attacker.atk > 12 if attacker.atk < 43 damageroll2 = damageroll end end if attacker.atk == 43 #+0 for custom example damageroll2 = (damageroll - self.mdef) end if attacker.atk > 43 if attacker.atk <49 #+1 - +5 damageroll2 = (damageroll) end end end
end
if self.mdef == 0 damageroll2 = damageroll end damageroll3 = (damageroll2 + strbonus) #calc atkroll1 = (rand(21) +1) atkroll = (atkroll1 -1 + strbonus - dexbonus + attacker.agi + enchbonus) hit_result = (atkroll - self.pdef) > 1 #default if atkroll1 < 2 #critical miss hit_result = false end if atkroll1 == 20 #critical hit hit_result = true end
if hit_result == true self.damage = damageroll3 #crit if atkroll1 == 20 self.damage *= 2 self.critical = true end # Guard correction if self.guarding? self.damage /= 2 end end
# If hit occurs if hit_result == true # State Removed by Shock remove_states_shock # Substract damage from HP self.hp -= self.damage # State change @state_changed = false states_plus(attacker.plus_state_set) states_minus(attacker.minus_state_set) # When missing else # Set damage to "Miss" self.damage = "Miss" # Clear critical flag self.critical = false end # End Method return true end
There. It should work I'm not really sure how many people want to turn RPGMaker XP into a D&D clone but hey.
Edited by: Night_Runer to remove the question marks
This post has been edited by Night_Runner: Oct 10 2010, 02:04 AM
Hey does anyone know where else I might be able to find the demo for this? the link is broken or outdated or something and is no longer available here. I'd like to see how the author configured armor to see if I'm doing it right so if anyone knows where I can find it, please let me know.
Thanks!
__________________________
"Then it comes to be that the soothing light at the end of your tunnel... is just a freight train comin' your way..."
Hey I hope someone reads this because there is some information I need pertaining to this script.
I need to know if the attack value changes that form the different die sizes also apply to the attack powers of enemies as well, or do the enemies use the original algorithm for attack power?
Please, if someone familiar with scripting could look over this script and find out if the enemies attack powers are included in the algorithms for different die sized attacks, then I would extremely grateful. I've tested it and its just too hard for me to tell.
Thanks in advance!
__________________________
"Then it comes to be that the soothing light at the end of your tunnel... is just a freight train comin' your way..."
I encountered an error with this script. I put it in my game, and changed all the values to work, but when I have the character attack, there is an error on line 556. It claims that the method "Guarding" is undefined..
Group: +Gold Member
Posts: 1,525
Type: Scripter
RM Skill: Undisclosed
moodgiesanta accidentally uses self.guarding in his script, instead of self.guarding?
I'll change that in the original, but when the error comes up for you, go into the script editor, and put a ? at the end of the self.guarding and that should fix it
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.