Jump to content

GetDistance used in area of effect spell


Recommended Posts

How do I determine how far an enemy is away from a spell, such as a fireball? I want to make damage conditions based upon how far an enemy is away from my fireball. The GetDistance function wants a parameter, such as Player, which would render the spell completely useless, because I don't want to create conditions based upon how far the target reference is away from the player, but rather the fireball itself.
Link to comment
Share on other sites

You could maybe try casting to an activator. Check out the tutorial "Casting Spells from an activator" on cs.elderscrolls.com

 

Then you could measure the distance from that. The distance formula (in 2D) is the square root of (x^2 + y^2). Hope that that works!

Link to comment
Share on other sites

There's already a 'GetDistance' command, as was mentioned in the first post and the topic title. Casting spells from an activator is also entirely useless for figuring out how far something is from the point of impact.

You might check out Supreme Magicka's 'Blink' spell, which teleports the player to the place it is cast at, to see how it figures out where the spell hit.

 

Alternatively, you could just add several fire damage effects to the spell, with identical damage and decreasing areas, e.g.

http://i53.tinypic.com/4jbdd.png

Edited by whalecakes
Link to comment
Share on other sites

There's already a 'GetDistance' command, as was mentioned in the first post and the topic title. Casting spells from an activator is also entirely useless for figuring out how far something is from the point of impact.

You might check out Supreme Magicka's 'Blink' spell, which teleports the player to the place it is cast at, to see how it figures out where the spell hit.

 

Alternatively, you could just add several fire damage effects to the spell, with identical damage and decreasing areas

 

I like your alternative idea. My thinking with the activator was that you could use the dummy target (activator) as the epicenter of the explosion (just in case the caster misses) You could then use GetDistance from that. Doing that way should also let you penalize (or reward) casters for hitting distant targets, have the spell go off on a timer, allow for multiple explosions, or whatever. It just seemed more versatile. Then again, your solution is much more elegant and answers the question much better :thumbsup:

Edited by Um the Muse
Link to comment
Share on other sites

If I'm not misunderstood, it goes like this:

 

SCN xx

REF Target
REF objectref1
REF objectref2

BEGIN ScriptEffectStart

set Target to GetSelf
set objectref1 to activatorRef1
set objectref2 to activatorRef2

;objectref1 will move next to the target
;objectref2 will move 8k feet over the target
;objectref2 will cast the fireball, coming down to the target

objectref1.MoveTo Target -500, 80, 0		
objectref2.MoveTo objectref1 0, 0, 8000		
objectref2.Cast Fireball objectref1 

END

 

Kinda works, but if your AOE on your spell is too big, you'll end up having multiple activators being cast at ALL targated npcs, and therefore each will receive the same amount of damage, as they are always the same distance away.

Edited by VirtualSpace
Link to comment
Share on other sites

Huh?

He's trying to get aoe spells to do more damage based on how close the NPCs hit are to the center the the AOE.

As in, you throw a fireball, it hits 5 feet away from an NPC, so they take slightly less damage from the fireball's explosion.

 

What are you two even talking about? None of those are remotely close, or make any sense otherwise...

Link to comment
Share on other sites

I think whalecakes has the best idea with the multiple damage effects with decreasing areas. I kind of understand what Um the Muse is talking about. VirtualSpace, there are so many things wrong with your last post.

 

Why would you move objectref1 to over 500 units away from the target and then cast the spell at it? Wouldn't that ensure you would totally miss the target? And why is objectref2 casting the fireball from over 8000 units away? I'm not even sure the spell flies that far, and even if it does, it would take forever for the fireball to reach objectref1. Doubly ensuring that you will totally miss the target. And also, it's technically the same activators that you keep moving around, not multiple activators.

 

I'm not sure exactly what you want to do with your spell. Are you just trying to make something like a meteor shower? If so, just do exactly what's done here except replace the lightning spells with fire spells.

Edited by fg109
Link to comment
Share on other sites

  • Recently Browsing   0 members

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