Jump to content

Opcode 301: Critical Hit modifier


kreso

Recommended Posts

Posted

Can this be used as a negative value?

Example:

Parameter 1# = -2

 

This would (theoretically) make natural roll neccecary to score a critical hit 22, which is impossible (that's what I want to do). Possible?

Yes it's possible. I've made it -20. :D

 

Download.

Posted

Well, I've tried it out, and it seems to be working. Roll of 20 doesn't shake screen, doesn't display "Critical hit" in combat log, nor does it do double damage anymore. :)

Posted

So theoretically you can do critical hit modifier 10, so half of the hits would be critical hits? Oooh, lovely.

Posted

Yeah, that pretty much how "Critical strike" HLA works. What I wanted to see is if I can remove "natural" critical which occurs on a roll of 20.

Posted

Is this code ok (not breaking anything)?

I've tested it and it works, but I'd like to be sure.

 

 

BEGIN ~remove criticals as they are~
COPY_EXISTING_REGEXP ~.*\.cre~ ~override~
LAUNCH_PATCH_FUNCTION ADD_CRE_EFFECT
INT_VAR
opcode = 301 // Critical hit bonus
timing = 9 //Permanent after death
target = 1 //Self
parameter1 = "-2" //Modifier
resist_dispel = 2 //Not dispellable + bypass resistance
END
BUT_ONLY_IF_IT_CHANGES
Posted

Weapon style bonus. Two-handed and single-weapon add +1 so criticals are scored on 19 and 20.

If only -1, those with this style pips would crit on a roll of 20.

Posted

But if you want to remove criticals completely, then an even lower number is needed to counteract bonuses from spells.

Posted

I don't know of any spell which adds to critical roll apart Critical Strike HLA, which I reworked as well to a flat +8 damage. If only I could dig out a decent name for this ability it would be grand. :rolleyes:

 

Anyhow, is it possible to add 146 (cast spell) opcode to weapons based on the type of damage they do, i.e some kind of patching magic which would add 146 opcode to all blunt weapons to cast spell A, 146 to all piercing to cast spell B, 146 to slashing to cast C etc.?

And if yes, how?

Posted

You could pretty easily do that: patch by item type (maces, flails, clubs, etc) or by proficiency, and use ADD_ITEM_EFFECT. You want on-hit effects? I haven't specifically but it should* work pretty easily.

 

*probably

 

EDIT - You could probably do it by damage type as well, but you might have to account for the damage type being in the extended header, whereas patching by type or proficiency is a simple

READ 0x## ~type~
PATCH_IF ( type = 24 ) BEGIN
ADD_ITEM_EFFECT int_var ...
Posted
What I want to do here is make each weapon type have a "unique" critical hit effect.

Hence the removal of "critical hit" as it appears in the game (flat double damage).


Example:

Bastard swords - 5% chance ("simulates" critical hit probability) for Flay - 1d6 Strenght damage

Flails - Momentum - +2 to damage rolls for 1 round

Short Sword - Penetrating Wound - damage bypasses damage resistance

etc, etc.


I can do this the long way I think, but it won't work for mod-added stuff:

ACTION_FOR_EACH ~file~ IN

~sw1h01~

~sw1h02~

~sw1h03~

~all other bastard swords~


................................................

BEGIN

ACTION_IF FILE_EXISTS_IN_GAME ~%file%.itm~ BEGIN

COPY_EXISTING ~%file%.itm~ override

LAUNCH_PATCH_FUNCTION ~ADD_ITEM_EFFECT~

INT_VAR

opcode = 146 // cast spell

target = 2 // preset target

timing = 2 // instant/equipped

duration = 0

parameter1 = 0 // level

parameter2 = 1 // instantly

probability1 = 100 // probability1: 100

insert_point = 0

STR_VAR resource = ~criticalhitspellforbastardsword~ // resref: (blahblah.SPL)

Posted

Ok, I got this nearly working. However, weapons get patched wrongly - 146 is added to Global Effects, and it should be in melee header.

What am I missing here?

Posted

I can do this the long way I think, but it won't work for mod-added stuff:

ACTION_FOR_EACH ~file~ IN

~sw1h01~

~sw1h02~

~sw1h03~

~all other bastard swords~

See my PATCH_IF code above. I don't know off-hand what offset the item type is at, but it will let you generalize the change instead of using a list.

 

If you have my mod, check in /scales_of_balance/components/580_druid_tweaks for a working example (where I change the usability of flails to allow druids to use them)

Posted

I got that offset thingie from Hex Calculator.... what remains to be done is add the 146 to Melee header, not in weapon Global Effects.

Posted

what remains to be done is add the 146 to Melee header, not in weapon Global Effects.

Got it. I browsed Mike's code which makes IR weapons break in BG1; I was missing this:

header = 1 // add to first header

(yea, I'm a Weidu idiot.....).
Now I need to create a bunch of spells (one for each weapon type), a bunch of effs (these spells shouldn't affect creatures w/o proper anatomy), devise some patching code which adds immunity from these spells to Item Revision items which have critical hit immunity, and I'm good to go. :)
@subtle
Thanks - after sorting out missing ENDs I got this code (it works!):

COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~
PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
READ_SHORT ~0x1c~ type
PATCH_IF (type = 20) BEGIN // large sword
LAUNCH_PATCH_FUNCTION ~ADD_ITEM_EFFECT~
INT_VAR
opcode = 146
target = 2
timing = 9
parameter1 = 0
parameter2 = 1
probability1 = 5 (will be 10 for 2-handed weapons)
insert_point = 0
header = 1 // add to first header
type = 1 // melee
STR_VAR resource = ~largeswordcrit~

Now all long, bastard and scimitars have a chance to do whatever I want. :7up:
Maybe I should add a 2nd effect which simulates "critical failure" :) .

Archived

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

×
×
  • Create New...