Difference between revisions of "GetNumSummons"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Kyoma
(New page: __NOTOC__ A User Function for use with Oblivion Script Extender '''Syntax:''' GetNumSummons Returns the number of summons that are active on ...)
 
imported>Kyoma
m (Added GetSummoner link)
 
(4 intermediate revisions by the same user not shown)
Line 3: Line 3:


'''Syntax:'''
'''Syntax:'''
  GetNumSummons
  (numSummons:short) reference.Call GetNumSummons
 
Returns the number of summons that are active on the reference.  
Returns the number of summons that are active on the reference.  


==Notes==
==Notes==
*This function must be called on a reference (Ref.call <function>)  
*This function must be called on a reference (Ref.call <function>)  
*Each summoned creature is counted seperately, even when they are of the same kind.
*Each summoned creature is counted seperately, even when they are of the same kind.


==Examples:==
==Examples:==
Line 17: Line 14:
Getting the number of summons active on a reference (in this case the player)
Getting the number of summons active on a reference (in this case the player)
  Let NumSummons := player.Call GetNumSummons
  Let NumSummons := player.Call GetNumSummons


==Code==
==Code==
Line 29: Line 25:
  let arFollowers := GetFollowers
  let arFollowers := GetFollowers
  let iFollower := GetNumFollowers
  let iFollower := GetNumFollowers
  While iFollower > 0
While iFollower > 0
  let iFollower -= 1
  let iFollower -= 1
  let rFollower := GetNthFollower iFollower
  let rFollower := GetNthFollower iFollower
Line 39: Line 34:
  let arFollowers := ar_Null
  let arFollowers := ar_Null
  End  
  End  
 
Alternative code for use with [[GetSummons]] (to avoid duplicate code)
 
ScriptName GetNumSummons
Begin Function {}
SetFunctionValue (ar_Size (Call GetSummons))
End
==See Also==  
==See Also==  
* [[User Functions]]
* [[User Functions]]
* [[GetNthSummon]]
* [[GetSummons]]
* [[GetSummoner]]


[[Category: User Functions]]
[[Category: User Functions]]


<!-- Begin Search Terms
<!-- Begin Search Terms
Summons
Summon
End Search Terms -->
End Search Terms -->

Latest revision as of 06:55, 26 December 2009

A User Function for use with Oblivion Script Extender

Syntax:

(numSummons:short) reference.Call GetNumSummons

Returns the number of summons that are active on the reference.

Notes[edit | edit source]

  • This function must be called on a reference (Ref.call <function>)
  • Each summoned creature is counted seperately, even when they are of the same kind.

Examples:[edit | edit source]

Getting the number of summons active on a reference (in this case the player)

Let NumSummons := player.Call GetNumSummons

Code[edit | edit source]

ScriptName GetNumSummons
array_var arFollowers
ref rFollower
long iFollower

Begin Function {}
	let arFollowers := GetFollowers
	let iFollower := GetNumFollowers
 	While iFollower > 0
		let iFollower -= 1
		let rFollower := GetNthFollower iFollower
		ar_Erase arFollowers ( ar_Find rFollower arFollowers )
	Loop

	SetFunctionValue ( ar_Size arFollowers )
	let arFollowers := ar_Null
End 

Alternative code for use with GetSummons (to avoid duplicate code)

ScriptName GetNumSummons

Begin Function {}
	SetFunctionValue (ar_Size (Call GetSummons))
End 

See Also[edit | edit source]