Jump to content

Opcode 301: Critical Hit modifier


kreso

Recommended Posts

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.

Link to comment

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
Link to comment

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?

Link to comment

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 ...
Link to comment
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)

Link to comment

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)

Link to comment

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" :) .
Link to comment

Archived

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

×
×
  • Create New...