FiftyTifty Posted October 17, 2017 Share Posted October 17, 2017 In Skyrim, you would just create a spell and call the cast function on the NPC, like so: ActorRef.Cast(spellHeal) But Fallout 4's version of Papyrus does not have the Cast() function. So how do we now do that? As for why I need to do that, I want to add another entry to the robot hacking terminal, where you can heal the hacked robot. To do that, I need to apply a magic effect to the robot itself, but I can't figure out a way to do that. Link to comment Share on other sites More sharing options...
FlashyJoer Posted October 17, 2017 Share Posted October 17, 2017 ActorREF.Addspell() https://www.creationkit.com/index.php?title=AddSpell_-_Actor Link to comment Share on other sites More sharing options...
FiftyTifty Posted October 17, 2017 Author Share Posted October 17, 2017 ActorREF.Addspell() https://www.creationkit.com/index.php?title=AddSpell_-_ActorWouldn't that only make the spell usable by the NPC, rather than actually casting it on the NPC? Link to comment Share on other sites More sharing options...
shavkacagarikia Posted October 17, 2017 Share Posted October 17, 2017 If you set type of the spell to ability, it will run needed magic effect on actor as soon as added. Link to comment Share on other sites More sharing options...
Deleted6306543User Posted October 18, 2017 Share Posted October 18, 2017 (edited) You would then also have to script the spell to remove itself. Not impossible, but it's easier to just make a potion and script the application of that to the actor. (Don't have to add the potion to their inventory, by the way.) Edited October 18, 2017 by Guest Link to comment Share on other sites More sharing options...
FiftyTifty Posted October 18, 2017 Author Share Posted October 18, 2017 You would then also have to script the spell to remove itself. Not impossible, but it's easier to just make a potion and script the application of that to the actor. (Don't have to add the potion to their inventory, by the way.)Aye, that does sound better. But then how do you script the actor to use the item? Link to comment Share on other sites More sharing options...
JonathanOstrus Posted October 19, 2017 Share Posted October 19, 2017 (edited) Fallout 4 does still have a Cast() function. It works slightly differently though since you call the spell's method instead of the object ref method. Like this spellHeal.Cast(akSource, akTarget)https://www.creationkit.com/fallout4/index.php?title=Cast_-_Spell Edited October 19, 2017 by BigAndFlabby Link to comment Share on other sites More sharing options...
FiftyTifty Posted October 19, 2017 Author Share Posted October 19, 2017 Fallout 4 does still have a Cast() function. It works slightly differently though since you call the spell's method instead of the object ref method. Like this spellHeal.Cast(akSource, akTarget)https://www.creationkit.com/fallout4/index.php?title=Cast_-_Spell Agh. I swear I didn't see it in the function reference page. So I'd just make a spell with a magic effect that lasts for five seconds, cast it from the player to the robot, and 'ey presto, it's fixed up and dandy. Link to comment Share on other sites More sharing options...
Deleted6306543User Posted October 19, 2017 Share Posted October 19, 2017 (edited) Sounds like you solved your issue, but just for the sake of completeness, to have a potion applied to an actor by script: Actor Property ActorToApplyPotionTo auto const Potion Property PotionToApply auto const Function ApplyPotionToActor() ActorToApplyPotionTo.EquipItem(PotionToApply) EndFunction Edited October 19, 2017 by Guest Link to comment Share on other sites More sharing options...
Recommended Posts