Skip to content

new Script Trigger: detect effect

The user and all related content has been deleted.

Comments

  • kjeronkjeron Member Posts: 2,367
    This can already be achieved with Spell States. Using your provided scenario:

    Create a new Spellstate in SPELLSTATE.IDS, unique to the girl.

    Opcode(328): SetState, Param2= (her unique spellstate), Special = IWD2 mode. Add to any spell that needs to be considered.

    Replace SpellCastOnMe() trigger with Trigger(0x40e2):CheckSpellState(O:Object*,I:State*splstate). Check if the spellstate has been activated.

    If you need to remove it for any reason:
    Opcode(337): Remove Effects by Opcode, Param1= (her unique spellstate), param2 = 328.

    Or you can reverse the whole process: give her a permanent effect setting the Spell state, and have the spells to be considered remove it, and check if it has been removed.
  • The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,367
    edited November 2015

    So let's look at a concrete example to see if I understand: let's say, Greater Malison. The targets will be affected by (among other things) opcode 33 "save vs. death modifier" for some duration, call it 10 rounds. An AI mod like SCS might have
    IF
    SpellCastOnMe('WIZARD_GREATER_MALISON')
    THEN And then it might script the creature to cast Dispel Magic, or Improved Invisibility, to improve its saving throws.

    Now, if I make a kit able to cast an innate version of Greater Malison, or add Greater Malison as a cleric spell, then that script will fail.

    Are you suggesting, we could append a new spell state (something like STATE_MALISON) to spellstate.ids, and then patch the various Malison spells to add a new effect using opcode 328 setting the spellstate of the target (for the same 10 rounds?) and then change the script to use CheckSpellState...?

    Would that work for instantaneous effects? Could I make a cleric version of Secret Word, and have it detected by scripts that currently use

    SpellCastOnMe('WIZARD_SECRET_WORD')
    ??
    Yes.

    Triggers such as SpellCastOnMe only check for actions occurring in the last script round, so applying the SpellState for one second(or round) would provide a similar window for it to be checked. Specific cases will require slightly different approaches depending on the dynamics of the spell and use, and you may need to remove the SpellState in the response to prevent multiple triggers. You would need to put the Set:Spellstate effect in a subspell to prevent the base spell from being removed in the case of non-instant effects.

    The upper bound of SPELLSTATE.IDS appears to be 1023, which is an odd limit, but should be plenty of room to work with, only 60 currently used in IWDEE.

    Edit:
    I'm don't want to discourage the request though. I do agree that an OpcodeCastOnMe trigger would make this far simpler and easier, and support the request. And would like to ask that, similar to Opcode 328, it would offer the option to specify Param2 settings when checking, as many opcodes can be used for vastly different purposes depending on their parameters.
  • The user and all related content has been deleted.
Sign In or Register to comment.