Xander9009 Posted February 23, 2014 Share Posted February 23, 2014 That's not quite what I expected... I hadn't noticed that it does actually get the position of the target. Since there isn't one, it's moving you to the coordinates 0,0,0. You'd have to get the angle you're looking, and then modify the variables holding your position by a an amount that you obtain from the combination of the current values and the angle you're facing. Basically, lots of trig, and I am in no way capable of doing that when I'm this close to going to sleep. For something I can do while extremely tired, how about this not-so-great workaround: Event onEffectStart(Actor akTarget, Actor akCaster) if (akCaster.HasMagicEffect(vPHOECDFF)) dispel() debug.trace("FMR ---> Phoenix Strike failed because of cooldown.") return endif RegisterForCrosshairRef() caster = akCaster ; target = caster.getCombatTarget() While !(target as Actor ) EndWhile if ( target ) && ( target.getFlyingState() == 0 ) if (bMain) vs.UpdateAffinityProgress(sIndex) vs.UpdateXP(sIndex = sIndex, fMin = 5.0, fMax = 10.0, fGrowth = 1.5, bQuiet=0) endif caster.doCombatSpellApply(PHOECD, caster) sfx00.play(caster) efx.play(caster) fx1 = caster.getPositionX() fy1 = caster.getPositiony() fz1 = caster.getPositionz() fx2 = target.getPositionX() fy2 = target.getPositiony() ; fx2 = target.getPositionX() + (120 * Math.Sin(target.GetAngleZ())) ; fy2 = target.getPositiony() + (120 * Math.Cos(target.GetAngleZ())) fz2 = target.getPositionz() debug.trace("FMR ---> Phoenix Strike moving the player character now.") caster.translateto(fX2, fY2, fZ2, 0.0, 0.0, 0.0, 3000.0) else dispel() if ( target ) debug.trace("FMR ---> Phoenix Strike failed because target is flying.") else debug.trace("FMR ---> Phoenix Strike failed because target is None.") endif endif Endevent Event OnCrosshairRefChange(ObjectReference ref) target = ref UnregisterForCrosshairRef() EndEvent When you cast the spell, it'll wait until you look at a new actor. The moment you do, it'll continue with the script using the actor you just looked at as the target. It's not particularly great, since it means you have to cast the spell while not looking at the target, and then look at the target. But at least it has a chance to not fling you to the center of Skyrim. Link to comment Share on other sites More sharing options...
Beccy Posted February 23, 2014 Author Share Posted February 23, 2014 Haha thank you for your patience and hard work here Xander, you really don't know how much this means to me, i'll test your new suggestion right now and hope for the best ^^ Link to comment Share on other sites More sharing options...
Beccy Posted February 23, 2014 Author Share Posted February 23, 2014 Starting 1 compile threads for 1 files... Compiling "vRiftEffectScript"... C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\vRiftEffectScript.psc(18,1): RegisterForCrosshairRef is not a function or does not exist C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\vRiftEffectScript.psc(52,1): type mismatch while assigning to a actor (cast missing or types unrelated) C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\vRiftEffectScript.psc(53,1): UnregisterForCrosshairRef is not a function or does not exist No output generated for vRiftEffectScript, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. :S Should i compile it anyway? Link to comment Share on other sites More sharing options...
Xander9009 Posted February 23, 2014 Share Posted February 23, 2014 I don't actually know for sure if that will work, but you can try it. You can make SKSE work such that you can properly compile the script by manually installing it. Just download the 7z version, unpack it, and put everything inside directly in your skyrim folder. Link to comment Share on other sites More sharing options...
Beccy Posted February 23, 2014 Author Share Posted February 23, 2014 Still not compiling properly, smaller error this time though, Starting 1 compile threads for 1 files... Compiling "vRiftEffectScript"... C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\vRiftEffectScript.psc(52,1): type mismatch while assigning to a actor (cast missing or types unrelated) No output generated for vRiftEffectScript, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on vRiftEffectScript When i tested with the last compiled effort it still tried to teleport me to 0,0,0 :S Link to comment Share on other sites More sharing options...
Xander9009 Posted February 23, 2014 Share Posted February 23, 2014 (edited) Event onEffectStart(Actor akTarget, Actor akCaster) if (akCaster.HasMagicEffect(vPHOECDFF)) dispel() debug.trace("FMR ---> Phoenix Strike failed because of cooldown.") return endif RegisterForCrosshairRef() caster = akCaster ; target = caster.getCombatTarget() While !target EndWhile if ( target ) && ( target.getFlyingState() == 0 ) if (bMain) vs.UpdateAffinityProgress(sIndex) vs.UpdateXP(sIndex = sIndex, fMin = 5.0, fMax = 10.0, fGrowth = 1.5, bQuiet=0) endif caster.doCombatSpellApply(PHOECD, caster) sfx00.play(caster) efx.play(caster) fx1 = caster.getPositionX() fy1 = caster.getPositiony() fz1 = caster.getPositionz() fx2 = target.getPositionX() fy2 = target.getPositiony() ; fx2 = target.getPositionX() + (120 * Math.Sin(target.GetAngleZ())) ; fy2 = target.getPositiony() + (120 * Math.Cos(target.GetAngleZ())) fz2 = target.getPositionz() debug.trace("FMR ---> Phoenix Strike moving the player character now.") caster.translateto(fX2, fY2, fZ2, 0.0, 0.0, 0.0, 3000.0) else dispel() if ( target ) debug.trace("FMR ---> Phoenix Strike failed because target is flying.") else debug.trace("FMR ---> Phoenix Strike failed because target is None.") endif endif Endevent Event OnCrosshairRefChange(ObjectReference ref) target = ref as Actor If target UnregisterForCrosshairRef() EndIf EndEvent?? Edited February 23, 2014 by Xander9009 Link to comment Share on other sites More sharing options...
Beccy Posted February 23, 2014 Author Share Posted February 23, 2014 That one compiled perfectly, testing now. Link to comment Share on other sites More sharing options...
Xander9009 Posted February 23, 2014 Share Posted February 23, 2014 Well, I just spotted an issue with it. I fixed it just now. Link to comment Share on other sites More sharing options...
Beccy Posted February 23, 2014 Author Share Posted February 23, 2014 Hmmm no joy, the spells goes off, i get a 5s buff from the spell called "Phoenix Strike" but nothing else happens, i don't 'charge' at the target or anything. Tried casting it (looking off first, then moving the cursor / crosshairs over the target) first on a civilian, then when it didn't work, aggro'd a guard and tried it on them and still nothing. Link to comment Share on other sites More sharing options...
Xander9009 Posted February 23, 2014 Share Posted February 23, 2014 Did you update after I changed that last bit? I changes the last event to not stop updating the crosshair changes until it finds a valid target. Originally, it stopped immediately. That meant if the very first the your crosshairs changed to wasn't an actor, it would just never exit the script. Link to comment Share on other sites More sharing options...
Recommended Posts