Jump to content

Can you set a function into a float variable?


psych0v0yager

Recommended Posts

Here is My script

 

 

Scriptname DwemerDestructionScaling extends activemagiceffect
Event OnEffectStart (Actor akTarget, Actor akCaster)
If akTarget == game.getPlayer()
float Damage = 50*((game.getPlayer().getAV("Destruction"))/20)
float Current = game.getplayer().ForceActorValue("DestructionPowerMod", Damage)
float Goal = Current-Damage
Utility.Wait(960.0)
game.getplayer().ForceActorValue("DestructionPowerMod", Goal)
EndIf
EndEvent
Here are the errors:
Starting 1 compile threads for 1 files...
Compiling "DwemerDestructionScaling"...
D:\Games\steamapps\common\skyrim\Data\Scripts\Source\temp\DwemerDestructionScaling.psc(11,10): type mismatch while assigning to a float (cast missing or types unrelated)
No output generated for DwemerDestructionScaling, compilation failed.
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on DwemerDestructionScaling
Link to comment
Share on other sites

ForceActorValue does not return a float. Therefore you cannot assign it to a variable. If the function returned a float, then yes you could do that.

 

You might want to try:

Scriptname DwemerDestructionScaling extends activemagiceffect  
 
Event OnEffectStart (Actor akTarget,  Actor akCaster)
	If akTarget == game.getPlayer()
		float Damage = 50*((akTarget.getAV("Destruction"))/20)
		akTarget.ForceActorValue("DestructionPowerMod", Damage)
		float Current = akTarget.GetActorValue("DestructionPowerMod")
		float Goal = Current-Damage
		Utility.Wait(960.0)
		akTarget.ForceActorValue("DestructionPowerMod", Goal)
	EndIf
EndEvent 

Since you have already compared akTarget to Game.GetPlayer() there is no point in continuing to use Game.GetPlayer(). You can make it more thread safe and faster by simply using akTarget instead.

 

You are suspending the script for 960 seconds? That is a lot of time, why not make the effect have a duration of 960 seconds instead. Then you can use the OnEffectFinish event to do the final actor value adjustment.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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