Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

[SKY]Script help: NPC using .cast on follower


jred250
 Share

Recommended Posts

Hi I am trying to create a scenario where you talk to an NPC and he will cast a buff spell on you or a follower through dialogue.

I set up the Quest, and I've got it to work for him casting the spell on the PC. In my Topic Info I have this in my Papyrus End script: BuffSpell.Cast(game.getplayer()) with BuffSpell property defined. This works great, but I run into a problem getting the NPC to cast it on my follower:

Now I want the NPC to cast the buff on my current follower, so I put this in the Papyrus End Script:

BuffSpell.Cast(akspeaker,NPC1)

I created a Quest Alias named FollowerAlias that has Find Matching Reference: In Loaded Area, Closest both checked. Conditions are GetInFaction Faction:PotentialFollowerFaction == 1.00

I created a property called NPC1 that is Alias type, and points to FollowerAlias.

When I try to compile the script, it fails telling me that that variable NPC1 is undefined.

What am I doing wrong? Thanks in advance to anyone who wants to help me. I have been struggling with this for a week, and seeing all of the great people on this forum inspired me to create an account and reach out for help.

Link to comment
Share on other sites

Where did you create the variable for NPC1? Some examples of what you have in your script might help.

Also, I am guessing this is the script 'fragment' attached to the dialog choice and not an actual script attached to the quest.

1. I didn't create a variable. I've never done it before and I thought by creating a Quest alias(FollowerAlias) and then creating a property that referenced that alias (NPC1). Are you saying that I need to define a variable in my papyrus fragment? If so, what would that look like (I want it to point to my current follower)? Thank you for all of your help and for responding.

2. Yes, this is a fragment and not a script that I attached. What I have in the End: Papyrus Fragment is BuffSpell.Cast(akspeaker,NPC1)

To the right of that, I clicked on Properties (of the Script Name field) and added the properties for BuffSpell and NPC1. It looks like I need to declare a variable in my Papyrus fragment on top of this? Once again, thank you so much for your help!

Link to comment
Share on other sites

If you have added the property of NPC1, that is a 'variable'.

You need to pull up your fragement code in the script editor window. You should be able to find the name of the fragment from the 'scripts' tab.

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment

;NEXT FRAGMENT INDEX 1

Scriptname blessyou2 Extends TopicInfo Hidden

;BEGIN FRAGMENT Fragment_0

Function Fragment_0(ObjectReference akSpeakerRef)

Actor akSpeaker = akSpeakerRef as Actor

;BEGIN CODE

;comment

buff.cast(akspeaker,NPC1)

;END CODE

EndFunction

;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

Alias Property NPC1 Auto

SPELL Property buff Auto

I fiddled with it, and now I'm getting this as my error:

Starting 1 compile threads for 1 files...

Compiling "blessyou2"...

c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\blessyou2.psc(11,5): type mismatch on parameter 2 (did you forget a cast?)

No output generated for blessyou2, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on blessyou2

Edited by jred250
Link to comment
Share on other sites

Any random follower? I don't know. Perhaps an area effect spell that checks to see if they are in the follower faction, and if so, use it as an object reference?

The problem with spells is they do not keep their values in the variables. When the spell is done, its cleared.

And hardcoding the follower is out of the question.

Perhaps you could use a quest to store the closest actor to the player that is in the follower factions, and use the quest variable in the spell, defined as an object reference.

Alias does not work since you could potentially have 10 of that actor in the game, which would it choose? So it has to be a specific object reference for the 'cast' to work.

Link to comment
Share on other sites

Perhaps you could use a quest to store the closest actor to the player that is in the follower factions, and use the quest variable in the spell, defined as an object reference.

When you say use a quest to store the closest actor to the player, what exactly are you referring to? Thank you for all of your help and feedback, it has been tremendously useful!

Link to comment
Share on other sites

Quests can be used to store values in variables. They really are not a quest the player does, so don't think of it as what a quest is defined as. Think of it as an object in the CK that can be used to store information. Such as the object reference to a follower.

You could have it run once every 5 minutes or so, cause an explosion which checks for any actor in the follower factions, and if it finds one, place the object reference value into the storage container (variable name) in the quest.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...