I am trying to script an NPC to Cast a spell at the player or on themselves but it won't work.
I can setup a package on a custom NPC with "useMagic" that tells them to cast a summon spell at the player as soon as combat starts no worries (as long as the NPC has the spell already or I script add it in game). That works fine tested it multiple times, but it won't help in my mod.
I can make an NPC cast a fireball at the player with a script applied in game, I can even make an NPC instant cast a fireball spell at a chicken in the middle of town blaming the player for the crime! with just a simple script I can apply in game with a spell.
What I CANT do is make any NPC cast any spell that requires a Target Location with said scripted spell i.e. Runes and Summons.
This is driving me crazy and I have tried everything I can think of...
- Calling my own custom NPC with god like powers and all spells then casting my "ForceCastSummon" spell at them.
- Creating a reference marker to force-cast the summon spell at me or another reference marker at the players feet.
- Summoning a Giant chicken just above the players head facing the floor then trying to make it force-cast a summon spell.
- Multiple combinations of custom spells and markers/actors to cast the summon spell.
If I use a script to make the player Cast() a spell all the self targeting spells are fine but anything with 'Target' or 'TargetLocation' only goes toward the player cross hair not the target I dictate in the script. I have read on the wiki this may be because by default an actor can only cast were they are facing so I tried calling an actor to near the player, make them face or fight the player then cast the spell. NOPE!
If SpellToCast != None SpellToCast.RemoteCast(PlayerRef, PlayerRef, PlayerRef) ;Cast from akCaster, too akTarget, blaming the akBlame. Endif
I've used: PlaceAtMe(), PlaceActorAtMe(), StartCombat(), SetLookAt(), Cast(), RemoteCast(), AddSpell(), actor bases, created multiple object references, actor references, custom spells, custom functions, debug messages, tried looking on wiki and message boards, placing hands over eyes and shouting "AAAAAAAAAAAAAAAAAAGGGGGGGGGG". But nothing seems to work.
As far as I can tell I have once again found something that CAN NOT be done via Papyrus. I can make it work with an AI package added in the CK but that will not help for my mod at all.
If anyone has found a way to make an NPC (or just an object/reference) use a script that can be applied via a spell, cast a summon or rune type spell at the player or any location please for the love of all that is good and holy tell me.