2021-10-05 22:15:58 +00:00
|
|
|
Scriptname CWCatapultStrikeSpawnerScript extends ObjectReference
|
|
|
|
|
|
|
|
Sound Property AMBrCivilWarCatapultsDistantM Auto
|
|
|
|
|
|
|
|
Activator Property CWCatapultStrike Auto
|
|
|
|
{BASEOBJECT: Pointer to CWCatapultStrike activator}
|
|
|
|
|
|
|
|
int numLinkedRefs
|
|
|
|
|
|
|
|
int lastChosenLink
|
|
|
|
|
|
|
|
Event OnLoad()
|
|
|
|
|
|
|
|
lastChosenLink = 0
|
|
|
|
numLinkedRefs = countLinkedRefChain()
|
|
|
|
|
|
|
|
EndEvent
|
|
|
|
|
|
|
|
Function CallCatapultStrike()
|
|
|
|
|
|
|
|
;Call a catapult strike sfx on itself (0) or a random linkedref (n)
|
|
|
|
;note: it won't ever call a strike on the same marker more than once, unless there aren't any links
|
|
|
|
|
|
|
|
int randomLinkNum = lastChosenLink
|
|
|
|
|
|
|
|
While randomLinkNum == lastChosenLink && NumLinkedRefs != 0
|
|
|
|
randomLinkNum = Utility.RandomInt(0, numLinkedRefs)
|
|
|
|
EndWhile
|
|
|
|
|
|
|
|
lastChosenLink = randomLinkNum
|
|
|
|
|
|
|
|
ObjectReference placeAtRef = GetNthLinkedRef(randomLinkNum)
|
|
|
|
|
|
|
|
placeAtRef.placeAtMe(CWCatapultStrike)
|
2024-02-21 14:51:07 +00:00
|
|
|
|
|
|
|
if placeAtRef.Is3DLoaded()
|
|
|
|
AMBrCivilWarCatapultsDistantM.Play(placeAtRef)
|
|
|
|
endif
|
2021-10-05 22:15:58 +00:00
|
|
|
|
|
|
|
EndFunction
|
|
|
|
|