Jump to content

Adding an innate ability to everyone's panels and taking it away


Recommended Posts

I have a spell which, in addition to its main effect, I would like to settle in every party member's innate abilities panel, to have and to keep. I want them to have 1 use of that spell at all times, so when they spend it, to still have 1 use of it. So I put a Global Effect in the casting of the spell, targeted "Party," which adds the spell through opcode 171, Give Innate Ability, to the party members' panels. Now, because that Global Effect is only activated when the spell is cast, the original caster is obviously going to have one fewer use of that spell, so he is left with no uses plus the 1 he gets. When he casts it next, he will again lose it and get 1 use. So that's good, keeping him at 1.


But the other party members are ending up with an accumulation of uses - because they don't (have to) cast the spell. With every casting they get that extra use. I wanted to add another Global Effect before the first, which would take away 1 use of the spell from the party, before adding 1. That way they would all be kept at 1 available use. But I don't see an opcode that would be the reverse of 171. 172 strikes a spell from a spellbook, which is not at all the same as taking away an innate ability.


Any suggestions?

Link to comment

172 removes the referenced SPL entirely from the target actor, e.g. check how Polymorph Self functions. Technically, the difference between spellbook and innates is very artificial, the only rule is to make sure the latter's spell level (in the main header) is set to 1, otherwise HasSpell() trigger will be out of bounds and read the equipped items structure instead, randomly crashing the game.

Link to comment

172 removes the referenced SPL entirely from the target actor,

Erhm, it removes one use of it from the character, were they to have multiple(3+), they would still have multiple(2+). And yeah, you can make the innate ability itself first remove itself with 172 and then add it with 171.

OUTER_SET timer0 = 6 //6 seconds is a turn but as you can not casts spells before that anyways it will look as nothing changed anyways 
COPY_EXISTING ~.spl~ ~override~ //here you name the innate ability spells spell file and then you just
  READ_SHORT 0x1c "spl_type"
  PATCH_IF ("%spl_type%" = "4") THEN BEGIN
    LPF ~ADD_SPELL_CFEFFECT~ INT_VAR opcode = 172 target = 1 timing = 1 resist_dispel = 2 probability1 = 100 STR_VAR resource = EVAL "%SOURCE_RES%" END
    LPF ~ADD_SPELL_CFEFFECT~ INT_VAR opcode = 171 target = 1 timing = 4 resist_dispel = 2 duration = timer0 probability1 = 100 STR_VAR resource = EVAL "%SOURCE_RES%" END
SMALL EDIT, to use the _CFEFFECT instead of the _EFFECT ... this is to make the effect take place as a global effect on the effected creature, which is a must !
Link to comment


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

  • Create New...