Jump to content


Photo

Patching an ability to a series of items


  • Please log in to reply
4 replies to this topic

#1 Rana

Rana
  • Member
  • 5 posts

Posted 06 May 2011 - 03:07 PM

Hey all.  I'm trying to patch a custom ability onto various armors, and I need your help.  

My goal is to patch this ability on to every (non-elven)Chain Mail, Splint Mail, Plate Mail and Full Plate item in the game.

If anyone could provide an easy to understand example of this, or somehow help walk me through the process, that would be great.  Thanks!

Edit:  Actually I may have found my own solution.  The macros folder in the item revisions mod has a lot of detailed information that I might be able to utilize.  If anyone still wants to post any suggestions though I'd more than appreciate it!

Edit2:  Argh, nope, I'm stumped and need help. :(

Edited by Rana, 06 May 2011 - 04:37 PM.


#2 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 06 May 2011 - 10:49 PM

Edit2: Argh, nope, I'm stumped and need help. :(

Well, post the code you have and we'll help... I'll try to help that is. :)
But as much as we need a base, we need to know your intention too... perhaps a negating might work at a good spot, or using this:
COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~ //this makes it take every item file to processing
  PATCH_IF (SOURCE_SIZE > 0x71) BEGIN //this protects from invalid items
    READ_SHORT 0x1c temp_type ELSE 0 //the ELSE assumes zero if the item is invalid... and the temp_type is read to be * 
    PATCH_IF (temp_type > 189) BEGIN // only patch known armors and shields
      SET miscast_percent = 0
      
      PATCH_IF (temp_type == 190) BEGIN // buckler
        SET miscast_percent = 5
      END ELSE
      PATCH_IF (temp_type == 191) BEGIN // small shield
        SET miscast_percent = 5
      END ELSE
      PATCH_IF (temp_type == 192) BEGIN // medium shield
        SET miscast_percent = 15
      END ELSE
      PATCH_IF (temp_type == 194) BEGIN // large/tower shield
        SET miscast_percent = 50
      END ELSE
      PATCH_IF (temp_type == 201 || temp_type == 211) BEGIN // chain mail, normal and thieving
        SET miscast_percent = 30
      END ELSE
      PATCH_IF (temp_type == 202) BEGIN // elven chain 
        SET miscast_percent = 0
      END ELSE
      PATCH_IF (temp_type == 203) BEGIN // full plate
        SET miscast_percent = 50
      END ELSE
      PATCH_IF (temp_type == 204) BEGIN // hide armor
        SET miscast_percent = 20
      END ELSE
      PATCH_IF (temp_type == 205) BEGIN // plate mail
        SET miscast_percent = 40
      END ELSE
      PATCH_IF (temp_type == 206) BEGIN // scale armor
        SET miscast_percent = 30
      END ELSE
      PATCH_IF (temp_type == 207) BEGIN // splint mail
        SET miscast_percent = 40
      END ELSE
      PATCH_IF (temp_type == 208 || temp_type == 218) BEGIN // studded leather, normal and 'thieving'
        SET miscast_percent = 15
      END ELSE
      PATCH_IF (temp_type == 209) BEGIN // leather armor
        SET miscast_percent = 10
      END ELSE
      PATCH_IF (temp_type > 220) BEGIN // non-spellcasting restrictive armor
        SET miscast_percent = 0
      END
You just have to make the action line "SET miscast_percent = x" to what you like and remove the elf armor, the shields etc of course...
The * is itm files type reference. Don't know how up to date the link is, as I used the G3's file format last time, but as the G3 is down...

Edited by Jarno Mikkola, 06 May 2011 - 11:06 PM.

Deactivated account. The user today is known as The Imp.


#3 Rana

Rana
  • Member
  • 5 posts

Posted 07 May 2011 - 01:06 AM

Thanks for the snippet.  I guess this is where I have questions:


When you say, "SET miscast_percent = x" to what you like" - do you mean replace it with the name of the item ability, spell or effect I want to patch in?  For example:

COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
    READ_SHORT 0x1c "temp_type" ELSE 0
    PATCH_IF (temp_type > 199) BEGIN // armours
      PATCH_IF (temp_type = 201 || temp_type = 203 || temp_type = 204 || temp_type = 205 || temp_type = 206 || temp_type = 207) BEGIN // All non-special Chain Mail, Full Plate, Hide, Plate Mail and Scale Mail armors
        SET "rw#ecmbr.spl" // name of the spell ability I want to patch in
      END

rw#ecmbr.spl is the name of the spell ability I want to patch in.  In case the syntax I just posted isn't correct, how would I go about making it work?  For the record, the spell ability consists of 4 effects:

(142) Display Portrait Icon
(206) Protection from spell - rw#dfeet.spl
(206) Protection from spell - rw#dtmbl.spl
(206) Protection from spell - rw#ddanc.spl

#4 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 12 May 2011 - 12:32 PM

I think you just want ADD_ITEM_EFFECT - see the WeiDU documentation.

Edit: or ADD_ITEM_EQEFFECT if it's an equipping effect - syntax is much the same.

Edited by Miloch, 12 May 2011 - 12:33 PM.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#5 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 12 May 2011 - 11:34 PM

I think you just want ADD_ITEM_EFFECT - see the WeiDU documentation.

Edit: or ADD_ITEM_EQEFFECT if it's an equipping effect - syntax is much the same.

It is, but it might be more helpful if there was an examle on how that's used... as I cannot understand how exactly that's used.
So a commented .tp2 section would be perhaps the best.
I myself would make the Rana's spells to be .eff files, then copy those files first to the override folder, then add them to the items using the opcode 177... but that's my approach.

Deactivated account. The user today is known as The Imp.