4
Fork 0

Added missing critterPerch

remove-levelsystem
Eddoursul 4 months ago
parent 7568d43c56
commit ae341f973a
  1. BIN
      scripts/critterperch.pex
  2. BIN
      scripts/custom.pex
  3. 7
      source/scripts/critterperch.psc
  4. 36
      source/scripts/custom.psc

Binary file not shown.

Binary file not shown.

@ -0,0 +1,7 @@
scriptName critterPerch extends objectReference
{simple script to allow perches to be reserved}
bool property reserved auto hidden
{should this object be invalidated for searches?}
objectReference property incoming auto hidden
{reference which has reserved me, and is assume to be incoming}

@ -0,0 +1,36 @@
Scriptname Custom Hidden
import objectReference
;This function takes in an ObjectReference and counts the number of linked refs that are in a linked Ref chain.
int Function countLinks(objectReference currentLink) global
;Don't use this on a loop of linked refs.
int numPorts = 0
while(currentLink) ; && (numPorts < 100)) ;runs until currentLink is None.
currentLink = currentLink.getLinkedRef()
numPorts = numPorts + 1
endWhile
if numPorts < 100
return numPorts
else
; debug.trace( "Too many links, or the linked refs are arranged in a loop." )
return 0
endif
endFunction
;This function returns the Nth objectReference in a linked ref chain.
;The root link in the chain is 1
objectReference Function goToLink(int linkNum, objectReference startRef ) global
int linkIndex = 1
while(linkNum != linkIndex )
linkIndex = linkIndex + 1
objectReference nextRef = startRef.getLinkedRef()
if nextRef
startRef = nextRef
else
; debug.trace( "Tried to access None link in custom.GoToLink()" )
endif
endWhile
return startRef
endFunction
Loading…
Cancel
Save