Jump to content

Setting a Location as automatically "cleared" for workshop


Recommended Posts

Hey all,

 

I'm making a mod that involves putting a workshop in a cave, so you can create a base underground. What I would normally do is just use the interior workshop, but since I want the player to be able to build a little I've opted to use the regular one. The problem with this is, when trying to use the workshop I am given the immediate popup "you must clear all enemies from the location" even though the cell is void of any living things. I know there is script work to make it so the cell itself is set as clear, but I have no idea how to do that. Can anybody help?

 

EDIT: I followed what Lisselli said, here's another way of showing their example

 

Scriptname ClearLocationScript extends ObjectReference

Location Property myLocation Auto


AUTO STATE WaitingForPlayer
Event OnCellAttach()
; This will fire when the player enters the cell.
; Note: It will NOT fire if the player is already in the cell on game load.
; The Player will need to leave the cell first and then come back, if so.

GoToState("Done")
myLocation.SetCleared()
EndEvent
ENDSTATE

STATE
Done
Event OnCellAttach()
; empty event. Will not run anymore.
EndEvent
ENDSTATE

 

 

So just fill in "myLocation" with your location, and you're good to go

Edited by nikashubaiton
Link to comment
Share on other sites

There's a lot of ways to do this.

 

The most easiest way is to put an xmarker in the cell containing the workshop and attach this script to it:

 

 

Scriptname LocationClearedScript extends ObjectReference

Location property LocationToClear auto

AUTO STATE Waiting
    Event OnCellAttach()
        GoToState("Done")
        LocationToClear.SetCleared()
    EndEvent
ENDSTATE

STATE Done
    Event OnCellAttach()
    ;
    EndEvent
ENDSTATE

 

What this will do is set the location to clear, and then run no more after that.

 

Fill the property with the location you want.

Link to comment
Share on other sites

double click the workshop in the render window, or right click in the cell view window on the workshop and click edit.

 

scroll to last tab, scripts, double click the script, set the following (don't use defaults):

 

  • OwnedByPlayer = true
  • StartsHostile = False
  • EnableAutomaticPlayerOwnership = True
  • MinRecruitmentProhibitRandom = true
  • MinRecruitmentAllowRandomAfterPlayerOwned = False
  • AllowAttacksBeforeOwned = False
  • AllowAttacks = False (if this is a player home and not a settlement, if settlement, set to true for random attacks)

that should automatically make it so the player can use the workbench.

 

You'll probably also want to set AllowBrahminRecuritment = False so you don't end up with brahmin running around inside your cave.

 

Another step you can do is add a workshopSetOwnedTrigger, it doesn't need to be big, just place it right where the player teleports in to the cell at and linkref it to the workshop, this will ensure that for any reason the workshop gets flipped to not player owned even with the above flags set, that the workbench will get set to player owned as soon as they enter the cell.

 

don't forget to setup your workshop quest too.

 

if you haven't:

  • create a new quest and give it a unique name, something like mymodSettlementQuest
  • on the Quest Data tab, check Start game enabled, run once, set priority to 41
  • on the quest stage tab on the right hand side, right click and click new, type in 10, right click again and click new, type in 20
  • click on 10, check the box that says Run on Start
  • right click in Log Entry and click new, add a Designer note that says 'quest start'
  • click on 20, right click in log entry and click new, add a designer note that says 'quest end'
  • click the 'Quest Aliases' tab
  • right click and click new Ref Alias Collection
  • set the alias name to 'Workshops'
  • add a match condition - haskeyword workshopkeyword
  • add a match condition - locationhaskeyword loctypeworkshop
  • add a match condition - getincurrnetlocation - the location assigned to your cell
  • click okay
  • Click okay again, then open the quest back up and click on Scripts
  • add the script WorkshopAddLocation
  • if properties didn't pop up, double click the script
  • click autofill in properties and it should autofill the workshopParent
  • click on workshopCollection, click edit, and set it to Workshops

The location assigned to your cell will need a couple keywords added to it:

  • loctypeclearable
  • loctypesettlement
  • loctypeworkshop
  • loctypeworkshopsettlement

your zone for the location will need to have never reset and workshop checked on it.

 

you'll need a centermarker for the workshop and a spawnmarker (bothxmarkers) you linkref from the workshop to them using workshoplinkcenter for the center marker and workshoplinkspawn for the spawn marrker, bother markers should be xmarkerheadings

 

If you want the people you send to the cave / settlers to wander about the cave you'll need to add a defaultdummy and linkref the workshop to it with the keyword workshopsandbox then size it for where you want them to wander about, this can also come in handy say if you have a room on the outer edge of the area you don't wnat the settlers to enter, as they will only wander the sandbox area.

 

the buildable area is a defaultdummy linkref it to the workbench using the keyword workshoplinkprimative, you can have multiples of these linked to the workshop to cover odd shaped areas, and scale them to fit the area..

 

Hope the info helps.

Edited by caleb68
Link to comment
Share on other sites

doesnt a setowned trigger do the same thing ?

 

In my new locaction mods where i have to setup settlement data as apposed to a vanilla location i never use the "initialization "quest method since i use the setowned trigger instead and everything works fine.

Edited by greekrage
Link to comment
Share on other sites

@Caleb and Greek recent replies:

It's really just preference or out of habit at this point, same as how some people use the Atomatron version of the quest as an example.

 

Though I will concede that some poeple seem to just have better luck doing it one way or the other (or the other (or the other)) for whatever reasons.

 

Case in point: I still do it the same way (other than a few specific changes made for certain situations, like inmediatly on map or type of settlers) I've been doing it for a year or so now and have had very few issues (at least I hope I don't...least no one reports them, heh).

...then again, most of what I do is highly separated from most things that might cause issues (relative location to other settlements, conflicts of other builders, settler changes, etc), so maybe I'm not the best example. =P

Link to comment
Share on other sites

so for the top script, I'm not actually sure how to add it as I've never done one before. In the scripts section I clicked add and then new, is that the section? Sorry for all the basic questions

Edit: I'm trying now for the default clear location script, am I getting closer?

Edited by nikashubaiton
Link to comment
Share on other sites

I added it to the default clear location script, that didn't work, I'll just wait until someone gets back to me so I don't f*** it up lmao

 

Additionally, you're talking to a guy with literally NO SCRIPTING EXPERIENCE AT ALL so if you can simplify it I would really appreciate it

Edited by nikashubaiton
Link to comment
Share on other sites

  • Recently Browsing   0 members

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