Jump to content

Scripting Advice Needed


LoginToDownload

Recommended Posts

If OnTriggerMob runs for a Spell, is there any way to determine that's the case? (Ideally, aside from the process of elimination) Is there any way to determine, from there, the base spell? I tried GetActionRef once in such conditions, and I'm pretty sure it doesn't return the base spell...
Link to comment
Share on other sites

If OnTriggerMob runs for a Spell, is there any way to determine that's the case? (Ideally, aside from the process of elimination) Is there any way to determine, from there, the base spell? I tried GetActionRef once in such conditions, and I'm pretty sure it doesn't return the base spell...

I believe all the functions related to this have to be run on something that is actually hit by a spell. If you know the spell ID, you might be able to use that in conjunction with OnTriggerMob. If you're trying to make something figure out what spell you're using, or what was used, I believe you need OBSE, and the spell still needs to hit something pre-defined.

Link to comment
Share on other sites

And TrigZones don't count as hitting something for that purpose? That's what I thought... Many thanks, though. HasMagicEffect doesn't work from my experience, so I would imagine checking if the ActionRef is a certain spell wouldn't do anything either.

Nope, trigzones don't count as something hitting it, only something passing through it. The only way OnTriggerMob would work with a spell is if you either had it open to all spells, and weren't concerned about what was being used, or if you had a very specific spell that you wanted it to detect for. That block type really isn't designed for anything other than traps.

Link to comment
Share on other sites

How would you check for a specific spell? I suppose spells in general would be process of elimination, if it only accepts spells, actors, and arrows, but they don't appear to be turning up if the code goes...

If (ActionRef.IsActor)
<snip>
elseif (ActionRef.IsAmmo == 0)
messagebox "Look at meee!"

Aside from that, (In this case it was actually just arrows and spells in general) I can't think of a way for OnTriggerMob to differentiate between arrows on the ground and arrows flying in one frame, which would be rather necessary for this... Just a plain old "Else" where the elseif is causes it to go spastic as soon as combat is entered. (No time for arrows or spells to be launched) I'm just going to ditch the trigger system and think of something else.

Link to comment
Share on other sites

How would you check for a specific spell? I suppose spells in general would be process of elimination, if it only accepts spells, actors, and arrows, but they don't appear to be turning up if the code goes...

If (ActionRef.IsActor)
<snip>
elseif (ActionRef.IsAmmo == 0)
messagebox "Look at meee!"

Aside from that, (In this case it was actually just arrows and spells in general) I can't think of a way for OnTriggerMob to differentiate between arrows on the ground and arrows flying in one frame, which would be rather necessary for this... Just a plain old "Else" where the elseif is causes it to go spastic as soon as combat is entered. (No time for arrows or spells to be launched) I'm just going to ditch the trigger system and think of something else.

On the bright side, such a system, even is it worked would likely have some significant issues for those with slower framerates. As is, it's possible for arrows to go through walls, creatures, and such if your rate is low and the arrow is moving fast enough.

 

As for making it work with a specific object type, I believe "Begin Ontriggermob <Form ID or Editor ID>" might do that, but can't say since I'm only going from the wiki description. It may even be that those detections only work for specific references, which kinda limits functionallity.

 

If you can have a wall or something behind this trigger box, you could always setup the trigger to enable the activator with just the ontriggermob, then use that wall to determine what as used since the projectile would hit the wall. I would assume that the instance where you need something like this would only have the player firing from one direction, and any projectile would eventually hit something.

Link to comment
Share on other sites

In this case, the idea was to check if the player was being "attacked" by an NPC, arrow, or spell. I made the TrigZone pretty large, which could cause a whole other batch of problems.

Any reason why IsInCombat wouldn't work? Afterall, NPCs HAVE to start combat with the player in order to attack them. The only exception to this would be spells cast through scripting against the player, but those are rarely used, and have some other conditions associated with them.

Link to comment
Share on other sites

Bit more background: The script would be used for a Blink spell that causes the caster to wink in and out of reality. The caster has enough control over it that, if quick, it can be rigged to blink "out" when they're about to be hit, and stay in when attacking (Significantly easier now that IsAnimGroupPlaying is availabe).
Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...