Jump to content

Apply magic effect to actor via script?


FiftyTifty

Recommended Posts

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

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

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 by BigAndFlabby
Link to comment
Share on other sites

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

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 by Guest
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...