Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Adding kits to enemies?

GreenerGreener Member Posts: 385
edited January 26 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,137
    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)
    

  • Luke93Luke93 Member, Mobile Tester Posts: 1,312
    edited January 27
    @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: 385
    @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.

  • Luke93Luke93 Member, Mobile Tester Posts: 1,312
    edited January 27
    @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: 385
    @Luke93 Thank you, I appreciate your time.

  • kjeronkjeron Member Posts: 2,137
    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.