Jump to content

Implementation Question


pepperman35

Recommended Posts

For my Institute-themed mod I have an automated quartermaster station set up. From this terminal you can do a number of things like requisition beds for the settlement, recruit bio-scientists and botanists, etc. The mechanics seems to work perfectly; however, I desire a select group of the botanists to tend to the crops. I have linked the crops and npcs to the workshop and the npc has the workshopnpc script. Question: How do get the npc to tend the crops? In other words, what link type and keyword is required? I thought I had this figured out before I took a break from the game but not so. Probably real simple solution but the ole neurons are letting me see it.

Link to comment
Share on other sites

You would want to use idle markers. If you want a good example, look at Graygarden, there are placed idle markers for each mutfruit tree. You just have to find the right idle marker for the action you want.

 

Edit: Yeah, I am an idiot. I was forgot that the reason Graygarden uses idle markers is because those aren't actual settlers, and the crops aren't actually harvested. If you want the crops to actually be harvested, don't use idle markers, use what SKK50 said to actually assign a settler.

Link to comment
Share on other sites

Do you want the NPCs to "interact" with the "player-placeable" crops in settlements?

 

That would not work with IdleMarkers, because the player can put the crops everywhere they want in a settlement ....

 

If you want them to "tend" crops that you have placed somewhere specifically, idle markers will work...

Edited by YouDoNotKnowMyName
Link to comment
Share on other sites

If the actors have WorkshopNPCScript so they can be assigned to a workshop, and the objects are resource producing WorkshopObjectScript objects with WorkshopWorkObject keyword assigned to a workshop with WorkshopItemKeyword, then its a stright workshop script function;

Quest Property pWorkshopParent Auto Const Mandatory 

Function AssignActorToWorkObject()

Actor ThisActor ; a WorkshopNPCScript actor if they are not assigned to the workshop ThisObject is in they are automatically assigned.

ObjectReference ThisObject ; a WorkshopObjectScript object that has WorkshopWorkObject keyword

If (ThisObject != None) && (ThisObject is WorkshopObjectScript) && ((ThisObject as WorkshopObjectScript).IsActorAssigned() == FALSE)
   (pWorkshopParent as WorkshopParentScript).AssignActorToObjectPUBLIC((ThisActor as WorkshopNPCScript), (ThisObject as WorkshopObjectScript), bResetMode = false) 
EndIf

EndFunction

EDIT: or you can let the workshop assign actors to free WorkshopWorkObject (s) with;

ActorValue Property pWorkshopGuardPreference Auto Const Mandatory  

ThisActor.SetValue(pWorkshopGuardPreference, 0.0) ; not guard so farm
(pWorkshopParent as WorkshopParentScript).TryToAutoAssignActor((ThisWorkshop as WorkshopScript), (ThisActor as WorkshopNPCScript))

Although as it is not a PUBLIC function you may want to check for editlocks on that script if you care about quality UX.

While (pWorkshopParent as WorkshopParentScript).IsEditLocked())
   Utility.Wait(1.0) ;although his now locks your calling script !
EndWhile 
Link to comment
Share on other sites

 

If the actors have WorkshopNPCScript so they can be assigned to a workshop, and the objects are resource producing WorkshopObjectScript objects with WorkshopWorkObject keyword assigned to a workshop with WorkshopItemKeyword, then its a stright workshop script function;

Quest Property pWorkshopParent Auto Const Mandatory 

Function AssignActorToWorkObject()

Actor ThisActor ; a WorkshopNPCScript actor if they are not assigned to the workshop ThisObject is in they are automatically assigned.

ObjectReference ThisObject ; a WorkshopObjectScript object that has WorkshopWorkObject keyword

If (ThisObject != None) && (ThisObject is WorkshopObjectScript) && ((ThisObject as WorkshopObjectScript).IsActorAssigned() == FALSE)
   (pWorkshopParent as WorkshopParentScript).AssignActorToObjectPUBLIC((ThisActor as WorkshopNPCScript), (ThisObject as WorkshopObjectScript), bResetMode = false) 
EndIf

EndFunction

EDIT: or you can let the workshop assign actors to free WorkshopWorkObject (s) with;

ActorValue Property pWorkshopGuardPreference Auto Const Mandatory  

ThisActor.SetValue(pWorkshopGuardPreference, 0.0) ; not guard so farm
(pWorkshopParent as WorkshopParentScript).TryToAutoAssignActor((ThisWorkshop as WorkshopScript), (ThisActor as WorkshopNPCScript))

Although as it is not a PUBLIC function you may want to check for editlocks on that script if you care about quality UX.

While (pWorkshopParent as WorkshopParentScript).IsEditLocked())
   Utility.Wait(1.0) ;although his now locks your calling script !
EndWhile 

Okay, I am stuck in implementing the first script. Noob questions: How do I point the script to the multifruit and the NPC. How do I call (use) the function? I really need a Papyrus scripting for dummies.

Link to comment
Share on other sites

You want to dynamically assign the NPC and the plant to the script?

Properties are how you do this normally (assign this specific NPC to this specific plant), but I don't know how to do it dynamically.

 

Maybe add a perk to the player that gives another activation option when the player is looking at the plant in the settlement?

 

I don't know how to dynamically assign properties ....

 

Maybe the god of dynamic scripting stuff, SKK50, can help ...

Link to comment
Share on other sites

This is a far more basic "how do I pick any actor and target in the game" question.

 

There are so many possible answers from crap to awesome it needs the context of your creation design and the states of the possible actors and targets.

 

So, start with that and describe the possible pool of actors, the possible pool of targets and your software's knowledge of or relationship to them.

 

If your answer is just "settlers" and "plants" I really can't help you.

Link to comment
Share on other sites

This is a far more basic "how do I pick any actor and target in the game" question.

 

There are so many possible answers from crap to awesome it needs the context of your creation design and the states of the possible actors and targets.

 

So, start with that and describe the possible pool of actors, the possible pool of targets and your software's knowledge of or relationship to them.

 

If your answer is just "settlers" and "plants" I really can't help you.

Okay, let's see if I can clarify this.
Design Context:
NPCs. I have six NPCs (Institute Botanists) that I will spawn into the greenhouse section of the settlement via a quartermaster terminal: 00_InstituteScientistMaleBioScience01, 00_InstituteScientistMaleBioScience02, 00_InstituteScientistMaleBioScience03, 00_InstituteScientistFemaleBioScience01, 00_InstituteScientistFemaleBioScience02, and 00_InstituteScientistFemaleBioScience03. Each NPC is link to an enable marker to facilitate spawning them into the greenhouse. Each NPC is also linked to the workshop with the WorkShopItem keyword. All NPCs have the workshopnpcscript. Each workshopnpcscript has assignMultiResource selected with Food selected as the object.
Objects. Inside the greenhouse I have 20 vanilla GreenHsPlanter01Mutfruit planters. Each planter is linked to the workshop with the WorkShopItem keyword. Each planter has the workshopobject script. Keywords and actor values for the vanilla GreenHsPlanter01Mutfruit haven’t been changed.
Design Expectations: I have hoped that each NPC would farm three of the respective planters each, with each NPC therefore producing/harvesting 6 food. Total food harvest would be 36. I thought assignMultiResource within the workshopnpcscript would have allowed this to happen. Currently, the NPCs spawn in just fine, and will sandbox within the greenhouse using the farming related markers in the greenhouse (hoeing, weeding, etc) but I get zero food production. Hence the help request.
Edited by pepperman35
Link to comment
Share on other sites

assignMultiResource is not somethjing you should set, as it does nothing. It is set by the WorkshopScript to flag that an actor HAS BEEN assigned to a mult resource like crops or guard posts, not scavenging stations or whatever.

 

The way you try to suggest they should be farmers during auto assign is setting actor value WorkshopGuardPreference to zero. But, auto assign only happens if you use the actual WorkshopParentScript function CreateActorPUBLIC() otherwise you need to do the work yourself, which is this.

 

 

HOW ARE YOU SPAWNING OR INSTANTIATING THE ACTORS ? Are you calling script function like ObjectReference ThisActor = PlaceActorAtMe(blah blah), or something else ?

 

IS THERE ANYTHING UNIQUE ABOUT THE OBJECTS ? Do you apply a keyword or actor value you can use to identify them as yours or the ones you are interested in ?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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