Jump to content

[LE] Scripting help. Section of script being ignored by game


Recommended Posts

I have attached this script to 6 different anchor crystals (static objects). The event on hit section works flawlessly. The event on disable section is ignored completely and dosen't fire when the crystal is disabled. The script compiles fine with no errors. Does anyone know how to fix this? Script:

Scriptname DWAnchorCrystalScript extends ObjectReference  

ObjectReference Property Frag1  Auto 

ObjectReference Property Frag2  Auto 

ObjectReference Property Frag3  Auto 

Sound Property CDS  Auto  

Int Property hitCount Auto

Int Property DWQObj  Auto

Quest Property DWQ  Auto  

GlobalVariable Property ACC  Auto

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
  bool abBashAttack, bool abHitBlocked)
		If HitCount != 7
			HitCount += 1
		ElseIf HitCount >= 7
			CDS.play(Game.GetPlayer())
			Self.disable()
			Frag1.enable()
			Frag2.enable()
			Frag3.enable()
		EndIf			
EndEvent

Event OnDisable()
	DWQ.SetObjectiveCompleted(DWQObj)
		If ACC.GetValue() >= 5
			DWQ.SetStage(60)
		Else
			ACC.SetValueInt(ACC.GetValueInt() + 1)
		EndIf
EndEvent
Link to comment
Share on other sites

I think custom Events need to be explicitly(directly) called just like regular functions. Native Events can be called as well, but the game already knows what to do with those and thus they don't need to be called explicitly.

 

Then again, such event declaration might have been patched out a long time ago.

Edited by Rasikko
Link to comment
Share on other sites

I finally got it working with a little tinkering and rearranging:

Scriptname DWAnchorCrystalScript extends ObjectReference  

ObjectReference Property Frag1  Auto 

ObjectReference Property Frag2  Auto 

ObjectReference Property Frag3  Auto 

Sound Property CDS  Auto  

Int Property hitCount Auto

Int Property DWQObj  Auto

Quest Property DWQ  Auto  

GlobalVariable Property ACC  Auto

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
  bool abBashAttack, bool abHitBlocked)
		If HitCount != 7
			HitCount += 1
		ElseIf HitCount >= 7
			CDS.play(Game.GetPlayer())
			Self.disable()
			Frag1.enable()
			Frag2.enable()
			Frag3.enable()
			DWQ.SetObjectiveCompleted(DWQObj)
			ACC.SetValueInt(ACC.GetValueInt() + 1)
		If ACC.GetValue() >= 6
			DWQ.SetStage(60)
		EndIf
		EndIf
EndEvent
Link to comment
Share on other sites

I think custom Events need to be explicitly(directly) called just like regular functions. Native Events can be called as well, but the game already knows what to do with those and thus they don't need to be called explicitly.

 

Then again, such event declaration might have been patched out a long time ago.

 

Nope, you're still absolutely correct.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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