Skip to content

Adding kits to enemies?

GreenerGreener Member Posts: 430
edited January 2020 in General Modding
Hypothetically if I wanted to add the Barbarian kit to Tazok, would the following suffice:

BEGIN
COPY_EXISTING_REGEXP GLOB ~tazok.*.CRE~ ~override~
PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
WRITE_LONG	0x244 0x00004000 
END

or do I need to add the individual abilities from the kit, for example immunity to rage, backstab and movement rate bonus ect...?

Comments

  • kjeronkjeron Member Posts: 2,367
    You would have to add the abilities to the creature manually, only hardcoded mechanics follow the kitID (which in this case would be the backstab immunity).
    Alternatively, script the creature to run this upon creation, once:
    AddKit(BARBARIAN)
    
  • GreenerGreener Member Posts: 430
    @kjeron Thank you
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited January 2020
    @Greener

    This is probably better / more correct:
    OUTER_SET kit_id = IDS_OF_SYMBOL (~KIT~ ~BARBARIAN~)
    COPY_EXISTING_REGEXP GLOB ~tazok.*.CRE~ ~override~
      PATCH_IF (SOURCE_SIZE > 0x2d3) BEGIN
        WRITE_SHORT	0x0244	(kit_id >> 16) & 0xffff
        WRITE_SHORT	0x0246	(kit_id & 0xffff)
      END
    BUT_ONLY
    

    @kjeron

    Related question: if the NPC in question is meant to be joinable and I decide to add kit abilities manually (i.e., via ADD_CRE_EFFECT), then I need to set "Parent Resource Type" (located at offset 0x90), "Parent Resource" (located at offset 0x94) and "Caster Level" (located at offset 0xC8) appropriately, right? Otherwise, once that CRE joins the party, its CLAB table is processed and this will grant it kit abilities twice (not intended of course).

    My understanding is that you need to set "Parent Resource Type" to 1 (SPL), "Parent Resource" to the SPL that grants the kit ability you're adding (e.g., "SPCL122" if the CRE in question is an Archer and you're adding Missile Thac0/Damage bonus), and "Caster Level" to the level of the CRE in question (in case the "Parent Resource" SPL scales with level / is granted several times like "SPCL122").

    Provided that's correct, I've got some questions:
    1. How should I set "Caster Level" if the CRE in question is a multi-class kit or a dual-classed character?
    2. Some CREs also have the "Time applied (ticks)" (located at offset 0x6C) set to a non-zero value – for instance, VOGHIL7.CRE has it set to 31500. Is there a particular reason for that?
    3. Is it necessary to set the "Non-magical ability" flag (located at offset 0x9C, BIT14) to 1?
  • GreenerGreener Member Posts: 430
    @Luke93 Thank you for your input

    If possible could you help me understand how your code is "better / more correct". I'm not very mod savvy thus the majority of my attempts are trial and error and reading others code.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited January 2020
    @Greener

    Well, the first instruction allows you to store in the "kit_id" variable the hexadecimal number associated to BARBARIAN, whatever this number is (so that you don't need to know/remember/look for it). IDS_OF_SYMBOL will automatically pick it up for you based on the keyword BARBARIAN. OK, this is not necessary, but I find it quite useful. I mean, BARBARIAN is easier to remember with respect to 0x00004000 or whatever...

    As far as these two lines are concerned,
    WRITE_SHORT	0x0244	(kit_id >> 16) & 0xffff
    WRITE_SHORT	0x0246	(kit_id & 0xffff)
    

    here's the explanation...
  • GreenerGreener Member Posts: 430
    @Luke93 Thank you, I appreciate your time.
  • kjeronkjeron Member Posts: 2,367
    Luke93 wrote: »
    1. How should I set "Caster Level" if the CRE in question is a multi-class kit or a dual-classed character?
    2. Some CREs also have the "Time applied (ticks)" (located at offset 0x6C) set to a non-zero value – for instance, VOGHIL7.CRE has it set to 31500. Is there a particular reason for that?
    3. Is it necessary to set the "Non-magical ability" flag (located at offset 0x9C, BIT14) to 1?
    You can ignore all of these.
    Caster level is only relevant to Dispel Magic.
    Time applied can be safely ignored here - otherwise it would break imported characters created before this field was utilized.
    The 31500(ticks) = 7 hours game time, which is the time a new game starts in Candlekeep.
    "Non-magical ability" flag is relevant when casting the spell (Wild Surge, Dead Magic, Casting Failure, etc...).
Sign In or Register to comment.