Difference between revisions of "GetNumSummons"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Kyoma
imported>Kyoma
Line 38: Line 38:
* [[User Functions]]
* [[User Functions]]
* [[GetNthSummon]]
* [[GetNthSummon]]
* [[GetSummons]]


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

Revision as of 10:38, 24 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

  • 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:

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

Let NumSummons := player.Call GetNumSummons

Code

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 

See Also