cecell

Papyrus Inter-script Communication

Jun 12th, 2021
873
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Scriptname playerAliasScript extends ReferenceAlias
  2.  
  3. activatorAliasScript property activatorScript auto hidden ; added by player
  4.  
  5. event OnInit()
  6.   activatorScript = theActivatorAlias as activatorAliasScript
  7. endevent
  8.  
  9. function testPlayer()
  10.   Debug.Notification("This is from the player alias script!")
  11. endfunction
  12.  
  13. event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
  14.   activatorScript.testActivator()
  15. endevent
  16.  
  17. ReferenceAlias property theActivatorAlias auto ; Added in CK
  18.  
  19.  
  20. ----TWO SEPARATE SCRIPTS----
  21.  
  22.  
  23. Scriptname activatorAliasScript extends ReferenceAlias
  24.  
  25. playerAliasScript property playerScript auto hidden ; added by player
  26.  
  27. event OnInit()
  28.   playerScript = thePlayerAlias as playerAliasScript
  29. endevent
  30.  
  31. function testActivator()
  32.   Debug.Notification("This is from the activator alias script!")
  33. endfunction
  34.  
  35. event OnActivate(ObjectReference akActionRef)
  36.   playerScript.testPlayer()
  37. endevent
  38.  
  39. ReferenceAlias property thePlayerAlias auto ; Added in CK
RAW Paste Data