IsSummon
Jump to navigation
Jump to search
A User Function for use with Oblivion Script Extender
Syntax:
(isSummon:bool) reference.Call IsSummon
Returns true when the calling reference is a summon. Works by comparing the base form with the actor associated with each of the summon effects.
Notes[edit | edit source]
- This function must be called on a reference (Ref.call <function>)
- In theory it would return true when a summon creature is placed ingame by means other than summon spells(PlaceAtMe or drag-and-drop in the cs). Not very likely though.
- There are two different methodes for the script, each has its own advantages and disadvantages. I highly recommend Methode 1, even if setting things up requires a bit more effort there aren't any real disadvantages.
Methode 1[edit | edit source]
- Requires a spell (type does not matter) with each of the possible summon effects, including any that may be blank (e.g. the Z0XX effects)
- Will work with all magic effects, as long as their effect is added to the spell mentioned above.
Methode 2[edit | edit source]
- Does not require anything else besides the function script
- If the mod user does not have Shivering Isles installed it won't work with alot of the Z0XX effects
- You will need to create two versions, one for non-SI and one for SI. The problem is, if you as a modder do not have SI you won't be able to make an SI version of the script. As soon as you compile a script in the cs that uses a so-called 0 FormID, the script won't work ingame. Even if the specific line is never actually executed ingame or if another mod in your loadorder fills in the 0 FormID.
- Does not work with the Z020 magic effect, even when you got SI.
Examples:[edit | edit source]
Check if the calling reference is a summoned actor or not(in this case an actor that is stored in the someActorRef variable).
Let bIsSummon := someActorRef.Call IsSummon
Or using Eval inside an if-statement
if Eval someActorRef.Call IsSummon ;It's a summon endif
Code[edit | edit source]
Methode 1[edit | edit source]
ScriptName IsSummon
long iMagicEff
long iMagicEffC
ref rMagicEffList
Begin Function {}
let rMagicEffList := SummonEffectsSpell
While iMagicEff < GetMagicItemEffectCount rMagicEffList
let iMagicEffC := GetNthEffectItemCode rMagicEffList iMagicEff
let iMagicEff += 1
if iMagicEffC == 0
Continue
endif
if MagicEffectUsesCreatureC iMagicEffC
if GetBaseObject == GetMagicEffectUsedObjectC iMagicEffC
SetFunctionValue 1
Break
endif
endif
let iMagicEffC := 0
Loop
End
Methode 2[edit | edit source]
ScriptName IsSummon
long iMagicEff
ref rMagicEff
Begin Function {}
While iMagicEff < 40
let iMagicEff += 1
if iMagicEff == 1
let rMagicEff := ZCLA
elseif iMagicEff == 2
let rMagicEff := ZDAE
elseif iMagicEff == 3
let rMagicEff := ZDRE
elseif iMagicEff == 4
let rMagicEff := ZDRL
elseif iMagicEff == 5
let rMagicEff := ZFIA
elseif iMagicEff == 6
let rMagicEff := ZFRA
elseif iMagicEff == 7
let rMagicEff := ZGHO
elseif iMagicEff == 8
let rMagicEff := ZHDZ
elseif iMagicEff == 9
let rMagicEff := ZLIC
elseif iMagicEff == 10
let rMagicEff := ZSCA
elseif iMagicEff == 11
let rMagicEff := ZSKA
elseif iMagicEff == 12
let rMagicEff := ZSKC
elseif iMagicEff == 13
let rMagicEff := ZSKE
elseif iMagicEff == 14
let rMagicEff := ZSKH
elseif iMagicEff == 15
let rMagicEff := ZSPD
elseif iMagicEff == 16
let rMagicEff := ZSTA
elseif iMagicEff == 17
let rMagicEff := ZWRA
elseif iMagicEff == 18
let rMagicEff := ZWRL
elseif iMagicEff == 19
let rMagicEff := ZXIV
elseif iMagicEff == 20
let rMagicEff := ZZOM
elseif iMagicEff == 21
let rMagicEff := Z001
elseif iMagicEff == 22
let rMagicEff := Z002
elseif iMagicEff == 23
let rMagicEff := Z003
elseif iMagicEff == 24
let rMagicEff := Z005
endif
;The rest of the Magic Effects are for the SI-version
if iMagicEff == 25
let rMagicEff := Z004
elseif iMagicEff == 26
let rMagicEff := Z006
elseif iMagicEff == 27
let rMagicEff := Z007
elseif iMagicEff == 28
let rMagicEff := Z008
elseif iMagicEff == 29
let rMagicEff := Z009
elseif iMagicEff == 30
let rMagicEff := Z010
elseif iMagicEff == 31
let rMagicEff := Z011
elseif iMagicEff == 32
let rMagicEff := Z012
elseif iMagicEff == 33
let rMagicEff := Z013
elseif iMagicEff == 34
let rMagicEff := Z014
elseif iMagicEff == 35
let rMagicEff := Z015
elseif iMagicEff == 36
let rMagicEff := Z016
elseif iMagicEff == 37
let rMagicEff := Z017
elseif iMagicEff == 38
let rMagicEff := Z018
elseif iMagicEff == 39
let rMagicEff := Z019
endif
if rMagicEff == 0
Continue
endif
if MagicEffectUsesCreature rMagicEff
if GetBaseObject == GetMagicEffectUsedObject rMagicEff
SetFunctionValue 1
Break
endif
endif
let rMagicEff := 0
Loop
End
See Also[edit | edit source]