Jump to content

Determine if an area effect spell in progress?


Recommended Posts

I had a rather humorous moment when my area script spawned a creature while there was a cloudkill spell in affect in the area.  They did, basically, an Arte Johnson (ok, showing my age...from Laugh-In in the 60s or 70s).  They waltzed in  and fell right over.  Ok, back to the drawing board.  I worked  around it, but it would be better if I could hold off on spawning them until the spell was finished.

I do check for combat (CombatCounter(0)), but if the crew are off to the side of the spell's area of effect, it doesn't show them as being in combat - or so I would assume.  There is dialogue that has probably happened, and I know that can throw off the accuracy of CombatCounter so it is very possible that is what has happened.

Anyway, is there a way determine if my poor innocent unsuspecting spawns are doomed upon arrival?

Link to comment

I don't know if there is a general and broadly applicable, convenient way to do this (but use "ActuallyInCombat()" instead of the combat counter, it works better), but you could invent something for special cases. For one area or for one type of creature with special effects on it. One possibility is to patch AOE spells (but how will you know all AOE spells out there?) with a double Set global variable effect, one immediately setting the global to 1 and the other delayed by 6 seconds setting it back to 0.  The target should be Party - at least somebody will be alive there for the effect to latch on. Then you can script your creature to check for that global OnCreation() and DestroySelf() if it is set. It would look strange for creatures to blink out of existence, so you would need to equip them with a few effects - remove the feet circle and the animation for, say, 5 ticks, and give them protection from opposite allegiance for the same duration so that enemies don't start attacking empty air. Give them protection from Sleep too. 5 ticks should be enough to run the check and disappear without disturbing the burgers.

If it's your area script doing the spawning, you won't even all that, just put in a check, but then you will be limited to that one area, whereas with the creatures themselves checking you can create something universal and interesting, like a spell that only summons monsters out of combat - or only in combat, for that matter. The best option in this case would be to summon an intermediary, an invisible minion with Translucency 255, no circle and with all these protections and "Hide status" to run the check. If all okays, the minion can do  CreateCreatureObjectOffset off itself in any direction you want, at any distance, with any creature files, then eliminate itself. It needs an animation, not NULL_ANIMATION, to count off the offset. Other than that, this is very flexible and the only way to do many things.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...