Jump to content
Heavy Traffic ×

Help with spell targeting


compEngineer314

Recommended Posts

Hi,
I'm not that great with spells and whatnot.

But here's a way I tested it and it works ok in the brief i tried of it.
What i did was:

Created an empty Game Start Enabled quest.
Attached this script to the new empty quest.

Scriptname TwoTargetQS extends Quest

Float Property fTimeOut = 5.0 Auto
{TimeOut after the first target hit if no second target hit. Default 5 seconds}

Activator Property SummonTargetFXActivator Auto
{Not needed, using this for an example action of the two targets}

Spell Property TwoTargetSpell Auto
{Not needed, just using this to add the spell to the player}

Actor T1

Event OnInit()
    Game.GetPlayer().AddSpell(TwoTargetSpell)
EndEvent

Function CheckTarget(Actor akTarget)
    If !T1
        T1 = akTarget
        RegisterForSingleUpdate(fTimeOut)
    Else
        If T1 != akTarget
            ;Do some action with the two targets (example swaps the 2 targets postion while using a fx)
            ObjectReference FXRef1 = T1.PlaceAtMe(SummonTargetFXActivator)
            ObjectReference FXRef2 = akTarget.PlaceAtMe(SummonTargetFXActivator)
            T1.MoveTo(FXRef2)
            akTarget.MoveTo(FXRef1)
            T1 = None
        EndIf
    EndIf
EndFunction

Event OnUpdate()
    If T1
        T1 = None
    EndIf
EndEvent

Then I duplicated InfluenceConfUpFFAimed magic effect and I removed the attached script and added my own script.
I Pointed the TwoTargetQS Property to my quest I created beforehand.

Scriptname TwoTargetMES extends ActiveMagicEffect

TwoTargetQS Property TTQS Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
    If akTarget
        TTQS.CheckTarget(akTarget)
    EndIf
EndEvent

I also edited the effect and set it to Effect Archetype: Script
And also removed the conditions.

Then I created a new Spell and Added my new magic effect to the spell with 0 duration.

Then I set 2 of the 3 properties on the quest script I created earlier using AutoFill (SummonTargetFXActivator property and TwoTargetSpell property).

Here's my test sample esp and scripts of it if you want to give it a try and dissect it to create your own version of what your after.

There are probably better ways to do what your after, but this was just one approach going by what you said you wanted to do.

 

Basically you cast the spell at the first target and cast the spell at a second target and they will swap postions with each other.

You have a 5 second timout if you don't target the second actor before 5 seconds.

The spell will be auto added to you when you first load the esp (Two Targets is the spell name and it's listed as an Illusion spell).

 

 

 

 

Edited by sLoPpYdOtBiGhOlE
Link to comment
Share on other sites

  • Recently Browsing   0 members

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