Jump to content

Script: Event for Holotapes


Zorkaz

Recommended Posts

`So I got a bit excited about the opportunities with this, but naturally there are inconsistencies.

 

 

(1) A script attached to the holotape NOTE form:
(1.1) Holotape added to player inventory:
SKK_testHolotapeScript.OnContainerChanged [Actor < (00000014)>] None
(1.2) Holotape loaded into Pipboy
SKK_testHolotapeScript.OnEquipped [Actor < (00000014)>]
*BUT* this event is not actually generated until the holotape menu is exited/unloaded (because the world is "on hold" in menus ?)
(1.3) Holotape removed from Pipboy
None. Event OnUnEquipped is NOT generated.
(1.4) Holotape inserted into fixed terminal:
SKK_testHolotapeScript.OnContainerChanged [workshopobjectscript < (FF00150F)>]
SKK_testHolotapeScript.OnHolotapePlay [workshopobjectscript < (FF00150F)>]
(1.5) Holotape removed from fixed terminal:
SKK_testHolotapeScript.OnContainerChanged [Actor < (00000014)>] [workshopobjectscript < (FF00150F)>]
(2.0) A script attached to the Holotape TERM Menu generates zero events during this insert & remove testing.
The script


Scriptname SKK_testHolotapeScript extends ObjectReference Const

Event OnInit()
	Debug.Trace("SKK_testHolotapeScript.OnInit")
EndEvent

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
	Debug.Trace("SKK_testHolotapeScript.OnContainerChanged " + akNewContainer + " " + akOldContainer)
EndEvent

Event OnEquipped(Actor akActor)
	Debug.Trace("SKK_testHolotapeScript.OnEquipped " + akActor)
EndEvent

Event OnUnEquipped(Actor akActor)
	Debug.Trace("SKK_testHolotapeScript.OnUnEquipped " + akActor)
EndEvent

Event OnActivate(ObjectReference akActionRef)
	Debug.Trace("SKK_testHolotapeScript.OnEquipped " + akActionRef)
EndEvent

Event OnHolotapePlay(ObjectReference akTerminalRef)
	Debug.Trace("SKK_testHolotapeScript.OnHolotapePlay " + akTerminalRef)
EndEvent

 

Link to comment
Share on other sites

  • 7 months later...

The "holotapeLoaded" animation generates an event when a holotape is inserted to your Pip-Boy (immediatelly).

Event OnQuestInit()
	RegisterForAnimationEvent(Game.GetPlayer(), "holotapeLoaded")
endevent


Event OnAnimationEvent(ObjectReference akSource, string asEventName)
  if (asEventName == "holotapeLoaded")
    		debug.notification("holotapeLoaded")
  endIf
endEvent

But it does not work if the "insert" animation is skipped (when you load your holotape the second time).

 

I think calling a function on the OnMenuItemRun event is the most reliable.

Edited by LarannKiar
Link to comment
Share on other sites

Have been using that for some player initiated actions, but there is no autoplay.

 

Note that there can be sequencing issues depending on the functions called:

Event OnMenuItemRun(int auiMenuItemID, ObjectReference akTarget) ;Avoids crappy menu fragments.

;(pSKK_COVIDQuest as SKK_COVIDQuestScript).COVIDHolotapePlayed() ; no this is sync does not execute until the menuitem releases and refreshes.
(pSKK_COVIDQuest as SKK_COVIDQuestScript).CallFunctionNoWait("COVIDHolotapePlayed", New Var[0]) ; yes this runs fine async.

EndEvent
Link to comment
Share on other sites

  • 1 month later...

Ok, so if you're using a custom flash holotape (Type "Program"), there is a way to emulate the OnHolotapePlay() event - By cunningly exploiting the fact that notifyScripts/OnHolotapeChatter is bugged and doesn't work in Terminals!

 

In the Flash Holotape Actionscript, use notifyScripts API after the app setup is complete:

BGSCodeObj.notifyScripts("MYSCRIPT:PIPBOY_BOOTSTRAP");

And in the Papyrus script:

Event OnHolotapeChatter(string astrChatter, float afNumericData)
	If (astrChatter == "MYSCRIPT:PIPBOY_BOOTSTRAP")
		Debug.Trace(Self + ": INFO - Pipboy detected; Commencing BOOTSTRAP...")		
		; fake OnHolotapePlay event with Terminal reference <none>
		OnHolotapePlay(none)
	EndIf
EndEvent

Works reliably fine on the Pipboy and won't interfere with the regular Terminal "boot" process where OnHolotapePlay() directly fires as expected.

More important, it only gets dispatched to the particular Holotape that's actually being played on the Pipboy - Unlike solutions involving OnMenuOpenCloseEvent().

The only thing to take care of is, OnHolotapePlay() would normally occur *before* the tape starts playing, whereas with the bootstrap method, it will occur *after* the tape begun playing.

 

My upcoming Papyrus Terminal mod uses this technique, so you will be able to run your Papyrus script Holotapes both on Terminals and in the Pipboy, without having to worry about any of this.

 

 

 

IrcMq41.png

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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