jucoking Posted April 20, 2019 Share Posted April 20, 2019 I have a custom enemy who is casting a spell via script, but when the script fires it just shoots the projectile in the default direction (straight out in front of the actor who is casting). Here is what the script looks like (partial): Event OnLoad() ... Self.TranslateToRef(Point2, 800.0) BloodySpell.Cast(Enemy1, PlayerRef) utility.wait(0.3) ... All of my properties are filled correctly and everything else associated with the script. It all works fine except for the fact that the spell doesn't TARGET the PlayerRef. It is an "aimed" spell that is "fire and forget" and is a slightly altered version of the "Vampire Blood Plague" spell. If anyone has a clue as to why this isn't targeting the player, please let me know. Thanks in advance. Link to comment Share on other sites More sharing options...
maxarturo Posted April 20, 2019 Share Posted April 20, 2019 You have Script the source - casting point, this is done for objects. In spells you Script only the effect done to the NPC on hit not the casting point. Link to comment Share on other sites More sharing options...
jucoking Posted April 21, 2019 Author Share Posted April 21, 2019 You have Script the source - casting point, this is done for objects.In spells you Script only the effect done to the NPC on hit not the casting point. According to the creation kit wiki, the form of a scripted cast is: Spell.Cast(akCaster, akTarget) However, I tried it without the source as you suggested and simply used: Spell.Cast(akTarget) It will compile if scripted this way, however, the spell is still not targeting the PlayerRef. It's just shooting off in front of the enemy. Link to comment Share on other sites More sharing options...
maxarturo Posted April 21, 2019 Share Posted April 21, 2019 (edited) You created a spell - modified version of "Vampire Blood Plague" from the "Vampire blood plague spell Ring" if you've done it correctly you don't need a script for this. Now if you want this spell to do something else + more to the target when fire by an NPC you add a script to it specifying what you want the spell to do "OnHit". Spell Property MySpell01 Auto ObjectReference Property CurrentTarget Auto Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile) if aksource == MySpell01 if CurrentTarget MySpell01.Cast(self, CurrentTarget) DO STUFF OR EVENT OnHit(ObjectReference akAggressor, Form akSource, Projectile akProj) * This is a rough example. Edited April 21, 2019 by maxarturo Link to comment Share on other sites More sharing options...
Ghaunadaur Posted April 21, 2019 Share Posted April 21, 2019 According to the wiki this will not work, if the source an actor Actor races can be set to cast magic only in the direction that the actor is facing; if the source is an actor with this racial setting, the target will be ignored. (Exception: if the spell is a Target Actor spell, it will hit regardless of distance or direction) Link to comment Share on other sites More sharing options...
foamyesque Posted April 21, 2019 Share Posted April 21, 2019 It's combat; I've run into the same issue. Outside of combat, Cast() will work as expected for most races. However, in combat, aimed spells will fire directly ahead and only directly ahead. Link to comment Share on other sites More sharing options...
jucoking Posted April 22, 2019 Author Share Posted April 22, 2019 It's combat; I've run into the same issue. Outside of combat, Cast() will work as expected for most races. However, in combat, aimed spells will fire directly ahead and only directly ahead.Yeah, I'm giving up on it at this point. As far as I'm concerned, "Cast" and it's counterpart "DoCombatSpellApply" are completely and utterly useless. It's impossible to script a spell and have it work correctly. According to the wiki this can't be used on an actor, so I made XMarkers around the arena to target instead and it still doesn't work. As a side note, the UseMagic(Procedure) is equally useless. I can't even get it to work outside of combat, let alone using conditions for in combat. It's sad because I'm almost completely finished with my mod and I have yet to run into an issue I can't script around or find help, but this has forced me to water down my original ideas for a very cool boss fight. Anyway, thanks everyone for your input! Link to comment Share on other sites More sharing options...
Recommended Posts