Jump to content

Alias-related question


Recommended Posts

What exactly are aliases? Are they form lists, arrays or what? They make my head hurt, whatever they are. Let’s take the WorkshopSummonedByAlarmScript as an example. I get that the alias_WorkshopNPCs gets populated with AddRef(theNPC). But what I can’t seem to figure out is how to determine the size of that alias at any given point during the execution of the while loop.


I tried If Alias_WorkshopNPCs.GetSize() < UniqueSpecifiedValue and If Alias_WorkshopNPCs.Length < UniqueSpecifiedValue but the compiler didn’t like either of them. Suggesting they are not forms or arrays, so if there a way to get the size of the Alias_WorkshopNPCs at any given point?




Scriptname WorkshopSummonedByAlarmScript extends Quest

RefCollectionAlias Property Alias_WorkshopNPCs Auto Const

ReferenceAlias Property Alias_Workshop Auto Const

workshopparentscript Property WorkshopParent Auto Const

ActorValue Property WorkshopBellDistance Auto Const

ReferenceAlias Property Alias_Bell Auto Const

function Startup()
; report startup to siren
WorkshopSirenScript siren = Alias_Bell.GetRef() as WorkshopSirenScript
if siren
siren.SetAlarmQuest(self)
endif

ObjectReference[] workshopNPCs = WorkshopParent.GetWorkshopActors(Alias_Workshop.GetRef() as WorkshopScript)
; add them all to the collection
int i = 0
while i < workshopNPCs.Length
ObjectReference theNPC = workshopNPCs[i]
; what distance to travel (to randomize a bit)
int dieRoll = Utility.RandomInt(0, 2)
theNPC.SetValue(WorkshopBellDistance, dieRoll)
Alias_WorkshopNPCs.AddRef(theNPC)
i += 1
endWhile
; start timer
StartTimerGameTime(0.5)
endFunction

; timer shuts down quest
Event OnTimerGameTime(int aiTimerID)
Stop()
EndEvent

Edited by pepperman35
Link to comment
Share on other sites

  • Recently Browsing   0 members

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