Talk:Cast - Spell

From the CreationKit Wiki
Jump to navigation Jump to search

Spells cast using this method will use conditionals defined for their effects with akSource as the caster. This was something I was curious about so I tested it. (not extensively but I was able to fire 2 different debug messages based on whether or not the player had a specific ability)
Magnitude of the spell will also benefit from skill level of the caster (maybe from active magic effects too?). Tested with a destruction spell which had 10 magnitude in the ck, which did 15 damage coming from my 90 Destruction level character.
Cscottydont 06:03, 19 February 2012 (EST)

Spells that are script-Cast with the player as the akSource will benefit from perks relevant to the spell being cast.
e.g. If FireSpell is a 100 magnitude spell with MagicDamageFire as a keyword,
FireSpell.Cast(ObjectReference akSource, ObjectReference akTarget)
^ will do 150 damage to akTarget if akSource has both augmented flames perks.
Cscottydont 07:28, 3 March 2012 (EST)




Using this function will invalidate (cause it to return 0/false when it should return 1/true) any ongoing isDualCasting checks on akSource. So any mod that makes use of the cast - spell function will conflict with any mod that utilizes the isDualCasting condition. The same is true of RemoteCast - Spell.
Test Method

  1. Created a scripted ability to periodically fire a test spell using the Cast function with the player as akSource.
  2. Continuously dual cast the Flames spell.
  3. Used console to check "player.isDualCasting" - returned 1.00 (true)
  4. Scripted ability fired the test spell.
  5. Used console to check "player.isDualCasting" - returned 0.00 (flase)


Cscottydont (talk) 2013-01-29T15:32:26 (EST)

Cast and unloaded cells[edit source]

This function returns an error if called when either akSource or akTarget is in unloaded cell.
Check if cell the target (or caster, depending on your script) is currently in is attached, to determine if it's safe to call Cast():

If akTarget.GetParentCell().IsAttached()
    mySpell.Cast(akSource, akTarget)
EndIf

--Ingvion (talk) 07:07, 11 October 2023 (EDT)