Jump to content

Convert Skyrim Invulnerable Script to Fallout 4


Joshlaryeth

Recommended Posts

This is what I've done so far but cannot compile. Any help would be greatly appreciated.


Scriptname AAA_ParalysisInvincible extends activemagiceffect


ActorValue property HealthAV





Event OnEffectStart(Actor akTarget, Actor akCaster)

Target = akTarget

SpellHP = 100

StartTimerGameTime(UpdateSpeed)

EndEvent


Event OnTimerGameTime()

If (SpellHP > 0.0)

float HealthPercent

HealthPercent = Target.GetValuePercentage(HealthAV)

If (HealthPercent < 1.0)

float Healthcurrent

float HealthToHeal

HealthCurrent = Target.GetValue(HealthAV)

HealthToHeal = ((HealthCurrent / HealthPercent) - HealthCurrent)

If HealthToHeal > SpellHP

HealthToHeal = SpellHP

Endif

Target.RestoreValue(HealthAV, HealthToHeal)

float SpellHP

SpellHP -= HealthToHeal

Endif

StartTimerGameTime(0.2)

Else

self.Dispel()

Endif

EndEvent

Link to comment
Share on other sites

Didn't tested it, but I think it should work correctly:

Scriptname AAA_ParalysisInvincible extends activemagiceffect

Float Property UpdateSpeed = 0.2 Auto Hidden

Float SpellHP
Actor Target

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Target = akTarget
	SpellHP = 100.0
	StartTimerGameTime(UpdateSpeed)
EndEvent
 
Event OnTimerGameTime()
	If (SpellHP > 0.0)
		ActorValue HealthAV = Game.GetHealthAV()
		float HealthPercent = Target.GetValuePercentage(HealthAV)
		If (HealthPercent < 1.0)
			float Healthcurrent = Target.GetValue(HealthAV)
			float HealthToHeal = (HealthCurrent / HealthPercent) - HealthCurrent
			If HealthToHeal > SpellHP
				HealthToHeal = SpellHP
			Endif
			Target.RestoreValue(HealthAV, HealthToHeal)
			SpellHP -= HealthToHeal
		Endif
		StartTimerGameTime(UpdateSpeed)
	Else
		Dispel()
	Endif
EndEvent

Edited by DieFeM
Link to comment
Share on other sites

On the other hand, I want to point out that this script doesn't make the actor invulnerable as your thread's title suggests, it just keeps healing the actor for a limited amount of health.

 

If you really want to set the actor invulnerable for the duration of the magic effect I would consider using something like this:

Scriptname AAA_SetInvulnerableEffect extends activemagiceffect

Event OnEffectStart(Actor akTarget, Actor akCaster)
	akTarget.GetLeveledActorBase().SetInvulnerable()
EndEvent
 
Event OnEffectFinish(Actor akTarget, Actor akCaster)
	akTarget.GetLeveledActorBase().SetInvulnerable(false)
EndEvent
Link to comment
Share on other sites


Scriptname AAA_ParalysisInvincible extends activemagiceffect
Float Property UpdateSpeed = 0.2 Auto Hidden
Float SpellHP
Actor Target
Event OnEffectStart(Actor akTarget, Actor akCaster)
Target = akTarget
SpellHP = 100.0
StartTimerGameTime(UpdateSpeed)
EndEvent
Float Property UpdateSpeed2 = 0.25 Auto Hidden
ActorValue Property HealthAV auto
float Function GetValue(ActorValue akAV)
Event OnTimerGameTime(UpdateSpeed2)
If (SpellHP > 0.0)
ActorValue HealthAV = Game.GetValue("HealthAV")
float HealthPercent = Target.GetValuePercentage("HealthAV")
If (HealthPercent < 1.0)
float Healthcurrent = Target.GetValue("HealthAV")
float HealthToHeal = (HealthCurrent / HealthPercent) - HealthCurrent
If HealthToHeal > SpellHP
HealthToHeal = SpellHP
Endif
Target.RestoreValue("HealthAV", HealthToHeal)
SpellHP -= HealthToHeal
Endif
StartTimerGameTime(UpdateSpeed)
Else
Dispel()
Endif
EndEvent

I'm getting: "no viable alternative at input event now". Should I be using an extends other than activemagiceffect?

 

Edited by Joshlaryeth
Link to comment
Share on other sites

Scriptname AAA_ParalysisInvincible extends activemagiceffect

Float Property UpdateSpeed = 0.2 Auto Hidden

Float SpellHP
Actor Target

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Target = akTarget
	SpellHP = 100.0
	StartTimerGameTime(UpdateSpeed)
EndEvent
 
Event OnTimerGameTime(int aiTimerID)
	If (SpellHP > 0.0)
		ActorValue HealthAV = Game.GetHealthAV()
		float HealthPercent = Target.GetValuePercentage(HealthAV)
		If (HealthPercent < 1.0)
			float Healthcurrent = Target.GetValue(HealthAV)
			float HealthToHeal = (HealthCurrent / HealthPercent) - HealthCurrent
			If HealthToHeal > SpellHP
				HealthToHeal = SpellHP
			Endif
			Target.RestoreValue(HealthAV, HealthToHeal)
			SpellHP -= HealthToHeal
		Endif
		StartTimerGameTime(UpdateSpeed)
	Else
		Dispel()
	Endif
EndEvent

 

The parameter was missing in the event Event OnTimerGameTime(int aiTimerID)

Edited by DieFeM
Link to comment
Share on other sites

  • Recently Browsing   0 members

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