Author Topic: AOE Spell immunity for Allied Hostile Creatues  (Read 390 times)

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
AOE Spell immunity for Allied Hostile Creatues
« on: June 08, 2015, 06:07:43 pm »


               How are people controlling for creature AOE spell effects so that they don't affect their own allies or themselves?


All too often, I see a creature caster use an AOE spell and then, given the limitations of the AI, rush into the zone to become affected itself or have allied creatures in the zone get affected.


I'd like to ensure that hostile creatures or allies of the creature are immune to the effect.


Not sure if it is related, since the documentation doesn't seem to reference this effect in the wiki, but I'm using a difficulty setting of 2 (Normal).


How are others handling it?
               
               

               
            

Legacy_Thayan

  • Sr. Member
  • ****
  • Posts: 435
  • Karma: +0/-0
AOE Spell immunity for Allied Hostile Creatues
« Reply #1 on: June 08, 2015, 07:27:09 pm »


               

I don't have a working example, but in the x0_i0_spells library there is a spellsIsTarget() function in which you can specify what target type will be affected by a spell. the Lexicon goes into detail about the three main options you have with that function. But if you only want hostiles, you could set it up like this in the AOE's OnEnter event:


 


if (spellsIsTarget(oTarget, SPELL_TARGET_SELECTIVEHOSTILE, GetAreaOfEffectCreator())) {


  //Do the hostile-affecting-only AOE stuff here


}


 


If you're not looking to modify AOE scripts though, the Lexicon description of that spellsIsTarget function give some module switches you can enable or disable which (should?) determine what target types get negatively affected by (all?) AOEs.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
AOE Spell immunity for Allied Hostile Creatues
« Reply #2 on: June 08, 2015, 07:40:19 pm »


               

Npcs are immune to the aoe spells of others from same faction, unless you turn this off via module switch (and there are plenty of warnings not to do that).


 


There is however bug in spellsIsTarget that causes caster itself to be affected, this applies not only to persistent aoes like acid fog but also instant dmg aoe spells like ice storm. This bug is fixed in my patch.


 


PS. Im bit unsure about neutral npc behavior tho and its also definitely a problem with henchmans/familiars (who might turn on you and even attack you - should be fixed in my patch too) unless you play on party pvp settings.