Jump to content

Opcode 301: Critical Hit modifier


kreso

Recommended Posts

Here's the ideas for now:

 

 

Bows - 1 round, -10 THAC0 penalty (need a name for it still)

Dagger - Pierced - 1 round feeblemind

Axe - Wide open - 1 round, -10 AC

Crossbow - Nailed - Movement disabled for 1 round

Small Sword - Piercing - 1d6 piercing damage which bypasses physical resistance

Staff - Cracked Rib - -2 to STR & DEX, Movement set to half, 2 rounds duration

Halberd - Disembowel - -2 CON, +6 slashing damage, 1 round

Flail - Armor Dent - -4 AC, 3 rounds

Hand to Hand - Terrible Bruise - 2d6 non-leathal damage

Mace - Low Blow - -2AC, Damage, and all saves, 2 rounds

Slings - Nerve Clutter - 1 round stun

Darts - Bleeder - 1 round, 1damage/sec

Morning Star - Solid Blow - +1D4 crushing +1D4 piercing damage

Hammer - Knockback

 

 

Link to comment

Sample preview. I'm not really happy with the string displayed, if anybody has better ideas spit them out. :)

I'll probably add some graphical effect to the effects as well.

 

bruise_zps4omcnac8.jpg

 

wide_zpsou9pxcas.jpg

Link to comment

Don't know if this bothers you, but setting a 5% chance to do these crits will not perfectly replicate the vanilla chance of crits. If you can only hit someone with a 19 or 20, then in vanilla you'll do crits half the time you hit. Your system rolls to hit, and then only applies crits to 5% of the successful ones.

 

That said, your math is probably better (if your thac0 is so bad, what business do you have doing crits half the time??) and I *love* the general idea of per-weapon crit effects. I don't agree with every choice made (I figure maces should dent armor, flails should do some kind of thrashing effect, maybe trip) but great ideas anyway.

 

I also like that it gets away from the stupid vanilla system where wearing a helmet makes you immune to crits. Keep it up!

Link to comment

Don't know if this bothers you, but setting a 5% chance to do these crits will not perfectly replicate the vanilla chance of crits. If you can only hit someone with a 19 or 20, then in vanilla you'll do crits half the time you hit. Your system rolls to hit, and then only applies crits to 5% of the successful ones.

Actually, for now weapons crit all the time :D. Testing phase and all....

I'm not overly eager to replicate the 5% chance, and the chance will probably be slightly higher (short swords/daggers will certainly have a better chance than large swords etc.). Balancing this out perfectly will probably be impossible, hence I use relatively short durations for the effects.

What *does* bother me is that I generally play with To-Hit rolls visible on screen, and effect can trigger on any roll that hits. Ofc, I'd prefer rolls of 19/20, but in BG2 engine that's not really possible. IWDEE *does* have an opcode for critical effect.

Using this also has a side-effect that even a roll of 20 is no longer an auto-hit. Effect of this is that some Full-plated-sword&shield-buffed warrior will be able to wade in 100+ Gnolls and slay them all without taking a single damage point, since they'll be unable to ever hit him. :kungfu:

 

I don't agree with every choice made

Neither do I....

I also lack some idea for spears- first what crossed my mind was pinning, but there's already Ixil with the very same effect :undecided: .

 

 

I figure maces should dent armor, flails should do some kind of thrashing effect, maybe trip) but great ideas anyway.

Probably yes, but clubs shouldn't really dent anything but heads :D .

I'll think about it more. I can alter effects/probabilities very quickly, so making on-the-fly adjustments won't be too hard.

 

 

I also like that it gets away from the stupid vanilla system where wearing a helmet makes you immune to crits. Keep it up!

That's Demi's idea originally.

What I don't like about it is that you can die so very quickly in BG1 that it's really not funny when it happens (especially with SCS when Gnolls/Hobgoblins crit 10% of attacks).

I also don't like that 1gp helmet keeps you safe from crits (moreover since so many oponnents have enchanted swords and similar, yet don't have the coin to buy some headgear?!); just as much as I don't like a HLA (Critical Strike) being either utterly overwhelming or virtually useless.

I've tweaked it to a flat +8 damage and changed the description accordingly.

With ToBex, I think I can do better - add 50% to damage roll. That would however make the mod non-EE compatible...hmm.

Link to comment

Here's what I made for now:

Critical effects have a 10% chance of occuring when a character is hit (this will have some side-effects:

a) you won't be seeing that much in BG1 since you'll be missing often.

b) you'll see much more in ToB with a dual-wielder

I kind of think it's fine this way. A high-level warrior should be able to crit more often that a level 1 Candlekeep ranger.

 

All effects that don't mess with stats like STR, DEX and similar last for one round.

Crossbows, short swords, spears (melee) and bows are except from that rule, and have 15% chance (crossbow, spear and short sword) and 5% (bow) to score a "critical".

All critical effects display only name of the effect, there's no more "critical hit" displayed. Imo looks better.

Spears will use "Leg Swipe" (1 round sleep, -2 DEX for two rounds).

I'm undecided about ranged version of weapons. Throwing spears won't Swipe anyone, but could puncture a lung or similar (100% spell failure for the next round).

Character hit by an effect will "glow" for as long as the effects are on him. Likewise, if the effect occurs, animation will be visible upon hit.

swip_zpsxftxtqmo.jpg

 

Koshi is having a blast today. :D

I'll upload the first public version in a few days - I still need eff targeting and a code to patch IR's equipment which gives immunity to criticals, but it shouldn't be too hard to do.

Link to comment

So far so good. I need help with some scripting. Basically, I need a script which forces a spell on created PCs to have the same critical hit rules as everybody else. Is editing area scripts an ok way to do it? (Candlekeep, Irenicus Dungeon, ToB talking heads area). Is there a better way to do it?

The code I use is this:

 

IF
OnCreation()
THEN
RESPONSE #100
ActionOverride(Player1,ReallyForceSpellRES("K1CL820",Myself)) // -2 to critical hit chance permanent
Continue()
END

rinse and repeat up to player 6.

 

Should I use EXTEND_TOP or EXTEND _BOTTOM for relevant areas?

Link to comment

Any reason not to simply AP_ the effect in every class's CLAB file?

That would effect a lot of creatures, but not all of them. I assume kreso needs everyone, and that's easy to do with editing every .cre file in the game, which leaves the Player Characters out, which is where the area scripting comes in. See ?

Link to comment

Any reason not to simply AP_ the effect in every class's CLAB file?

I had a pretty good reason, but I forgot about it...aha. Mage CLABs. I can't patch what's not there (it is currently in my game, but that's beside the point.)

I'm not sure if sorcerer's CLAB exists either, I haven't found one in any case....

Anyhow; I made the code, seems to be working. My first attempt was that Gorion (standing in front of Candlekeep) casts this spell on you :D.

It actually worked! I also found out why the Lightning Bolt he casts at you if you provoke him kills you instantly; cheesy bastard.

Now I use this:

COPY_EXISTING ~ar0015.bcs~ ~override/ar0015.bcs~ // Candlekeep
EXTEND_BOTTOM ~ar0015.bcs~ ~criticals/baf/script.baf~
COPY_EXISTING ~ar4000.bcs~ ~override/ar4000.bcs~ // Irenici dungn
EXTEND_BOTTOM ~ar4000.bcs~ ~criticals/baf/script.baf~
COPY_EXISTING ~ar0602.bcs~ ~override/ar0602.bcs~ // Tob Heads
EXTEND_BOTTOM ~ar0602.bcs~ ~criticals/baf/script.baf~

BAF file:

IF
OnCreation()
THEN
RESPONSE #100
ActionOverride(Player1,ReallyForceSpellRES("K1CL820",Myself))
Continue()
END
IF
OnCreation()
THEN
RESPONSE #100
ActionOverride(Player2,ReallyForceSpellRES("K1CL820",Myself))
Continue()
END

 

 

....and up to Player6. In-game NPCs such as Minsc, Saerilteh and Chloe :rolleyes: are already patched, so for as long as the mod is installed after any creature/item adding mods, there shouldn't really be a problem I think.

If you start a BGT game and play up to ToB with the same PC the effect will be added three times. This doesn't really affect anything however, there's no difference in -2, -4 or -6 critical modifier. You can't crit in any case. In addition, the opcode is non-cumulative by itself.

About this modifier, IR adds a few items which increase critical hit chance. The highest used is 10% (+2) used on Silver sword. I think I should remove all such instances and replace them with the effect I use on respective weapon.

Hence, Silver Sword; being a Large Sword, has an on-hit Flay with 10% chance. It should use Flay with 20% chance now.

There are also thieving gloves which add 5%. I don't know what to do about those....I can't *add* +5% chance for any weapon. :undecided:

I should probably add game checks for different setups (EE, EE2, BGT, BG2).

 

Link to comment

This is the spell that grants

 

That would effect a lot of creatures, but not all of them. I assume kreso needs everyone, and that's easy to do with editing every .cre file in the game, which leaves the Player Characters out, which is where the area scripting comes in. See ?

 

No.

 

You could also just do this in your installation .tp2:

COPY_EXISTING_REGEXP GLOB ~^.+\.cre$~ ~override~
    PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
        LPF ADD_CRE_EFFECT INT_VAR opcode = x parameter1 = 3y timing=9 END
    END
    BUT_ONLY

...using setting to mimic your spells that decreases crit chance by 2.

 

Then put the spell into a line in a text file that looks like:


ABILITY       AP_K1CL820   ****        ****        ****       

...etc. out to 50 columns. (Note the return, so the word "ABILITY" is on the 2nd line of the file.) Call it critchance.txt.

 

Then you add this to the .tp2:

COPY_EXISTING ~clabfi01.2da~ ~override~
        ~clabpa01.2da~ ~override~
        ~clabrn01.2da~ ~override~
        ~clabpr01.2da~ ~override~
        ~clabba01.2da~ ~override~
        ~clabth01.2da~ ~override~
        ~clabmo01.2da~ ~override~
    LPM remove_blank_lines
    APPEND_FILE ~mymod/critchance.txt~
    BUT_ONLY
ACTION_IF FILE_EXISTS_IN_GAME ~clabso01.2da~ THEN BEGIN
    COPY_EXISTING ~clabso01.2da~ ~override~
        LPM remove_blank_lines
        APPEND_FILE ~mymod/critchance.txt~
        BUT_ONLY
END
ACTION_IF FILE_EXISTS_IN_GAME ~clabma01.2da~ THEN BEGIN
    COPY_EXISTING ~clabma01.2da~ ~override~
        LPM remove_blank_lines
        APPEND_FILE ~mymod/critchance.txt~
        BUT_ONLY
END
ACTION_IF NOT FILE_EXISTS_IN_GAME ~clabma01.2da~ THEN BEGIN
    COPY ~mymod/clabma01.2da~ ~override~
    COPY ~mymod/clabma02.2da~ ~override~
    COPY ~mymod/clabma03.2da~ ~override~
    COPY ~mymod/clabma04.2da~ ~override~
    COPY ~mymod/clabma05.2da~ ~override~
    COPY ~mymod/clabma06.2da~ ~override~
    COPY ~mymod/clabma07.2da~ ~override~
    COPY ~mymod/clabma08.2da~ ~override~
    COPY ~mymod/clabma09.2da~ ~override~
END
//___________________________________________________________________________________

//CLAB APPENDING SCRIPT______________________________________________________________
//
COPY_EXISTING ~kitlist.2da~ ~override~
        COUNT_2DA_ROWS ~10~ "rows"
        FOR ( index = 1 ; index < rows ; index = index + 1 ) BEGIN
            READ_2DA_ENTRY %index% 5 10 modclab
            READ_2DA_ENTRY %index% 8 10 modclass
            DEFINE_ASSOCIATIVE_ARRAY k1_crit_clabs BEGIN "%modclab%" => "%modclass%" END
        END
        BUT_ONLY
    ACTION_PHP_EACH d5_apr_clabs AS foo => zoo BEGIN
        COPY_EXISTING ~%foo%.2DA~ ~override~
            LPM remove_blank_lines
            APPEND_FILE ~mymod/critchance.txt~
            BUT_ONLY
    END
//__________________________________________________________________________________
CLEAR_ARRAYS

You'll of course make very simple CLAB files for the 9 mage kits with a single ABILITY line matching your critchance.txt file, to use in case they don't already exist.

 

And voila! The crit spell will affect every creature in the game, and all new creatures, including those using mod kits. (This would have to be installed after any mod kits.) And no need to mess with game or area scripts.

Link to comment

The crit spell will affect every creature in the game, and all new creatures, including those using mod kits.

It already does. :)

 

Aynhow, I've ran in a sorta problem again. The dreaded Parse error.

What I want to do is patch IR items (namely, bow07.itm, sw2h15.itm, staf08.itm) with my own effects.

Easy enough, but after 50+ attempts ending in parse errors I'm quite annoyed.

 

The idea is:

a) first remove 301 opcode from any item in the game (this is done beforehand). Easy - peasy.

b) delete 146 applied by all-weapons patch; then patch each of IR items to use 146 again, but with respect to weapon type and critical hit chance increase

 

Now, a) is straight-forward to do. Regexp all items, delete 301 for all of them, done.

But b) is giving me trouble.

 

This little .tp2 won't parse properly:

 

BEGIN ~crapy crap~
COPY_EXISTING ~bow07.itm~ ~override~ BEGIN
LAUNCH_PATCH_FUNCTION ADD_ITEM_EFFECT
INT_VAR
opcode = 146
target = 2
timing = 9
parameter1 = 0
parameter2 = 1
probability1 = 15
insert_point = 0
header = 1
type = 4 //
STR_VAR resource = ~K1CL802~
END
END
END
Link to comment

Rather than deleting and adding effcts, why not just use ALTER_EFFECT? It's great.

LPF ALTER_EFFECT INT_VAR match_opcode=146 STR_VAR resource=~K1CL802~ END
Unless there are two effects using opcode 146, then you'd need to be more selective.

 

There are sometimes. Demi loves to use .spl files on weapons since it's easy to use Pro Spell against them when needed (i.e. Vorpal Sword uses 146 already per it's decapitating effect).

I also need to set probabilities right (that way descriptions i.e. "+10% chance to score critical hits" will still be correct. I don't know how long it would take me to use Alter_Effect to get it done.

Aynhow, I've got the code I need and (more importantly!) that works what I want it to do, now it's a simple Ctrl-C/Ctrl-V to ramp it up with very minor modifications.

Thanks anyway. Wish I could have done a bit more work today, but that Parse crap took 2 hours to get it done....

Link to comment

You may have gotten a parse error from having a BEGIN and END here.

 

COPY_EXISTING ~bow07.itm~ ~override~ BEGIN
  //...
END
And it looks like there is an extra END after that as well. (Components end automatically when a new component BEGINs or when the end of the file is reached.)
Link to comment

(Components end automatically when a new component BEGINs or when the end of the file is reached.)

 

I didn't know that; thanks. If I knew this two days ago I'd probably be done by now. :)

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...