Jump to content

[LE] Need a very simple script to add item to a chest after dialogue


Dahveed

Recommended Posts

Now I get this:

 

Starting 1 compile threads for 1 files...
Compiling "_DOM_TIF__060D5BDD"...
F:\Skyrim Special Edition\Data\Source\Scripts\temp\_DOM_TIF__060D5BDD.psc(9,28): cannot convert to unknown type _dom_dominquecontroller
F:\Skyrim Special Edition\Data\Source\Scripts\temp\_DOM_TIF__060D5BDD.psc(9,28): cannot cast a quest to a _dom_dominquecontroller, types are incompatible
F:\Skyrim Special Edition\Data\Source\Scripts\temp\_DOM_TIF__060D5BDD.psc(9,56): _dom_dominquecontroller is not a known user-defined type
No output generated for _DOM_TIF__060D5BDD, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on _DOM_TIF__060D5BDD

 

The script is _DOM_DominiqueController, which is in the "scripts" tab of my follower quest.

Link to comment
Share on other sites

This is my entire _DOM_DominiqueController script (from the "script" tab on the right side of the quest window):

 

 

 

Scriptname _DOM_DominiqueController extends Quest



Actor Property PlayerREF Auto

ReferenceAlias Property FollowerAlias Auto

Faction Property DismissedFollowerFaction Auto

Faction Property CurrentHireling Auto

Message Property FollowerDismissMessage Auto

Message Property FollowerDismissMessageWedding Auto

Message Property FollowerDismissMessageCompanions Auto

Message Property FollowerDismissMessageCompanionsMale Auto

Message Property FollowerDismissMessageCompanionsFemale Auto

Message Property FollowerDismissMessageWait Auto

SetHirelingRehire Property HirelingRehireScript Auto

GlobalVariable Property FollowerRecruited Auto

Int Property iFollowerDismiss Auto Conditional

ObjectReference Property DomGiftChest Auto

MiscObject Property BrowniePoint Auto


Function SetFollower(ObjectReference FollowerRef)

actor FollowerActor = FollowerRef as Actor

FollowerActor.RemoveFromFaction(DismissedFollowerFaction)

If FollowerActor.GetRelationshipRank(PlayerREF) <3 && FollowerActor.GetRelationshipRank(PlayerREF) >= 0

FollowerActor.SetRelationshipRank(PlayerREF, 3)

EndIf

FollowerActor.SetPlayerTeammate()

FollowerAlias.ForceRefTo(FollowerActor)

FollowerActor.EvaluatePackage()

FollowerRecruited.SetValue(1)

EndFunction



Function FollowerWait()

actor FollowerActor = FollowerAlias.GetActorRef() as Actor

FollowerActor.SetActorValue("WaitingForPlayer", 1)

SetObjectiveDisplayed(10, abforce = true)

EndFunction



Function FollowerFollow()

actor FollowerActor = FollowerAlias.GetActorRef() as Actor

FollowerActor.SetActorValue("WaitingForPlayer", 0)

SetObjectiveDisplayed(10, abdisplayed = false)

FollowerActor.EvaluatePackage()

EndFunction



Function DismissFollower(Int iMessage = 0, Int iSayLine = 1)

If FollowerAlias && FollowerAlias.GetActorReference().IsDead() == False

If iMessage == 0

FollowerDismissMessage.Show()

ElseIf iMessage == 1

FollowerDismissMessageWedding.Show()

ElseIf iMessage == 2

FollowerDismissMessageCompanions.Show()

ElseIf iMessage == 3

FollowerDismissMessageCompanionsMale.Show()

ElseIf iMessage == 4

FollowerDismissMessageCompanionsFemale.Show()

ElseIf iMessage == 5

FollowerDismissMessageWait.Show()

Else

FollowerDismissMessage.Show()

EndIf

actor DismissedFollowerActor = FollowerAlias.GetActorRef() as Actor

DismissedFollowerActor.StopCombatAlarm()

DismissedFollowerActor.AddToFaction(DismissedFollowerFaction)

DismissedFollowerActor.SetPlayerTeammate(false)

DismissedFollowerActor.RemoveFromFaction(CurrentHireling)

DismissedFollowerActor.SetActorValue("WaitingForPlayer", 0)

FollowerRecruited.SetValue(0)

HirelingRehireScript.DismissHireling(DismissedFollowerActor.GetActorBase())

If iSayLine == 1

iFollowerDismiss = 1

DismissedFollowerActor.EvaluatePackage()

Utility.Wait(2)

EndIf

FollowerAlias.Clear()

iFollowerDismiss = 0

EndIf

EndFunction




 

 

Link to comment
Share on other sites

I seem to recall Scriptname being the rare exception in Windows that is still case sensitive. So try with correct capital lettering.

Your fragment script should read:

Form BP = (GetOwningQuest() as _DOM_DominiqueController).BrowniePoint
ObjectReference DGC = (GetOwningQuest() as _DOM_DominiqueController).DomGiftChest
...

Also note that the type of BrowniePoint is MiscObject on your quest script but Form on your fragment. This is not necessarily a problem, but it is if you want to use functions that are specific to MiscObjects and not available to just a Form. I suggest to keep it consistent and use

MiscObject = (GetOwningQuest() as _DOM_DominiqueController).BrowniePoint

instead.

Edited by WhiteWolf424242
Link to comment
Share on other sites

However, the script is capitalized and everything in the code is also capitalized properly. Only the errors put it in lower case.

 

Also, the errors it throws me have nothing to do with the references and such, but all with the scripts/quests....

Link to comment
Share on other sites

Sometimes Papyrus doesn't like the nesting, so let us try a different approach:

Quest myQuest = GetOwningQuest() ;get the topic info's quest
_DOM_DominiqueController DOM_DC = myQuest as _DOM_DominiqueController ;cast the quest into the script
ObjectReference DGC = DOM_DC.DomGiftChest ;pull the property

Make sure the _DOM_DominiqueController.psc file is available for the compiler to locate.

Link to comment
Share on other sites

Alright, I give up. I'm just going to make new properties for every fragment.

 

This the the script compiles, but in-game the items won't be moved to the chest.

 

I declared a new property (in the add property button for the fragment) as HBMead, it's a honningbrew mead potion.

 

 

I then copied your code and put in my quest name so it looks like this:

 

 

 
Quest _DOM_DominiqueRecruitQuest = GetOwningQuest() ;get the topic info's quest
_DOM_DominiqueController DOM_DC = _DOM_DominiqueRecruitQuest   as _DOM_DominiqueController ;cast the quest into the script
ObjectReference DGC = DOM_DC.DomGiftChest ;pull the property
MiscObject BP = DOM_DC.BrowniePoint

DGC.AddItem(BP,1)
Game.GetPlayer().removeitem(HBMeadGift,1)
DGC.Additem(HBMeadGift,1)
 

 

So it's supposed to remove a mead from my player, add 1 mead to the chest, and add 1 brownie point to the chest.

 

It compiled, and the final form of the script (when I edit source) looks like this:

 

 

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 2
Scriptname _DOM_TIF__060DFDE9 Extends TopicInfo Hidden

;BEGIN FRAGMENT Fragment_1
Function Fragment_1(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
Quest _DOM_DominiqueRecruitQuest = GetOwningQuest() ;get the topic info's quest
_DOM_DominiqueController DOM_DC = _DOM_DominiqueRecruitQuest as _DOM_DominiqueController ;cast the quest into the script
ObjectReference DGC = DOM_DC.DomGiftChest ;pull the property
MiscObject BP = DOM_DC.BrowniePoint


DGC.AddItem(BP,1)
Game.GetPlayer().removeitem(HBMeadGift,1)
DGC.Additem(HBMeadGift,1)
;END CODE
EndFunction
;END FRAGMENT

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

Potion Property HBMeadGift Auto

 

 

 

The BrowniePoint and DomGiftChest properties were defined in the main script (in the scripts tab of my follower quest).

the HBMeadGift was declared in the properties of the script fragment.

 

The dialogue works in game, the mead is removed from the player, but nothing is added to the chest.

 

 

 

I really appreciate all your help, but the whole point of this workaround was to save time... But it's just costing me more time in the long run :/

 

I do feel like I am (slowly!) learning some things though, so I appreciate your help nonetheless! Thank you!

Link to comment
Share on other sites

If you are going to remove something from the player and put it into a container, you can condense it into a single line.

 

Valid code just change what you need for the situation:

PlayerRef.RemoveItem(myObject,Quantity,true,TargetContainer)

Are you testing on a new game? Some of these script changes might not reflect if the quest is already active in your save file.

Link to comment
Share on other sites

Yes and no... I have a new character set up standing right next to my follower before I recruit her.

 

The dialogue for gifts I have set up is at the same level as the "follow me" line, it's not necessary for her to be a follower to select it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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