Salk Posted April 28, 2016 Share Posted April 28, 2016 Hello! I was wondering if there is a way to make sure a script that contain HitBy or AttackedBy (I am not sure I know what the difference is between these two, by the way: perhaps that the latter returns true even if the attack missed?) would not fire if the damage is coming from friendly AoE spells like Fireball, Cloud Kill and so on... I fear there might be no way to do that but if someone has a suggestion, it'd be great! Thanks! Link to comment
critto Posted April 28, 2016 Share Posted April 28, 2016 (I am not sure I know what the difference is between these two, by the way: perhaps that the latter returns true even if the attack missed?) According to the documentation, this is true. Returns true only if the active CRE was attacked in the style specified (not necessarily hit) or had an offensive spell cast on it by the specified object in the last script round. The style parameter is non functional - this trigger is triggered by any attack style. I presume that you've tested the obvious solution (checking that the O:Object is someone from the party)? Link to comment
Salk Posted April 28, 2016 Author Share Posted April 28, 2016 I presume that you've tested the obvious solution (checking that the O:Object is someone from the party)? I am not sure I understand? The Object I used was Player1 and my only testing was shooting a fireball to the creature which turned hostile. Barebone script: IF HitBy(Player1,0) THEN RESPONSE #100 Enemy() END Link to comment
lynx Posted April 28, 2016 Share Posted April 28, 2016 So what's wrong with: IF HitBy([ANYONE],0) !HitBy([PC],0) THEN RESPONSE #100 Enemy() END Link to comment
Salk Posted April 28, 2016 Author Share Posted April 28, 2016 The problem with that is that the creature would not turn hostile if the damage comes from the party. The only damage I want to exclude is that from friendly AoE spells. Link to comment
lynx Posted April 28, 2016 Share Posted April 28, 2016 the only thing that comes to mind then is to use more hitby triggers, checking for the non-physical damage types only. Link to comment
critto Posted April 28, 2016 Share Posted April 28, 2016 the only thing that comes to mind then is to use more hitby triggers, checking for the non-physical damage types only. But the damage may come from non-AoE spells as well. Fire damage could come from an intentional, targeted Flame Arrow, and so on. The only thing that comes to my sleep-deprived mind is to use a state variable. I don't see an immediate way to detect an AoE spell during at run-time with a trigger. But modifying states on AoE spells is probably incompatible with Detectable Spells or a similar larger system adopted by many mods that people use routinely. Another crazy idea is to use a more advanced scripting system like that of DavidW's in SCS. It could probably compile a total list of AoE spells during installation, dynamically generate a script that checks for all AoE spells if they were cast by a party member in the last round and set a timer or something, and compile it for usage inside the game at run-time. Basically, what SCS does routinely. And this timer could be used in an appropriate code block in combination with HitBy([PC],0) to prevent erroneous Enemy() action. But that's too complicated and would fail for any AoE spell that was added after the Salk's grossly over-engineered mod is installed Link to comment
Fiann of the Silver Hand Posted April 28, 2016 Share Posted April 28, 2016 Opcode 309 in the spell. Have the AoE set a variable on creatures hit. Friendlies can have a script to ignore (or revert EA or whatever) the hit if true. [edit] If this is for your familiars, you can grant them immunity via eff in the spells the same way the Tweakpack gives elves resistance to sleep/charm, except use EA:Familiar instead of RACE:Elf or whatever. Link to comment
Salk Posted April 28, 2016 Author Share Posted April 28, 2016 Yes, I was trying to think of a way to make the familiars not leave if damaged by friendly AoE spells. I might give your suggested solution a try, Fiann of the Silver Hand, although ideally the familiar should still take the damage. Thanks. Link to comment
Salk Posted April 28, 2016 Author Share Posted April 28, 2016 the only thing that comes to mind then is to use more hitby triggers, checking for the non-physical damage types only. That would indeed be ideal. I'll take a look. Thanks. Link to comment
critto Posted April 28, 2016 Share Posted April 28, 2016 Opcode 309 in the spell. Have the AoE set a variable on creatures hit. Friendlies can have a script to ignore (or revert EA or whatever) the hit if true. Yeah, I figured there was an easier way to do all this. Definitely the way to go here. Link to comment
Ardanis Posted April 28, 2016 Share Posted April 28, 2016 I believe this should be enough. IF AttackedBy([0],DEFAULT) !Allegiance(LastAttackerOf(Myself),GOODCUTOFF) !StateCheck(LastAttackerOf(Myself),0x80002002) // confused, charmed, berserk THEN RESPONSE #100 // END You don't really need HitBy(), as AttackedBy() is already triggered by the "hostile" spell flag which pretty much everything non-friendly has set. Another crazy idea is to use a more advanced scripting system like that of DavidW's in SCS. It could probably compile a total list of AoE spells during installation, dynamically generate a script that checks for all AoE spells if they were cast by a party member in the last round and set a timer or something, and compile it for usage inside the game at run-time. Basically, what SCS does routinely. And this timer could be used in an appropriate code block in combination with HitBy([PC],0) to prevent erroneous Enemy() action. No. Just no. Link to comment
Salk Posted April 29, 2016 Author Share Posted April 29, 2016 I believe this should be enough. IF AttackedBy([0],DEFAULT) !Allegiance(LastAttackerOf(Myself),GOODCUTOFF) !StateCheck(LastAttackerOf(Myself),0x80002002) // confused, charmed, berserk THEN RESPONSE #100 // ENDYou don't really need HitBy(), as AttackedBy() is already triggered by the "hostile" spell flag which pretty much everything non-friendly has set. This wouldn't make my Familiar ever turn hostile if attacked by GOODCUTOFF. Instead I need intentional friendly fire to make it happen. The only thing I could think of, even if far from ideal was: !Detect([EVILCUTOFF]) so that damage (of any kind) taken during battle would be ignored. Link to comment
Magus Posted April 29, 2016 Share Posted April 29, 2016 I'm not sure there's a point in this. If the player want to kill the familiar, he'll just fireball it to death then. Link to comment
Salk Posted April 30, 2016 Author Share Posted April 30, 2016 I'm not sure there's a point in this. If the player want to kill the familiar, he'll just fireball it to death then. It is a minor thing, surely. But I never liked the fact that you could intentionally hurt the familiar without consequences. The fact that it is going to leave if that happens adds a little depth to it, I think. Also, it is a way to break the bond with the familiar to summon a new one without suffering the -1 malus to constitution for three days as in case of death by hand of enemies. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.