Jump to content

[LE] Can't use a Function as a property. Why not? Do I even have to?


demnish

Recommended Posts

This is my script:

Scriptname zeebDovaScript extends ActiveMagicEffect

Float Property DefHR = Game.GetPlayer().GetActorValue("HealRate") Auto
Float Property DefMR = Game.GetPlayer().GetActorValue("MagickaRate") Auto
Float Property DefSR = Game.GetPlayer().GetActorValue("StaminaRate") Auto
Float Property DefWSM = Game.GetPlayer().GetActorValue("WeaponSpeedMult") Auto
Float Property DefASM = Game.GetPlayer().GetActorValue("AttackDamageMult") Auto

	EVENT OnEffectStart(Actor akTarget, Actor akCaster)
		Game.GetPlayer().SetActorValue("HealRate", DefHR * 2)
		Game.GetPlayer().SetActorValue("MagickaRate", DefMR * 2)
		Game.GetPlayer().SetActorValue("StaminaRate", DefSR * 2)
		Game.GetPlayer().SetActorValue("WeaponSpeedMult", DefWSM * 2)
		Game.GetPlayer().SetActorValue("AttackDamageMult", DefADM * 2)
	ENDEVENT

	EVENT OnEffectFinish(Actor akTarget, Actor akCaster)
		Game.GetPlayer().SetActorValue("HealRate", DefHR)
		Game.GetPlayer().SetActorValue("MagickaRate", DefMR)
		Game.GetPlayer().SetActorValue("StaminaRate", DefSR)
		Game.GetPlayer().SetActorValue("WeaponSpeedMult", DefWSM)
		Game.GetPlayer().SetActorValue("AttackDamageMult", DefADM)
	ENDEVENT

This is the error message:

 

Starting 1 compile threads for 1 files...

Compiling "zeebDovaScript"...
C:\Games\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\zeebDovaScript.psc(3,23): no viable alternative at input 'Game'
C:\Games\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\zeebDovaScript.psc(3,70): mismatched input '\\r\\n' expecting STATE
C:\Games\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\zeebDovaScript.psc(4,73): mismatched input '\\r\\n' expecting STATE
C:\Games\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\zeebDovaScript.psc(5,73): mismatched input '\\r\\n' expecting STATE
C:\Games\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\zeebDovaScript.psc(6,78): mismatched input '\\r\\n' expecting STATE
C:\Games\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\zeebDovaScript.psc(7,79): mismatched input '\\r\\n' expecting STATE
No output generated for zeebDovaScript, compilation failed.
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on zeebDovaScript

 

How can I store the default value? I don't want my spell to permanetely change something.

Let's say I've leveled up, Health has changed. I've done something so my HealthRate has changed.

How can I store this value before the script runs so I don't mess up my character when the script ends?
Do I worry for no reason since the engine takes care of this automatically?


Kind regards, Zeeb.

Edited by demnish
Link to comment
Share on other sites

Default property values can only be string/boolean/float/integer literals(example: "", true/false, 0.0, 0). They can't be assigned values via return values from functions or math.

 

Also default values through assignment in the script isn't permanent, and for magic effect scripts, especially so. They can be changed where necessary.

Edited by Rasikko
Link to comment
Share on other sites

  • Recently Browsing   0 members

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