Jump to content

[LE] Testing Combat State using a script within a magic effect


Recommended Posts

I tried multiple methods to test whether or not the player was in combat, I used the OnEffectStart, OnUpdate, OnObjectEquipped events to try to create the product I wanted, but ultimately it did not work out too well. This is what I have so far:

 

Scriptname BladeScript extends activemagiceffect  

Weapon Property Blade Auto

GlobalVariable Property SummonThing  Auto  

MagicEffect Property Effect Auto <-- From the OnEffectStart trail


Event OnObjectEquipped(Form EObject, ObjectReference Reference)

float summon = SummonThing.GetValue()

While  (EObject == Blade)
Debug.Notification("In Combat")
SummonThing.SetValue(10)

If (Game.GetPlayer().GetCombatState() == 0)
Debug.Notification("Out of Combat")
SummonThing.SetValue(0)

endIf
endWhile
endEvent
Edited by PhilTheGamer1111
Link to comment
Share on other sites

This is my further edits, but when testing this, it of course failed.

Scriptname BladeScript extends activemagiceffect  

Weapon Property Blade Auto

GlobalVariable Property SummonThing  Auto  

Event OnObjectEquipped(Form BaseObject, ObjectReference Reference)
	If BaseObject == Blade
		RegisterForSingleUpdate(1.0)
	endIf
endEvent

Event OnUpdate()

	float summon = SummonThing.GetValue()

	If (Game.GetPlayer().IsEquipped(Blade))

		If  (Game.GetPlayer().IsInCombat())
			Debug.Notification("In Combat")
			SummonThing.SetValue(10)

			else 
				Debug.Notification("Not In Combat")
				SummonThing.SetValue(0)
		
		endIf

		RegisterForSingleUpdate(1.0)		

	endIf
endEvent
Edited by PhilTheGamer1111
Link to comment
Share on other sites

  • Recently Browsing   0 members

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