Jump to content


IWD Issues/Fixes


  • Please log in to reply
74 replies to this topic

#1 -Mike-

-Mike-
  • Guest

Posted 08 February 2012 - 11:37 AM

Since I cannot post anything at g3 forum (keep getting 'content encoding error'), I thought, I'll post my findings here.

from: http://forums.gibber...pic=21877&st=15 #20:

5) If I let Marchon of Waterdeep out so he helps me kill tha snakes, when I finally talk to him his response jumps in a strange way to the response you give when you tell him you killed all the snakes.


Suggested fix:
dmarch.dlg state 9 response 0 GOTO 4 -> GOTO 5
ALTER_TRANS DMARCH BEGIN 9 END BEGIN 0 END
BEGIN ~EPILOGUE~ ~GOTO 5~ END

from: http://forums.gibber...pic=21877&st=15 #22,#23:

...Okay, here is an image as a clarification what I meant. As you can see, the journal adding text is wrong. It is in multiple place when talking with Whitcomb. I wonder what the real journal entry should be in this situation?...


Suggested fix:
dwhitcom.dlg state 8 response 0/1 journal entry #1349 -> #34499
ALTER_TRANS DWHITCOM BEGIN 8 END BEGIN 0 1 END
BEGIN ~JOURNAL~ ~#34499~ END

#2 -Mike-

-Mike-
  • Guest

Posted 08 February 2012 - 11:44 AM

Issue with IWD Tweaks:

http://forums.gibber...showtopic=21876 #2:

After installing "Icon Improvments" - item Symbol Sehanine Moonbow is buggy.

It says that x5 Find Traps and Kwow Aligment. Know Aligment is absend and after use Find Traps only 1 time - it is disapperared.


Caused by wrong offset in tp2:

Fix:
all occurances that read like:
...("%abil_off%" + ... + ("%index%" * 0x30))...
need to be changed to:
...("%abil_off%" + ... + ("%index%" * 0x38))...

#3 -Mike-

-Mike-
  • Guest

Posted 08 February 2012 - 12:02 PM

-serrate.itm
Mismatch Damage in description (1D10+3) vs. item (1D10+0)

Suggested fix:
Set item damage bonus to match description

-halbrd01.itm
Mismatch in identified description (Spear) vs. item (Halberd)

Sugested fix:
Item is a plain halberd -> delete identified description (sref# -1)

-Any weapon (e.g. zzz6bc.itm) that should have a damage/thac0 bonus vs. creatures per its description seem to miss these abilities effects, if you look at it using NI. It may be hardcoded in IWD, but how handles 'IWD in BG2' those?

#4 prowler

prowler

    Murloc!

  • Member
  • 417 posts

Posted 09 February 2012 - 10:51 AM

-serrate.itm
Mismatch Damage in description (1D10+3) vs. item (1D10+0)

Suggested fix:
Set item damage bonus to match description

-halbrd01.itm
Mismatch in identified description (Spear) vs. item (Halberd)

Sugested fix:
Item is a plain halberd -> delete identified description (sref# -1)

-Any weapon (e.g. zzz6bc.itm) that should have a damage/thac0 bonus vs. creatures per its description seem to miss these abilities effects, if you look at it using NI. It may be hardcoded in IWD, but how handles 'IWD in BG2' those?


If I understand right: These bugs still are in game even after installing g3-fixpack?

Edited by prowler, 09 February 2012 - 10:51 AM.

Murloc-translator
Coordinator of the Russian BWP Translation Team
Work with SHS, PPG, G3, CoM, Dragon's Hoard, Sorcerer's Place, RPG Dungeon, Arcanecoast.ru, Aerie.ru


#5 -Mike-

-Mike-
  • Guest

Posted 09 February 2012 - 01:58 PM


-serrate.itm
Mismatch Damage in description (1D10+3) vs. item (1D10+0)

Suggested fix:
Set item damage bonus to match description

-halbrd01.itm
Mismatch in identified description (Spear) vs. item (Halberd)

Sugested fix:
Item is a plain halberd -> delete identified description (sref# -1)

-Any weapon (e.g. zzz6bc.itm) that should have a damage/thac0 bonus vs. creatures per its description seem to miss these abilities effects, if you look at it using NI. It may be hardcoded in IWD, but how handles 'IWD in BG2' those?


If I understand right: These bugs still are in game even after installing g3-fixpack?


Yes, since I have g3 IWD fixpack installed.

#6 -Mike-

-Mike-
  • Guest

Posted 09 February 2012 - 02:27 PM

IWD Tweaks, component 'wear multiple protection items', selection 'PnP restrictions':

Issue:
Does not work as intended (set probability to '0'), if the item has multiple AC boni

Cause:
Wrong offset in tp2
this line in macro 'pnp_protection_patch':
WRITE_BYTE ("%fx_off%" + 0x12 + ("%loops%" * 0x38)) 0 // probability
needs to bechanged to:
WRITE_BYTE ("%fx_off%" + 0x12 + ("%loops%" * 0x30)) 0 // probability

#7 prowler

prowler

    Murloc!

  • Member
  • 417 posts

Posted 10 February 2012 - 09:22 AM

-Any weapon (e.g. zzz6bc.itm) that should have a damage/thac0 bonus vs. creatures per its description seem to miss these abilities effects, if you look at it using NI. It may be hardcoded in IWD, but how handles 'IWD in BG2' those?


Hm... I'm not a modder but I want to help 'cause IWD my favourite game.
What about IWD Redrake fixpack? Some items are changed by this mod.

E.g. (from readme) - Arrows of the hand were no different than the Arrows +2. I've changed this, so now Arrows of the hand offer +4 damage vs orcs
- Hellpick, according to its description was used to kill drow wizards. It seems logical to me that the weapon should have bonus against mages. Therefore, +5 damage vs mages.

Can you check this mod and it's damage/thac0 bonus vs. creatures?
http://forums.chosen...sa=view;down=22

Murloc-translator
Coordinator of the Russian BWP Translation Team
Work with SHS, PPG, G3, CoM, Dragon's Hoard, Sorcerer's Place, RPG Dungeon, Arcanecoast.ru, Aerie.ru


#8 -Mike-

-Mike-
  • Guest

Posted 10 February 2012 - 12:08 PM


-Any weapon (e.g. zzz6bc.itm) that should have a damage/thac0 bonus vs. creatures per its description seem to miss these abilities effects, if you look at it using NI. It may be hardcoded in IWD, but how handles 'IWD in BG2' those?


Hm... I'm not a modder but I want to help 'cause IWD my favourite game.
What about IWD Redrake fixpack? Some items are changed by this mod.

E.g. (from readme) - Arrows of the hand were no different than the Arrows +2. I've changed this, so now Arrows of the hand offer +4 damage vs orcs
- Hellpick, according to its description was used to kill drow wizards. It seems logical to me that the weapon should have bonus against mages. Therefore, +5 damage vs mages.

Can you check this mod and it's damage/thac0 bonus vs. creatures?
http://forums.chosen...sa=view;down=22


I've checked the 2 items you mentioned and yes, they've got an effect according to their description in the readme appended.

#9 prowler

prowler

    Murloc!

  • Member
  • 417 posts

Posted 10 February 2012 - 01:12 PM

Now you have suggestions for fix other items (zzz6bc.itm and others)? :rolleyes:

Murloc-translator
Coordinator of the Russian BWP Translation Team
Work with SHS, PPG, G3, CoM, Dragon's Hoard, Sorcerer's Place, RPG Dungeon, Arcanecoast.ru, Aerie.ru


#10 -Mike-

-Mike-
  • Guest

Posted 21 February 2012 - 12:13 PM

Now you have suggestions for fix other items (zzz6bc.itm and others)? :rolleyes:


It needs to be tested, whether the original game items get the mentioned effects applied hardcoded via the IWD engine.
A hint for a special handling could be, that all but 2(3?) file names for items in question starting with 'zz'.

#11 -Mike-

-Mike-
  • Guest

Posted 21 February 2012 - 01:05 PM

IWD Tweak pack:
There are some issues with component 'wear multiple protection items' (missing/wrong items, wrong offsets...).
One problem might be, that obviously the code got copied over from another tweak pack and needed to be adapted in a couple of places to account for the different items in IWD.

I took a different approach, read all items in itemexcl.2da (missing items will be added infront), search for amuletts, rings and cloaks, that grant AC boni (ignore 'Set AC base' items, which might be arguable), copy (used a different file name scheme than the original code) and patch them, as needed.

IMHO an advantage is, that all items added by mods to itemexcl.2da (when installed before tweak pack) will be automatically accounted for.

Whats missing in the code for now are modifications to item descriptions reflecting the removed ac boni. Instead of this, I was thinking more of just popping up a string ('AC boni disabled'), when equipped (if that's possible).

Warning:
This code has only been tested in so far, that all intended patches got applied, looking at the items using NI.

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////												  \\\\\
///// wear multiple protection items				   \\\\\
/////												  \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\

/////												  \\\\\
///// PnP restrictions								 \\\\\
/////												  \\\\\

BEGIN @206001 DESIGNATED 2060 // PnP restrictions
GROUP @9
SUBCOMPONENT @206000 // wear multiple protection items

// this file does nothing, it just allows other mods to detect this component
COPY_EXISTING ~sw1h01.itm~ ~override/cdi02060.g3~

//Add items to itemexcl.2da, if missing
ACTION_FOR_EACH item IN
~amul14~
~bwtalis~
~clck01~
~clck02~
~clck03~
~cloakmi~
~glimglm~
~mantlecs~
~virgin~
~ring06~
~ring07~
~ring25~
~shldrng~
~uring2a~
~uring4b~
~uring5a~
~mirror2~  //Totlm
~cdwuff~   //IWD Item Upgrade
~amfaith~  //auril's bane
~amulcm03~ //auril's bane
BEGIN
ACTION_IF FILE_EXISTS_IN_GAME ~%item%.itm~ THEN
BEGIN
  APPEND ~itemexcl.2da~ ~%item%%TAB%1~ UNLESS ~%item%~
  BUT_ONLY_IF_IT_CHANGES
END
END

//Search for fitting items in itemexcl.2da
OUTER_SET fnd=0
COPY_EXISTING ~itemexcl.2da~ ~override~
COUNT_2DA_COLS rcol
COUNT_2DA_ROWS %rcol% row
FOR (i=1; i<%row%; %i%+=1)
BEGIN
READ_2DA_ENTRY ~%i%~ ~0~ ~%rcol%~ sres
TO_LOWER sres
PATCH_IF FILE_EXISTS_IN_GAME ~%sres%.itm~ THEN
BEGIN
  INNER_ACTION
  BEGIN
   COPY_EXISTING ~%sres%.itm~ ~override~
//PATCH_PRINT ~File: %SOURCE_FILE%~
   PATCH_IF (SOURCE_SIZE>0x71) THEN
   BEGIN
	READ_SHORT 0x1c cat	//Read item categorie
	PATCH_IF (cat= 1) OR   //Amul./Neckl.
			 (cat=10) OR   //Ring
			 (cat=32) THEN //Cloak/Robe
	BEGIN
	 READ_LONG  0x64 ab_off //Read file offset of abilities
	 READ_SHORT 0x68 ab_num //Read # of existing abilities
	 READ_LONG  0x6a fx_off //Read file offset of effects
	 READ_SHORT 0x70 fx_num //Read # of existing effects
	 FOR (ii=0; ii<%fx_num%; %ii%+=1)
	 BEGIN
	  READ_SHORT %fx_off%+%ii%*0x30	  fx_type //Read effect type
	  READ_LONG  %fx_off%+%ii%*0x30+0x08 ac_to //Read Bonus to
	  PATCH_IF %fx_type%=0  AND
			   %ac_to%<0x10 THEN
	  BEGIN
//PATCH_PRINT ~Item found: %sres%.itm~
	   SPRINT $item("%fnd%") ~%sres%~
	   SET %fnd%+=1
	   SET ii=%fx_num%
	  END
	 END
	END
   END
   BUT_ONLY_IF_IT_CHANGES
  END
END
END
BUT_ONLY_IF_IT_CHANGES
//Adapt found items
OUTER_FOR (i=0; i<%fnd%; %i%+=1)
BEGIN
OUTER_SPRINT ires $item("%i%")
ACTION_IF FILE_EXISTS_IN_GAME ~%ires%.itm~ THEN
BEGIN
  //Create file names for copies
  //Scheme: -Add 'c' as first char for copies
  //		-Replace first char of source file name by '1' or '2'
  //Example:
  //Source:  bwtalis.itm
  //1. copy: c1wtalis.itm
  //2. copy: c2wtalis.itm
  OUTER_PATCH ~c%ires% ~
  BEGIN
   WRITE_ASCII 0x01 ~1~
   SPRINT c1ires ~~
   FOR (ii=0; ii<8; %ii%+=1)
   BEGIN
	READ_ASCII %ii% chr (1)
	PATCH_IF (~%chr%~ STRING_EQUAL ~ ~ =0) BEGIN SPRINT c1ires ~%c1ires%%chr%~ END ELSE
	BEGIN SET ii=8 END
   END
   WRITE_ASCII 0x01 ~2~
   SPRINT c2ires ~~
   FOR (ii=0; ii<8; ii+=1)
   BEGIN
	READ_ASCII %ii% chr (1)
	PATCH_IF (~%chr%~ STRING_EQUAL ~ ~ =0) BEGIN SPRINT c2ires ~%c2ires%%chr%~ END ELSE
	BEGIN SET ii=8 END
   END
  END
  //Create copies, patch
  COPY_EXISTING ~%ires%.itm~ ~override/%ires%.itm~
				~%ires%.itm~ ~override/%c1ires%.itm~
				~%ires%.itm~ ~override/%c2ires%.itm~
  PATCH_IF (SOURCE_SIZE>0x71) THEN
  BEGIN
   //Insert ability 'Magical' with effect 'Create inventory item'
   //Only source file
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~%SOURCE_RES%~ =0) THEN
   BEGIN
	READ_LONG  0x64 ab_off //Read file offset of abilities
	READ_SHORT 0x68 ab_num //Read # of existing abilities
	READ_LONG  0x6a fx_off //Read file offset of global effects
	READ_SHORT 0x68 fx_idx //Read first global effects idx
	READ_SHORT 0x70 fx_num //Read # of existing global effects
	READ_ASCII 0x3a icon (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> //Read name of icon resource
	PATCH_IF %ab_num%=0 THEN
	BEGIN
	 SET ab_off=0x72
	 WRITE_LONG 0x64 %ab_off% //Write file offset of abilities
	END
	PATCH_IF %fx_num%=0 THEN
	BEGIN
	 SET fx_off=%ab_off%+%ab_num%*0x38
	 WRITE_LONG 0x6a %fx_off% //Write file offset of global effects
	END
	SET fx_num_max=%fx_idx%+%fx_num%
	//Find last effect index for insertion
	FOR (ii=0; ii<%ab_num%; %ii%+=1)
	BEGIN
	 READ_SHORT %ab_off%+%ii%*0x38+0x20 ab_fx_idx //Read ability effect index
	 READ_SHORT %ab_off%+%ii%*0x38+0x1e ab_fx_num //Read # of ability effects
	 PATCH_IF (%ab_fx_idx%+%ab_fx_num%)>%fx_num_max% BEGIN fx_num_max=%ab_fx_idx%+%ab_fx_num% END
	END
	//Insert new effect
	SET fx_off_add=%fx_off%+%fx_num_max%*0x30
	INSERT_BYTES		  %fx_off_add%	  0x30		   // New effect
	WRITE_SHORT		   %fx_off_add%	  122			// Type: Create inventory item
	WRITE_BYTE			%fx_off_add%+0x02 1			  // Target: Self
	WRITE_BYTE			%fx_off_add%+0x0c 1			  // Timing mode: Instant/Permanent until death
	WRITE_BYTE			%fx_off_add%+0x12 100			// Probability 1: 100
	WRITE_EVALUATED_ASCII %fx_off_add%+0x14 ~%c1ires%~ (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> // Resource
	PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc]1.+$~ =0) THEN
	BEGIN
	 WRITE_EVALUATED_ASCII %fx_off_add%+0x14 ~%c2ires%~ (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> // Resource
	END
	PATCH_IF %ab_off%>%fx_off% THEN //Unlikely, but possible?
	BEGIN
	 SET %ab_off%+=0x30 //Add file offset of global effects
	 WRITE_LONG 0x64 %ab_off% //Write file offset of global effects
	END
	//Insert new ability
	SET ab_off_add=%ab_off%+%ab_num%*0x38
	INSERT_BYTES		  %ab_off_add%	   0x38		 // New ability
	WRITE_BYTE			%ab_off_add%	   3			// Type: Magical
	WRITE_BYTE			%ab_off_add%+ 0x01 1			// ID to use?: Yes
	WRITE_SHORT		   %ab_off_add%+ 0x02 3			// Location: Item slots
	WRITE_EVALUATED_ASCII %ab_off_add%+ 0x04 ~%icon%~ (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> // Icon
	WRITE_SHORT		   %ab_off_add%+ 0x0c 5			// Target: Caster
	WRITE_SHORT		   %ab_off_add%+ 0x0e 1			// Range: 1
	WRITE_SHORT		   %ab_off_add%+ 0x1e 1			// # effects: 1
	WRITE_SHORT		   %ab_off_add%+ 0x20 %fx_num_max% // First effect index
	WRITE_SHORT		   %ab_off_add%+ 0x22 1			// # charges: 1
	WRITE_BYTE			%ab_off_add%+ 0x24 1			// When drained: Item vanishes
	WRITE_SHORT		   %ab_off_add%+ 0x2a 1			// Projectile: None
	SET %ab_num%+=1 //Increment # of existing abilities
	WRITE_SHORT 0x68 %ab_num% //Write # of existing abilities
	PATCH_IF %fx_off%>=%ab_off% THEN
	BEGIN
	 SET %fx_off%+=0x38 //Add file offset of global effects
	 WRITE_LONG 0x6a %fx_off% //Write file offset of global effects
	END
	//Set # of charges to items found on creatures or areas
	//No idea, why this needs to be done...
	INNER_ACTION
	BEGIN
	 COPY_EXISTING_REGEXP GLOB ~^.+\.cre$~ ~override~
							   ~^.+\.are$~ ~override~
	 PATCH_IF (~%SOURCE_FILE%~ STRING_MATCHES_REGEXP ~^.+\.cre$~ =0)
	 BEGIN
	  READ_LONG 0x324 "itm_off" ELSE 0
	  READ_LONG 0x328 "itm_num" ELSE 0
	 END ELSE
	 BEGIN
	  READ_LONG  0x78 "itm_off" ELSE 0
	  READ_SHORT 0x76 "itm_num" ELSE 0
	 END
	 FOR (ii=0; ii<%itm_num%; %ii%+=1)
	 BEGIN
	  READ_ASCII %itm_off%+%ii%*0x14 item //Read item resource
	  PATCH_IF (~%item%~ STRING_MATCHES_REGEXP ~%ires%~ =0) THEN
	  BEGIN
	   READ_SHORT %itm_off%+%ii%*0x14+0x0a+(%ab_num%-1)*2 chrgs //Read # of charges
	   PATCH_IF %chrgs%=0 THEN
	   BEGIN
		WRITE_SHORT %itm_off%+%ii%*0x14+0x0a+(%ab_num%-1)*2 1 //Write # of charges
	   END
	  END
	 END
	 BUT_ONLY_IF_IT_CHANGES
	END
   END
   //Set 'Lore'=0
   //Only copies
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc][12].+$~ =0) THEN
   BEGIN
	WRITE_SHORT 0x42 0 //Set 'Lore'
   END
   //Remove armor class bonus
   //Only copies c1*.*
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc]1.+$~ =0) THEN
   BEGIN
	FOR (ii=0; ii<%fx_num%; %ii%+=1)
	BEGIN
	 READ_SHORT %fx_off%+%ii%*0x30 fx_type
	 PATCH_IF %fx_type%=0 THEN
	 BEGIN
	  READ_LONG %fx_off%+%ii%*0x30+0x08 ac_to //Read Bonus to
	  PATCH_IF %ac_to%<0x10 THEN
	  BEGIN
	   DELETE_BYTES %fx_off%+%ii%*0x30 0x30 //Delete global effect
	   SET %ii%-=1 //Decrement loop counter
	   SET %fx_num%-=1 //Decrement # of effects
	   WRITE_SHORT 0x70 %fx_num% //Set # of effects
	   FOR (iii=0; iii<%ab_num%; %iii%+=1)
	   BEGIN
		READ_SHORT  %ab_off%+%iii%*0x38+0x20  ab_fx_idx //Read ability effect index
		SET %ab_fx_idx%-=1 //Decrement ability effect index
		WRITE_SHORT %ab_off%+%iii%*0x38+0x20 %ab_fx_idx% //Write ability effect index
	   END
	   PATCH_IF %ab_off%>%fx_off% THEN
	   BEGIN
		SET %ab_off%-=0x30
		WRITE_LONG 0x64 %ab_off% //Write new file offset of abilities
	   END
	  END
	 END
	END
   END
   //Add item to itemexcl.2da
   //Only copies c2*.*
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc]2.+$~ =0) THEN
   BEGIN
	INNER_ACTION
	BEGIN
	 APPEND ~itemexcl.2da~ ~%DEST_RES%%TAB%1~ UNLESS ~%DEST_RES%~
	 BUT_ONLY_IF_IT_CHANGES
	END
   END
  END
  BUT_ONLY_IF_IT_CHANGES
END
END

/////												  \\\\\
///// no restrictions								  \\\\\
/////												  \\\\\

BEGIN @206100 DESIGNATED 2061 // no restrictions
GROUP @9
SUBCOMPONENT @206000 // wear multiple protection items

// this file does nothing, it just allows other mods to detect this component
COPY_EXISTING ~sw1h01.itm~ ~override/cdi02061.g3~

//Remove rings, amuletts, cloaks from itemexcl.2da
COPY_EXISTING ~itemexcl.2da~ ~override~
COUNT_2DA_COLS rcol
COUNT_2DA_ROWS %rcol% row
FOR (i=%row%-1; i>0; i=%i%-1)
BEGIN
READ_2DA_ENTRY ~%i%~ ~0~ ~%rcol%~ sres
TO_LOWER sres
PATCH_IF FILE_EXISTS_IN_GAME ~%sres%.itm~ THEN
BEGIN
  SET det=0 //Reset detection count
  INNER_ACTION
  BEGIN
   COPY_EXISTING ~%sres%.itm~ ~override~
   PATCH_IF (SOURCE_SIZE>0x71) THEN
   BEGIN
	READ_SHORT 0x1c cat
	PATCH_IF (cat= 1) OR
			 (cat=10) OR
			 (cat=32) THEN
	BEGIN
	 READ_LONG  0x6a fx_off //Read file offset of effects
	 READ_SHORT 0x70 fx_num //Read # of existing effects
	 FOR (ii=0; ii<%fx_num%; %ii%+=1)
	 BEGIN
	  READ_SHORT %fx_off%+%ii%*0x30 fx_type //Read effect type
	  PATCH_IF %fx_type%=0 THEN
	  BEGIN
	   READ_LONG %fx_off%+%ii%*0x30+0x8 ac_type //Read AC bonus type
	   PATCH_IF %ac_type%!=0x10 THEN //AC bonus type != Set base AC
	   BEGIN
		SET det=det+1
	   END
	  END
	 END
	END
   END
  END
  PATCH_IF %det%>0 THEN
  BEGIN
   REMOVE_2DA_ROW ~%i%~ ~%rcol%~
  END
END
END
BUT_ONLY_IF_IT_CHANGES



#12 -Mike-

-Mike-
  • Guest

Posted 21 February 2012 - 03:38 PM

Tested in game, item with ac bonus did not get recreated, code corrected

  //Create copies, patch
  COPY_EXISTING ~%ires%.itm~ ~override/%ires%.itm~
				~%ires%.itm~ ~override/%c1ires%.itm~
				~%ires%.itm~ ~override/%c2ires%.itm~
  PATCH_IF (SOURCE_SIZE>0x71) THEN
  BEGIN
   READ_LONG  0x64 ab_off //Read file offset of abilities
   READ_SHORT 0x68 ab_num //Read # of existing abilities
   READ_LONG  0x6a fx_off //Read file offset of global effects
   READ_SHORT 0x68 fx_idx //Read first global effects idx
   READ_SHORT 0x70 fx_num //Read # of existing global effects
   //Insert ability 'Magical' with effect 'Create inventory item'
   //Only source file
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~%SOURCE_RES%~ =0) THEN
   BEGIN
	PATCH_IF %ab_num%=0 THEN
	BEGIN
	 SET ab_off=0x72
	 WRITE_LONG 0x64 %ab_off% //Write file offset of abilities
	END
	PATCH_IF %fx_num%=0 THEN
	BEGIN
	 SET fx_off=%ab_off%+%ab_num%*0x38
	 WRITE_LONG 0x6a %fx_off% //Write file offset of global effects
	END
	SET fx_num_max=%fx_idx%+%fx_num%
	//Find last effect index for insertion
	FOR (ii=0; ii<%ab_num%; %ii%+=1)
	BEGIN
	 READ_SHORT %ab_off%+%ii%*0x38+0x20 ab_fx_idx //Read ability effect index
	 READ_SHORT %ab_off%+%ii%*0x38+0x1e ab_fx_num //Read # of ability effects
	 PATCH_IF (%ab_fx_idx%+%ab_fx_num%)>%fx_num_max% BEGIN fx_num_max=%ab_fx_idx%+%ab_fx_num% END
	END
	//Insert new effect
	SET fx_off_add=%fx_off%+%fx_num_max%*0x30
	INSERT_BYTES		  %fx_off_add%	  0x30		   // New effect
	WRITE_SHORT		   %fx_off_add%	  122			// Type: Create inventory item
	WRITE_BYTE			%fx_off_add%+0x02 1			  // Target: Self
	WRITE_BYTE			%fx_off_add%+0x0c 1			  // Timing mode: Instant/Permanent until death
	WRITE_BYTE			%fx_off_add%+0x12 100			// Probability 1: 100
	WRITE_EVALUATED_ASCII %fx_off_add%+0x14 ~%c1ires%~ (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> // Resource
	PATCH_IF %ab_off%>%fx_off% THEN //Unlikely, but possible?
	BEGIN
	 SET %ab_off%+=0x30 //Add file offset of global effects
	 WRITE_LONG 0x64 %ab_off% //Write file offset of global effects
	END
	//Insert new ability
	READ_ASCII 0x3a icon (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> //Read name of icon resource
	SET ab_off_add=%ab_off%+%ab_num%*0x38
	INSERT_BYTES		  %ab_off_add%	   0x38		 // New ability
	WRITE_BYTE			%ab_off_add%	   3			// Type: Magical
	WRITE_BYTE			%ab_off_add%+ 0x01 1			// ID to use?: Yes
	WRITE_SHORT		   %ab_off_add%+ 0x02 3			// Location: Item slots
	WRITE_EVALUATED_ASCII %ab_off_add%+ 0x04 ~%icon%~ (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> // Icon
	WRITE_SHORT		   %ab_off_add%+ 0x0c 5			// Target: Caster
	WRITE_SHORT		   %ab_off_add%+ 0x0e 1			// Range: 1
	WRITE_SHORT		   %ab_off_add%+ 0x1e 1			// # effects: 1
	WRITE_SHORT		   %ab_off_add%+ 0x20 %fx_num_max% // First effect index
	WRITE_SHORT		   %ab_off_add%+ 0x22 1			// # charges: 1
	WRITE_BYTE			%ab_off_add%+ 0x24 1			// When drained: Item vanishes
	WRITE_SHORT		   %ab_off_add%+ 0x2a 1			// Projectile: None
	SET %ab_num%+=1 //Increment # of existing abilities
	WRITE_SHORT 0x68 %ab_num% //Write # of existing abilities
	PATCH_IF %fx_off%>=%ab_off% THEN
	BEGIN
	 SET %fx_off%+=0x38 //Add file offset of global effects
	 WRITE_LONG 0x6a %fx_off% //Write file offset of global effects
	END
	//Set # of charges to items found on creatures or areas
	//No idea, why this needs to be done...
	INNER_ACTION
	BEGIN
	 COPY_EXISTING_REGEXP GLOB ~^.+\.cre$~ ~override~
							   ~^.+\.are$~ ~override~
	 PATCH_IF (~%SOURCE_FILE%~ STRING_MATCHES_REGEXP ~^.+\.cre$~ =0)
	 BEGIN
	  READ_LONG 0x324 "itm_off" ELSE 0
	  READ_LONG 0x328 "itm_num" ELSE 0
	 END ELSE
	 BEGIN
	  READ_LONG  0x78 "itm_off" ELSE 0
	  READ_SHORT 0x76 "itm_num" ELSE 0
	 END
	 FOR (ii=0; ii<%itm_num%; %ii%+=1)
	 BEGIN
	  READ_ASCII %itm_off%+%ii%*0x14 item //Read item resource
	  PATCH_IF (~%item%~ STRING_MATCHES_REGEXP ~%ires%~ =0) THEN
	  BEGIN
	   READ_SHORT %itm_off%+%ii%*0x14+0x0a+(%ab_num%-1)*2 chrgs //Read # of charges
	   PATCH_IF %chrgs%=0 THEN
	   BEGIN
		WRITE_SHORT %itm_off%+%ii%*0x14+0x0a+(%ab_num%-1)*2 1 //Write # of charges
	   END
	  END
	 END
	 BUT_ONLY_IF_IT_CHANGES
	END
   END
   //Set 'Lore'=0
   //Only both copies
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc][12].+$~ =0) THEN
   BEGIN
	WRITE_SHORT 0x42 0 //Set 'Lore'
   END
   //Remove armor class bonus
   //Only c1 copies
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc]1.+$~ =0) THEN
   BEGIN
	FOR (ii=0; ii<%fx_num%; %ii%+=1)
	BEGIN
	 READ_SHORT %fx_off%+%ii%*0x30 fx_type
	 PATCH_IF %fx_type%=0 THEN
	 BEGIN
	  READ_LONG %fx_off%+%ii%*0x30+0x08 ac_to //Read Bonus to
	  PATCH_IF %ac_to%<0x10 THEN
	  BEGIN
	   DELETE_BYTES %fx_off%+%ii%*0x30 0x30 //Delete global effect
	   SET %ii%-=1 //Decrement loop counter
	   SET %fx_num%-=1 //Decrement # of effects
	   WRITE_SHORT 0x70 %fx_num% //Set # of effects
	   FOR (iii=0; iii<%ab_num%; %iii%+=1)
	   BEGIN
		READ_SHORT  %ab_off%+%iii%*0x38+0x20  ab_fx_idx //Read ability effect index
		SET %ab_fx_idx%-=1 //Decrement ability effect index
		WRITE_SHORT %ab_off%+%iii%*0x38+0x20 %ab_fx_idx% //Write ability effect index
	   END
	   PATCH_IF %ab_off%>%fx_off% THEN
	   BEGIN
		SET %ab_off%-=0x30
		WRITE_LONG 0x64 %ab_off% //Write new file offset of abilities
	   END
	  END
	 END
	END
	FOR (ii=0; ii<%ab_num%; %ii%+=1)
	BEGIN
	 READ_BYTE %ab_off%+%ii%*0x38 type //Read type of ability
	 PATCH_IF %type%=3 THEN //Type: Magical
	 BEGIN
	  READ_SHORT %ab_off%+%ii%*0x38+0x20 ab_fx_idx //Read ability effect index
	  READ_SHORT %ab_off%+%ii%*0x38+0x1e ab_fx_num //Read # of ability effects
	  FOR (iii=%ab_fx_idx%; iii<(%ab_fx_idx%+%ab_fx_num%); %iii%+=1)
	  BEGIN
	   READ_BYTE %fx_off%+%iii%*0x30 type //Read type of effect
	   PATCH_IF %type%=122 THEN //Type: Create inventory item
	   BEGIN
		READ_ASCII %fx_off%+%iii%*0x30+0x14 res
		PATCH_IF (~%res%~ STRING_MATCHES_REGEXP ~%c1ires%~ =0) THEN
		BEGIN
		 WRITE_EVALUATED_ASCII %fx_off%+%iii%*0x30+0x14 ~%c2ires%~ (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> //Resource
		END
	   END
	  END
	 END
	END
   END
   //Add item to itemexcl.2da


#13 -MIke-

-MIke-
  • Guest

Posted 23 February 2012 - 12:13 PM

Wrong offset for fx_idx fixed, rearranged, added messages 'AC boni enabled/disabled' via 'Display string'

  //Create copies, patch
  COPY_EXISTING ~%ires%.itm~ ~override/%c1ires%.itm~ //No AC boni
				~%ires%.itm~ ~override/%c2ires%.itm~
				~%ires%.itm~ ~override/%ires%.itm~ //Needs to be copied/patched last!
  PATCH_IF (SOURCE_SIZE>0x71) THEN
  BEGIN
   READ_LONG  0x64 ab_off //Read file offset of abilities
   READ_SHORT 0x68 ab_num //Read # of existing abilities
   READ_LONG  0x6a fx_off //Read file offset of global effects
   READ_SHORT 0x6e fx_idx //Read first global effects idx
   READ_SHORT 0x70 fx_num //Read # of existing global effects
   //Add ability 'Magical' with effect 'Create inventory item'
   PATCH_IF %ab_num%=0 THEN
   BEGIN
	SET ab_off=0x72
	WRITE_LONG 0x64 %ab_off% //Write file offset of abilities
   END
   PATCH_IF %fx_num%=0 THEN
   BEGIN
	SET fx_off=%ab_off%+%ab_num%*0x38
	WRITE_LONG 0x6a %fx_off% //Write file offset of global effects
   END
   SET fx_num_new=%fx_idx%+%fx_num%
   //Find last effect index for insertion
   FOR (ii=0; ii<%ab_num%; %ii%+=1)
   BEGIN
	READ_SHORT %ab_off%+%ii%*0x38+0x20 ab_fx_idx //Read ability effect index
	READ_SHORT %ab_off%+%ii%*0x38+0x1e ab_fx_num //Read # of ability effects
	PATCH_IF (%ab_fx_idx%+%ab_fx_num%)>%fx_num_new% BEGIN fx_num_new=%ab_fx_idx%+%ab_fx_num% END
   END
   //Insert new ability effect
   SET fx_off_add=%fx_off%+%fx_num_new%*0x30
   INSERT_BYTES		  %fx_off_add%	  0x30		   //New effect
   WRITE_SHORT		   %fx_off_add%	  122			//Type: Create inventory item
   WRITE_BYTE			%fx_off_add%+0x02 1			  //Target: Self
   WRITE_BYTE			%fx_off_add%+0x0c 1			  //Timing mode: Instant/Permanent until death
   WRITE_BYTE			%fx_off_add%+0x12 100			//Probability 1: 100
   WRITE_EVALUATED_ASCII %fx_off_add%+0x14 ~%c1ires%~ (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> //Resource
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc]1.+$~ =0) THEN
   BEGIN
	WRITE_EVALUATED_ASCII %fx_off_add%+0x14 ~%c2ires%~ (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> //Resource
   END
   PATCH_IF %ab_off%>%fx_off% THEN //Unlikely, but possible?
   BEGIN
	SET %ab_off%+=0x30 //Add file offset of global effects
	WRITE_LONG 0x64 %ab_off% //Write file offset of global effects
   END
   //Insert new ability
   READ_ASCII 0x3a icon (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> //Read name of icon resource
   SET ab_off_add=%ab_off%+%ab_num%*0x38
   INSERT_BYTES		  %ab_off_add%	   0x38		 //New ability
   WRITE_BYTE			%ab_off_add%	   3			//Type: Magical
   WRITE_BYTE			%ab_off_add%+ 0x01 1			//ID to use?: Yes
   WRITE_SHORT		   %ab_off_add%+ 0x02 3			//Location: Item slots
   WRITE_EVALUATED_ASCII %ab_off_add%+ 0x04 ~%icon%~ (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> //Icon
   WRITE_SHORT		   %ab_off_add%+ 0x0c 5			//Target: Caster
   WRITE_SHORT		   %ab_off_add%+ 0x0e 1			//Range: 1
   WRITE_SHORT		   %ab_off_add%+ 0x1e 1			//# effects: 1
   WRITE_SHORT		   %ab_off_add%+ 0x20 %fx_num_new% //First effect index
   WRITE_SHORT		   %ab_off_add%+ 0x22 1			//# charges: 1
   WRITE_BYTE			%ab_off_add%+ 0x24 1			//When drained: Item vanishes
   WRITE_SHORT		   %ab_off_add%+ 0x2a 1			//Projectile: None
   SET %ab_num%+=1 //Increment # of existing abilities
   WRITE_SHORT 0x68 %ab_num% //Write # of existing abilities
   PATCH_IF %fx_off%>=%ab_off% THEN
   BEGIN
	SET %fx_off%+=0x38 //Add file offset of global effects
	WRITE_LONG 0x6a %fx_off% //Write file offset of global effects
   END
   //Set 'Lore'=0, Add global effect 'Display string'
   //Only both copies
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc][12].+$~ =0) THEN
   BEGIN
	WRITE_SHORT 0x42 0 //Set 'Lore'
	SET fx_num_new=%fx_idx%+%fx_num%
	//Insert new global effect
	SET fx_off_add=%fx_off%+%fx_num_new%*0x30
	INSERT_BYTES		  %fx_off_add%	  0x30		   //New effect
	WRITE_SHORT		   %fx_off_add%	  139			//Type: Display String
	WRITE_BYTE			%fx_off_add%+0x02 1			  //Target: Self
	SAY				   %fx_off_add%+0x04 @1006		  //String: 'Protection item, AC boni disabled
	WRITE_BYTE			%fx_off_add%+0x0c 2			  //Timing mode: Instant/while equipped
	WRITE_BYTE			%fx_off_add%+0x12 100			//Probability 1: 100
	PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc]2.+$~ =0) THEN
	BEGIN
	 SAY				   %fx_off_add%+0x04 @1007		 //String: 'Protection item, AC boni enabled'
	END
	SET %fx_num%+=1 //Increment # of global effects
	WRITE_SHORT 0x70 %fx_num% //Write # of existing global effects
	FOR (ii=0; ii<%ab_num%; %ii%+=1)
	BEGIN
	 READ_SHORT %ab_off%+%ii%*0x38+0x20 ab_fx_idx //Read ability effect index
	 PATCH_IF %ab_fx_idx%>%fx_idx% THEN
	 BEGIN
	  SET %ab_fx_idx%+=1 //Increment ability effect index
	  WRITE_SHORT %ab_off%+%ii%*0x38+0x20 %ab_fx_idx% //Write ability effect index
	 END
	END
	PATCH_IF %ab_off%>%fx_off% THEN //Unlikely, but possible?
	BEGIN
	 SET %ab_off%+=0x30 //Add file offset of global effects
	 WRITE_LONG 0x64 %ab_off% //Write file offset of global effects
	END
   END
   //Remove armor class bonus
   //Only c1 copies
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc]1.+$~ =0) THEN
   BEGIN
	FOR (ii=0; ii<%fx_num%; %ii%+=1)
	BEGIN
	 READ_SHORT %fx_off%+%ii%*0x30 fx_type
	 PATCH_IF %fx_type%=0 THEN
	 BEGIN
	  READ_LONG %fx_off%+%ii%*0x30+0x08 ac_to //Read Bonus to
	  PATCH_IF %ac_to%<0x10 THEN
	  BEGIN
	   DELETE_BYTES %fx_off%+%ii%*0x30 0x30 //Delete global effect
	   SET %ii%-=1 //Decrement loop counter
	   SET %fx_num%-=1 //Decrement # of effects
	   WRITE_SHORT 0x70 %fx_num% //Set # of effects
	   FOR (iii=0; iii<%ab_num%; %iii%+=1)
	   BEGIN
		READ_SHORT  %ab_off%+%iii%*0x38+0x20  ab_fx_idx //Read ability effect index
		SET %ab_fx_idx%-=1 //Decrement ability effect index
		WRITE_SHORT %ab_off%+%iii%*0x38+0x20 %ab_fx_idx% //Write ability effect index
	   END
	   PATCH_IF %ab_off%>%fx_off% THEN
	   BEGIN
		SET %ab_off%-=0x30
		WRITE_LONG 0x64 %ab_off% //Write new file offset of abilities
	   END
	  END
	 END
	END
   END
   //Add item to itemexcl.2da
   //Only c2 copies
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc]2.+$~ =0) THEN
   BEGIN
	INNER_ACTION
	BEGIN
	 APPEND ~itemexcl.2da~ ~%DEST_RES%%TAB%1~ UNLESS ~%DEST_RES%~
	 BUT_ONLY_IF_IT_CHANGES
	END
   END
   //Set # of charges to items found on creatures or areas
   //No idea, why this needs to be done...
   //Only original
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~SOURCE_RES~ =0) THEN
   BEGIN
	INNER_ACTION
	BEGIN
	 COPY_EXISTING_REGEXP GLOB ~^.+\.cre$~ ~override~
							   ~^.+\.are$~ ~override~
	 PATCH_IF (~%SOURCE_FILE%~ STRING_MATCHES_REGEXP ~^.+\.cre$~ =0)
	 BEGIN
	  READ_LONG 0x324 "itm_off" ELSE 0
	  READ_LONG 0x328 "itm_num" ELSE 0
	 END ELSE
	 BEGIN
	  READ_LONG  0x78 "itm_off" ELSE 0
	  READ_SHORT 0x76 "itm_num" ELSE 0
	 END
	 FOR (ii=0; ii<%itm_num%; %ii%+=1)
	 BEGIN
	  READ_ASCII %itm_off%+%ii%*0x14 item //Read item resource
	  PATCH_IF (~%item%~ STRING_MATCHES_REGEXP ~%ires%~ =0) THEN
	  BEGIN
	   READ_SHORT %itm_off%+%ii%*0x14+0x0a+(%ab_num%-1)*2 chrgs //Read # of charges
	   PATCH_IF %chrgs%=0 THEN
	   BEGIN
		WRITE_SHORT %itm_off%+%ii%*0x14+0x0a+(%ab_num%-1)*2 1 //Write # of charges
	   END
	  END
	 END
	 BUT_ONLY_IF_IT_CHANGES
	END
   END
  END
  BUT_ONLY_IF_IT_CHANGES
END
END


#14 prowler

prowler

    Murloc!

  • Member
  • 417 posts

Posted 24 February 2012 - 01:05 PM

It's awesome! :Bow: If you need a tester - I'm ready to help. Hail IWD! :woot:

Murloc-translator
Coordinator of the Russian BWP Translation Team
Work with SHS, PPG, G3, CoM, Dragon's Hoard, Sorcerer's Place, RPG Dungeon, Arcanecoast.ru, Aerie.ru


#15 -Mike-

-Mike-
  • Guest

Posted 15 March 2012 - 11:03 AM

Revised working code for component 'Wear multiple protection items'

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////												  \\\\\
///// wear multiple protection items				   \\\\\
/////												  \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////												  \\\\\
///// PnP restrictions								 \\\\\
/////												  \\\\\
BEGIN @206001 DESIGNATED 2060 // PnP restrictions
GROUP @9
SUBCOMPONENT @206000 // wear multiple protection items
// this file does nothing, it just allows other mods to detect this component
COPY_EXISTING ~sw1h01.itm~ ~override/cdi02060.g3~
//Add items to itemexcl.2da, if exist and missing
ACTION_FOR_EACH item IN
~amul14~
~bwtalis~
~clck01~
~clck02~
~clck03~
~cloakmi~
~glimglm~
~mantlecs~
~virgin~
~ring06~
~ring07~
~ring25~
~shldrng~
~uring2a~
~uring4b~
~uring5a~
~mirror2~  /*Totlm*/
~cdwuff~   /*IWD Item upgrade*/
~cdscale~  /*IWD Item upgrade*/
~amfaith~  /*Auril's bane*/
~amulcm03~ /*Auril's bane*/
BEGIN
ACTION_IF FILE_EXISTS_IN_GAME ~%item%.itm~ THEN
BEGIN
  APPEND ~itemexcl.2da~ ~%item%%TAB%1~ UNLESS ~%item%~
  BUT_ONLY_IF_IT_CHANGES
END
END
//Search for fitting items in itemexcl.2da
OUTER_SET fnd=0
COPY_EXISTING ~itemexcl.2da~ ~override~
COUNT_2DA_COLS rcol
COUNT_2DA_ROWS %rcol% row
FOR (i=1; i<%row%; %i%+=1)
BEGIN
READ_2DA_ENTRY ~%i%~ ~0~ ~%rcol%~ sres
TO_LOWER sres
PATCH_IF FILE_EXISTS_IN_GAME ~%sres%.itm~ THEN
BEGIN
  INNER_ACTION
  BEGIN
   COPY_EXISTING ~%sres%.itm~ ~override~
//PATCH_PRINT ~File: %SOURCE_FILE%~
   PATCH_IF (SOURCE_SIZE>0x71) THEN
   BEGIN
    READ_SHORT 0x1c cat    //Read item categorie
    PATCH_IF (cat= 1) OR   //Amul./Neckl.
			 (cat=10) OR   //Ring
			 (cat=32) THEN //Cloak/Robe
    BEGIN
	 READ_LONG  0x64 ab_off //Read file offset of abilities
	 READ_SHORT 0x68 ab_num //Read # of existing abilities
	 READ_LONG  0x6a fx_off //Read file offset of effects
	 READ_SHORT 0x70 fx_num //Read # of existing effects
	 FOR (ii=0; ii<%fx_num%; %ii%+=1)
	 BEGIN
	  READ_SHORT %fx_off%+%ii%*0x30	  fx_type //Read effect type
	  READ_LONG  %fx_off%+%ii%*0x30+0x08 ac_to //Read Bonus to
	  PATCH_IF %fx_type%=0  AND
			   %ac_to%<0x10 THEN
	  BEGIN
//PATCH_PRINT ~Item found: %sres%.itm~
	   SPRINT $item("%fnd%") ~%sres%~
	   SET %fnd%+=1
	   SET ii=%fx_num%
	  END
	 END
    END
   END
   BUT_ONLY_IF_IT_CHANGES
  END
END
END
BUT_ONLY_IF_IT_CHANGES
//Adapt found items
OUTER_FOR (i=0; i<%fnd%; %i%+=1)
BEGIN
OUTER_SPRINT ires $item("%i%")
ACTION_IF FILE_EXISTS_IN_GAME ~%ires%.itm~ THEN
BEGIN
  //Create file names for copies
  //Scheme: -Add 'c' as first char for copies
  //	    -Replace first char of source file name by '1' or '2'
  //Example:
  //Source:  bwtalis.itm
  //1. copy: c1wtalis.itm
  //2. copy: c2wtalis.itm
  OUTER_PATCH ~c%ires% ~
  BEGIN
   WRITE_ASCII 0x01 ~1~
   SPRINT c1ires ~~
   FOR (ii=0; ii<8; %ii%+=1)
   BEGIN
    READ_ASCII %ii% chr (1)
    PATCH_IF (~%chr%~ STRING_EQUAL ~ ~ =0) BEGIN SPRINT c1ires ~%c1ires%%chr%~ END ELSE
    BEGIN SET ii=8 END
   END
   WRITE_ASCII 0x01 ~2~
   SPRINT c2ires ~~
   FOR (ii=0; ii<8; ii+=1)
   BEGIN
    READ_ASCII %ii% chr (1)
    PATCH_IF (~%chr%~ STRING_EQUAL ~ ~ =0) BEGIN SPRINT c2ires ~%c2ires%%chr%~ END ELSE
    BEGIN SET ii=8 END
   END
  END
  //Create copies, patch
  COPY_EXISTING ~%ires%.itm~ ~override/%c1ires%.itm~ //No AC boni
			    ~%ires%.itm~ ~override/%c2ires%.itm~
			    ~%ires%.itm~ ~override/%ires%.itm~ //Needs to be copied/patched last!
  PATCH_IF (SOURCE_SIZE>0x71) THEN
  BEGIN
   READ_LONG  0x64 ab_off //Read file offset of abilities
   READ_SHORT 0x68 ab_num //Read # of existing abilities
   READ_LONG  0x6a fx_off //Read file offset of global effects
   READ_SHORT 0x6e fx_idx //Read first global effects idx
   READ_SHORT 0x70 fx_num //Read # of existing global effects
   //Add ability 'Magical' with effect 'Create inventory item'
   PATCH_IF %ab_num%=0 THEN
   BEGIN
    SET ab_off=0x72
    WRITE_LONG 0x64 %ab_off% //Write file offset of abilities
   END
   PATCH_IF %fx_num%=0 THEN
   BEGIN
    SET fx_off=%ab_off%+%ab_num%*0x38
    WRITE_LONG 0x6a %fx_off% //Write file offset of global effects
   END
   SET fx_num_new=%fx_idx%+%fx_num%
   //Find last effect index for insertion
   FOR (ii=0; ii<%ab_num%; %ii%+=1)
   BEGIN
    READ_SHORT %ab_off%+%ii%*0x38+0x20 ab_fx_idx //Read ability effect index
    READ_SHORT %ab_off%+%ii%*0x38+0x1e ab_fx_num //Read # of ability effects
    PATCH_IF (%ab_fx_idx%+%ab_fx_num%)>%fx_num_new% BEGIN fx_num_new=%ab_fx_idx%+%ab_fx_num% END
   END
   //Insert new ability effect
   SET fx_off_add=%fx_off%+%fx_num_new%*0x30
   INSERT_BYTES		  %fx_off_add%	  0x30		   //New effect
   WRITE_SHORT		   %fx_off_add%	  122		    //Type: Create inventory item
   WRITE_BYTE		    %fx_off_add%+0x02 1			  //Target: Self
   WRITE_BYTE		    %fx_off_add%+0x0c 1			  //Timing mode: Instant/Permanent until death
   WRITE_BYTE		    %fx_off_add%+0x12 100		    //Probability 1: 100
   WRITE_EVALUATED_ASCII %fx_off_add%+0x14 ~%c1ires%~ (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> //Resource
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc]1.+$~ =0) THEN
   BEGIN
    WRITE_EVALUATED_ASCII %fx_off_add%+0x14 ~%c2ires%~ (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> //Resource
   END
   PATCH_IF %ab_off%>%fx_off% THEN //Unlikely, but possible?
   BEGIN
    SET %ab_off%+=0x30 //Add file offset of global effects
    WRITE_LONG 0x64 %ab_off% //Write file offset of global effects
   END
   //Insert new ability
   READ_ASCII 0x3a icon (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> //Read name of icon resource
   SET ab_off_add=%ab_off%+%ab_num%*0x38
   INSERT_BYTES		  %ab_off_add%	   0x38		 //New ability
   WRITE_BYTE		    %ab_off_add%	   3		    //Type: Magical
   WRITE_BYTE		    %ab_off_add%+ 0x01 1		    //ID to use?: Yes
   WRITE_SHORT		   %ab_off_add%+ 0x02 3		    //Location: Item slots
   WRITE_EVALUATED_ASCII %ab_off_add%+ 0x04 ~%icon%~ (<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='8)' /> //Icon
   WRITE_SHORT		   %ab_off_add%+ 0x0c 5		    //Target: Caster
   WRITE_SHORT		   %ab_off_add%+ 0x0e 1		    //Range: 1
   WRITE_SHORT		   %ab_off_add%+ 0x1e 1		    //# effects: 1
   WRITE_SHORT		   %ab_off_add%+ 0x20 %fx_num_new% //First effect index
   WRITE_SHORT		   %ab_off_add%+ 0x22 1		    //# charges: 1
   WRITE_BYTE		    %ab_off_add%+ 0x24 1		    //When drained: Item vanishes
   WRITE_SHORT		   %ab_off_add%+ 0x2a 1		    //Projectile: None
   SET %ab_num%+=1 //Increment # of existing abilities
   WRITE_SHORT 0x68 %ab_num% //Write # of existing abilities
   PATCH_IF %fx_off%>=%ab_off% THEN
   BEGIN
    SET %fx_off%+=0x38 //Add file offset of global effects
    WRITE_LONG 0x6a %fx_off% //Write file offset of global effects
   END
   //Set # of charges to items found on creatures or areas
   //No idea, why this needs to be done...
   //Only original
   PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~%SOURCE_RES%~ =0) THEN
   BEGIN
    INNER_ACTION
    BEGIN
	 COPY_EXISTING_REGEXP GLOB ~^.+\.cre$~ ~override~
							   ~^.+\.are$~ ~override~
	 PATCH_IF (~%SOURCE_FILE%~ STRING_MATCHES_REGEXP ~^.+\.cre$~ =0)
	 BEGIN
	  READ_LONG 0x324 "itm_off" ELSE 0
	  READ_LONG 0x328 "itm_num" ELSE 0
	 END ELSE
	 BEGIN
	  READ_LONG  0x78 "itm_off" ELSE 0
	  READ_SHORT 0x76 "itm_num" ELSE 0
	 END
	 FOR (ii=0; ii<%itm_num%; %ii%+=1)
	 BEGIN
	  READ_ASCII %itm_off%+%ii%*0x14 item //Read item resource
	  PATCH_IF (~%item%~ STRING_MATCHES_REGEXP ~%ires%~ =0) AND
			   %ab_num%<=3								  THEN
	  BEGIN
	   READ_SHORT %itm_off%+%ii%*0x14+0x0a+(%ab_num%-1)*2 chrgs //Read # of charges
	   PATCH_IF %chrgs%=0 THEN
	   BEGIN
	    WRITE_SHORT %itm_off%+%ii%*0x14+0x0a+(%ab_num%-1)*2 1 //Write # of charges
	   END
	  END
	 END
	 BUT_ONLY_IF_IT_CHANGES
    END
   //Set 'Lore'=0, Add global effect 'Display string'
   //Only both copies
   END ELSE
   BEGIN
    WRITE_SHORT 0x42 0 //Set 'Lore'
    SET fx_num_new=%fx_idx%+%fx_num%
    //Insert new global effect
    SET fx_off_add=%fx_off%+%fx_num_new%*0x30
    INSERT_BYTES		  %fx_off_add%	  0x30		   //New effect
    WRITE_SHORT		   %fx_off_add%	  139		    //Type: Display String
    WRITE_BYTE		    %fx_off_add%+0x02 1			  //Target: Self
    WRITE_BYTE		    %fx_off_add%+0x0c 2			  //Timing mode: Instant/while equipped
    WRITE_BYTE		    %fx_off_add%+0x12 100		    //Probability 1: 100
    SAY				   %fx_off_add%+0x04 @10010		 //String: 'Protection item equipped, AC bonus disabled
    PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc]2.+$~ =0) THEN
    BEGIN
	 SAY				  %fx_off_add%+0x04 @10011		 //String: 'Protection item equipped, AC bonus enabled'
    END
    SET %fx_num%+=1 //Increment # of global effects
    WRITE_SHORT 0x70 %fx_num% //Write # of existing global effects
    FOR (ii=0; ii<%ab_num%; %ii%+=1)
    BEGIN
	 READ_SHORT %ab_off%+%ii%*0x38+0x20 ab_fx_idx //Read ability effect index
	 PATCH_IF %ab_fx_idx%>%fx_idx% THEN
	 BEGIN
	  SET %ab_fx_idx%+=1 //Increment ability effect index
	  WRITE_SHORT %ab_off%+%ii%*0x38+0x20 %ab_fx_idx% //Write ability effect index
	 END
    END
    PATCH_IF %ab_off%>%fx_off% THEN //Unlikely, but possible?
    BEGIN
	 SET %ab_off%+=0x30 //Add file offset of global effects
	 WRITE_LONG 0x64 %ab_off% //Write file offset of global effects
    END
    //Remove armor class bonus
    //Only c1*.* copies
    PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc]1.+$~ =0) THEN
    BEGIN
	 FOR (ii=0; ii<%fx_num%; %ii%+=1)
	 BEGIN
	  READ_SHORT %fx_off%+%ii%*0x30 fx_type
	  PATCH_IF %fx_type%=0 THEN
	  BEGIN
	   READ_LONG %fx_off%+%ii%*0x30+0x08 ac_to //Read Bonus to
	   PATCH_IF %ac_to%<0x10 THEN
	   BEGIN
	    DELETE_BYTES %fx_off%+%ii%*0x30 0x30 //Delete global effect
	    SET %ii%-=1 //Decrement loop counter
	    SET %fx_num%-=1 //Decrement # of effects
	    WRITE_SHORT 0x70 %fx_num% //Set # of effects
	    FOR (iii=0; iii<%ab_num%; %iii%+=1)
	    BEGIN
		 READ_SHORT  %ab_off%+%iii%*0x38+0x20  ab_fx_idx //Read ability effect index
		 SET %ab_fx_idx%-=1 //Decrement ability effect index
		 WRITE_SHORT %ab_off%+%iii%*0x38+0x20 %ab_fx_idx% //Write ability effect index
	    END
	    PATCH_IF %ab_off%>%fx_off% THEN
	    BEGIN
		 SET %ab_off%-=0x30
		 WRITE_LONG 0x64 %ab_off% //Write new file offset of abilities
	    END
	   END
	  END
	 END
    END
    //Add item to itemexcl.2da
    //Only c2*.* copies
    PATCH_IF (~%DEST_RES%~ STRING_MATCHES_REGEXP ~^[Cc]2.+$~ =0) THEN
    BEGIN
	 INNER_ACTION
	 BEGIN
	  APPEND ~itemexcl.2da~ ~%DEST_RES%%TAB%1~ UNLESS ~%DEST_RES%~
	  BUT_ONLY_IF_IT_CHANGES
	 END
    END
   END
  END
  BUT_ONLY_IF_IT_CHANGES
END
END
/////												  \\\\\
///// no restrictions								  \\\\\
/////												  \\\\\
BEGIN @206100 DESIGNATED 2061 // no restrictions
GROUP @9
SUBCOMPONENT @206000 // wear multiple protection items
// this file does nothing, it just allows other mods to detect this component
COPY_EXISTING ~sw1h01.itm~ ~override/cdi02061.g3~
//Remove rings, amuletts, cloaks from itemexcl.2da
COPY_EXISTING ~itemexcl.2da~ ~override~
COUNT_2DA_COLS rcol
COUNT_2DA_ROWS %rcol% row
FOR (i=%row%-1; i>0; i=%i%-1)
BEGIN
READ_2DA_ENTRY ~%i%~ ~0~ ~%rcol%~ sres
TO_LOWER sres
PATCH_IF FILE_EXISTS_IN_GAME ~%sres%.itm~ THEN
BEGIN
  SET det=0 //Reset detection count
  INNER_ACTION
  BEGIN
   COPY_EXISTING ~%sres%.itm~ ~override~
   PATCH_IF (SOURCE_SIZE>0x71) THEN
   BEGIN
    READ_SHORT 0x1c cat
    PATCH_IF (cat= 1) OR
			 (cat=10) OR
			 (cat=32) THEN
    BEGIN
	 READ_LONG  0x6a fx_off //Read file offset of effects
	 READ_SHORT 0x70 fx_num //Read # of existing effects
	 FOR (ii=0; ii<%fx_num%; %ii%+=1)
	 BEGIN
	  READ_SHORT %fx_off%+%ii%*0x30 fx_type //Read effect type
	  PATCH_IF %fx_type%=0 THEN
	  BEGIN
	   READ_LONG %fx_off%+%ii%*0x30+0x8 ac_type //Read AC bonus type
	   PATCH_IF %ac_type%!=0x10 THEN //AC bonus type != Set base AC
	   BEGIN
	    SET det=det+1
	   END
	  END
	 END
    END
   END
  END
  PATCH_IF %det%>0 THEN
  BEGIN
   REMOVE_2DA_ROW ~%i%~ ~%rcol%~
  END
END
END
BUT_ONLY_IF_IT_CHANGES



#16 -Mike-

-Mike-
  • Guest

Posted 15 March 2012 - 11:09 AM

http://forums.gibber...pic=21877&st=15 #20

4) When Larrel is talking to the squirrel he uses an exclamation mark when he should be using a q-mark. (So do the elemental princes in ToB when it comes to that.)


Suggested fix (might need to be expanded for Spanish):
ALTER_TLK_LIST BEGIN 18268 18269 18272 END
BEGIN
REPLACE_TEXTUALLY ~!~ ~?~
END

#17 -Mike-

-Mike-
  • Guest

Posted 15 March 2012 - 11:18 AM

http://forums.gibber...pic=21877&st=15 #21

I found the Eldathyn healer women and the orc priests in the severed hand try to heal me in combat. They shouldn't be doing that, though it is helpful.


This happened in my game as well. For the orc shaman in the Severed hand the script 'shorcsh1.bcs' should be the one in question, though I don't find anything wrong with it.

#18 -Mike-

-Mike-
  • Guest

Posted 16 March 2012 - 12:17 PM


//In Level 2 of the Severed Hand,

//one of the shadowed goblin warriors (actor4) doesn't do anything, because he's lacking the required scripts

//Attach scripts to actor4 in ar5002.are

PRINT ~Try to attach scripts to actor4 in AR5002.ARE~

COPY_EXISTING_REGEXP ~ar5002.are~ ~override~

PATCH_IF (SOURCE_SIZE > 0x11c) THEN

BEGIN

READ_LONG  0x54 actr_off ELSE 0 //Read file offset of actors

READ_SHORT 0x58 actr_num ELSE 0 //Read # of existing actors

FOR (i=0; i<%actr_num%; %i%+=1)

BEGIN

  READ_ASCII %actr_off%+%i%*0x110+0x58 gs //Read General script

  READ_ASCII %actr_off%+%i%*0x110+0x70 ds //Read Default script

  PATCH_IF (~%gs%~ STRING_MATCHES_REGEXP ~~ =0) THEN

  BEGIN

   WRITE_ASCII %actr_off%+%i%*0x110+0x58 ~SHGAFLT~ //Write General script

   PATCH_IF (~%ds%~ STRING_MATCHES_REGEXP ~~ =0) THEN

   BEGIN

	WRITE_ASCII %actr_off%+%i%*0x110+0x70 ~GNMMGSG~ //Write Default script

   END

  END

END

END ELSE

BEGIN

PATCH_PRINT ~%SOURCE_FILE% corrupted, can not be patched~

END

BUT_ONLY_IF_IT_CHANGES



#19 prowler

prowler

    Murloc!

  • Member
  • 417 posts

Posted 19 March 2012 - 12:49 PM

-Mike-, do you have e-mail or... do you have SHS account?

Edited by prowler, 19 March 2012 - 12:50 PM.

Murloc-translator
Coordinator of the Russian BWP Translation Team
Work with SHS, PPG, G3, CoM, Dragon's Hoard, Sorcerer's Place, RPG Dungeon, Arcanecoast.ru, Aerie.ru


#20 -Mike-

-Mike-
  • Guest

Posted 11 April 2012 - 11:12 AM

-Mike-, do you have e-mail or... do you have SHS account?

I'm old fashioned about leaving to many footprints online... ;)

From Redrake's Fixpack:

- Removed the second Axe of Caged Souls from Dorn's Deep. It was now replaced with Benorg's Truth....

While I consider most of his fixes as tweaks, this one has a case for me...
Spoiler


In Dorn's Deep, first level, the monument showing an elf and a dwarf is supposed to reveal an information, when clicked on it, but it's not due to missing vertices/bounding box around it.
Spoiler