Jump to content

FMR Spell Script + Requiem


Beccy

Recommended Posts

Hey folks, i've been working this last week or so with two amazing mod authors to try and resolve a minor bug between Forgotten Magic Redone and Requiem, where a spell from FMR doesn't fire properly when installed with Requiem. We've isolated the issue to targeting specifically. For some reason the code (Listed below) doesn't aquire the target when requiem is installed (How, or why this happens i've no idea.)

 

Target Code

 

 

Event onEffectStart(Actor akTarget, Actor akCaster)
	if (akCaster.HasMagicEffect(vPHOECDFF))
		dispel()
		debug.trace("FMR ---> Phoenix Strike failed because of cooldown.")
		return
	endif
	caster = akCaster
	target = caster.getCombatTarget()
	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

 

 

 

Ogerboss suggested a variant targeting method, aktarget, and i changed the code as a result to :

 

 

 

Scriptname vRiftEffectScript extends activemagiceffect  

actor caster
actor target
float fX1
float fY1
float fZ1
float fX2
float fY2
float fZ2

Event onEffectStart(Actor akTarget, Actor akCaster)
	if (akCaster.HasMagicEffect(vPHOECDFF))
		dispel()
		debug.trace("FMR ---> Phoenix Strike failed because of cooldown.")
		return
	endif
	caster = akCaster
	;; target = caster.getCombatTarget()
       target = akTarget
	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

 

 

 

Which made the spell fire, just at me rather than my target, now i'm utterly useless with scripts, its taken me a little over a week to understand how to edit the scripts contained within FMR. So i'm just asking for some help in changing the script to target an opponent rather than myself, and any possible, plausible suggestions as to why this targeting method might fail with Requiem installed,

 

Thanks in advance for any help you can offer.

Beccy

Edited by Beccy
Link to comment
Share on other sites

  • Replies 47
  • Created
  • Last Reply

Top Posters In This Topic

Just a wild guess....

 

you changed

	caster = akCaster
	target = caster.getCombatTarget()

into

	caster = akCaster
	;; target = caster.getCombatTarget()
       target = akTarget

and the player became the target....

 

So why not trying the following instead

	caster = akCaster
	target = akTarget.getCombatTarget()

Link to comment
Share on other sites

Just tested your suggestion Ishara and the changes go back to making the spell return a no-target :S My test subject is a hostile frost troll just outside of windhelm (I have a save where he's aggro'd me and i'm about 30yds away) So theres no intervening objects to get in the way of the spell, or anything of the sort, the script just doesn't seem to recognize him as an enemy while requiem is installed.

Edited by Beccy
Link to comment
Share on other sites

akCaster and akTarget are probably returning the same because I'm pretty sure it's a cast on self spell: "caster.doCombatSpellApply(PHOECD, caster)". It's checking if the caster has an active effect, and then putting an effect on the caster. It never puts an effect on the target. My best guess would be that requiem is changing something in the combat system that is interfering with GetCombatTarget().Try this script and let us know the results. This assumes you have SKSE installed. It should give you two notifications (I don't know which is better, so I just put them both in). They should tell you the caster and the target. The target will be empty but Caster won't, which means GetCombatTarget() is failing. I would hazard a guess that Requiem has a perk, an always running quest, a story event node, or a magic effect on an ability which is doing something with the targets. When it does that thing, it's interfering with the function being used here. It's a guess, though, so I might be wrong.

 

 

Event onEffectStart(Actor akTarget, Actor akCaster)
	if (akCaster.HasMagicEffect(vPHOECDFF))
		dispel()
		debug.trace("FMR ---> Phoenix Strike failed because of cooldown.")
		return
	endif
	caster = akCaster
	target = caster.getCombatTarget()
	Debug.Notification("Caster: " + caster + ", Target: " + target)
	Debug.Notification("Caster: " + caster.GetName() + ", Target: " + target.GetName())
	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

 

 

 

Alternatively, if you have logging enabled, you can just open your log. I suspect it'll contain the line "MR ---> Phoenix Strike failed because target is None." I can't think of way off hand to get the target aside from that function, so you should probably focus on figuring out why that function isn't working if it indeed isn't.

 

Finally, for convenience, try changing that event and loading your save. You won't have to add the spell or anything, you can just cast it that way, and it should work as long as the script doesn't have any properties that you've changed (and nothing it relies on has properties you've changed, such as "PHOECD"). Typically, the scripts themselves update, and it's just the saved variable (possibly even only property) values that the engine gets messed up on.

Link to comment
Share on other sites

Hey Ishara i've tested with new saves and and new games and the effects have always been the same, i guess i've just been lazy doing it this way, but a clean save might be better for testing purposes i guess :D

 

Thanks for your help Xander, i'll give your suggestion a try like i said ive tried asking Ogerboss but he's very busy and i've not had the help i'd have liked from that quater, but i can't really complain, Requiem is a monster mod and probably has a lot of upkeep. Anyway! I'll try your script now, i have had event logging enabled and target is none is exactly the debug that came back, so far we've not been able to figure out why or how requiem interferes with the getCombatTarget() line, but i'll try ogerboss again.

 

its annoying that of all the spells added by FMR this is the one i want the most, and i can't play without requiem anymore >< i've tried, i just cant :D

 

Beccy

Link to comment
Share on other sites

I tried your script Xander and nothing changed, the logs still reported the "Target is None" result, but i did have a problem compiling your script, i got an error saying "GetName()" wasn't a function?, i saved anyway because i know you said it assumed i had SKSE installed and figured it might be some code that SKSE read that CK didn't but nothing new happened, nothing showed up in the logs or the console that i could see. Let me know what/where i should look at i'll take a peek.

 

Otherwise all the same outcome :(

 

Beccy

Link to comment
Share on other sites

The GetName() error was because you don't have all of the SKSE scripts installed. It doesn't actually matter, it just means that it won't compile. Saving anyway and trying it in game should have made a notification appear in the corner of your screen. But the way I set up the notifications wasn't a sure thing that they would appear. However, it doesn't actually matter.

 

Since you already know that the error is "Target was None", we already know where it's messing up. The problem is that it's nothing wrong with the script. The script is working perfectly. It's the GetCombatTarget() function that's messed up. Requiem is possibly interfering with it on a whole different level. Like, doing something that is completely overwriting the function's processing, or it's making it so the player doesn't actually have a target by messing with combat. Messing with this script won't fix that unless you can find a different way to get the target altogether.

 

After typing all that out, I just realized, you'd have the same results if Caster wasn't being set properly. Since akCaster and akTarget are both the player, then may very well have both failed to fill. It's possible it's not ( or at least not only) the GetCombatTarget() function. Try this and let us know i what your notification says. I'll do it properly this time. I suspest it'll say "~1: Caster: 1, Target: 0", in which case it's what I already said above. If it has "Caster: 0", though, then it might be fixable at least so the player can use it.

 

 

 

Event onEffectStart(Actor akTarget, Actor akCaster)
	if (akCaster.HasMagicEffect(vPHOECDFF))
		dispel()
		debug.trace("FMR ---> Phoenix Strike failed because of cooldown.")
		return
	endif
	caster = akCaster
	target = caster.getCombatTarget()
	Int CasterFilled = 0
	Int TargetFilled = 0
	If caster
		CasterFilled = 1
	EndIf
	If target
		TargetFilled = 1
	EndIf
	Debug.Notification("~1: Caster: " + CasterFilled + ", Target: " + TargetFilled)
	CasterFIleld = 0
	TargetFilled = 0
	If Game.GetPlayer()
		CasterFilled = 1
	EndIf
	If Game.GetPlayer().GetCombatTarget()
		TargetFilled = 1
	EndIf
	Debug.Notification("~2: Caster: " + CasterFilled + ", Target: " + TargetFilled)
	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

 

 

 

Note that there will be two notifications in the corner. Tell us both.

Edited by Xander9009
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...