Jump to content

About Event OnWorkshopMode()


Recommended Posts

How do I properly write OnWorkshopMode()

Event OnWorkshopMode(bool aStart)
Astart = True
If aStart == True
TheMarker = Self.PlaceAtNode("SpawnPoint2", SMFMarker, 1, TRUE, FALSE, FALSE, TRUE)
Self.setlinkedref (TheMarker, SMFKeyword2)
TheMarker.Setlinkedref(Self, SMFKeyword2)

Endif
EndEvent

Because this doesn't work. Even with our without Astart = True

Link to comment
Share on other sites

What are you attaching the script to ?

 

That native event is only received by the Workshop ObjectReference (and attached quest aliases) so any other script will need to registerForRemoteEvent.

Link to comment
Share on other sites

Okay I used it on a movable static that has the workshopobjectscript attached to it.

 

I want to place a dummy marker on a node, so the object has a visible marker when in workshop mode and otherwise not

Link to comment
Share on other sites

What I do for workshops is run a quest which loads the Workshops array into a RefCollectionAlias (referesh every OnPlayerLoad game to catch new DLC/MOD added workshops) and run an OnWorkshopMode() event trigger on that alias. A template:

 

 

 

ScriptName MyQuestScript Extends Quest 

Actor Property pPlayerREF Auto Const Mandatory
Quest   Property pWorkshopParent Auto Const Mandatory
RefCollectionAlias Property Alias_MyWorkshops Auto Const Mandatory

Event OnQuestInit()
   UpdateWorkshops()
EndEvent

Event Actor.OnPlayerLoadGame(Actor akSender)
   UpdateWorkshops()
EndEvent

Function UpdateWorkshops()
   Self.UnRegisterForRemoteEvent(pPlayerREF, "OnPlayerLoadGame")
   ObjectReference[] WorkshopList = (pWorkshopParent as WorkshopParentScript).Workshops as ObjectReference
   Alias_MyWorkshops.AddArray(WorkshopList)
   Self.RegisterForRemoteEvent(pPlayerREF, "OnPlayerLoadGame")
EndFunction

----------------------------------------------------

Scriptname MyWorkshopsAliasScript extends RefCollectionAlias

Event OnWorkshopMode(ObjectReference akSender, bool aStart)
	;Do stuff
EndEvent

 

 

 

You could also loop the WorkshopArray and registerforremoteevent your script for each new workshop but thats slower and less maintainable.

Link to comment
Share on other sites

I also might say to try, if it's just not doing 'anything', a short wait before attempting to place the marker...maybe?

 

I've definitely seen the event itself work (use it in a few different mods myself), so maybe it's either getting stuck timing wise or just not liking what you're trying to do within the event itself (through no faullt off your own, just 'Oof, Papyrus/Engine Freakout! =P ).

Link to comment
Share on other sites

Another approach might be to create a quest which is started by the Story Manager Event Node upon "Location Loaded" with Conditions that restrict the event location to a (optionally specific) workshop location.

 

SM Event Node >> Location Loaded >> New Stacked Quest Node. Add the Condition GetEventData to the quest node:

 

Parameter 1: HasKeyword

Parameter 2: Location

Parameter 3: LocTypeWorkshop

 

The quest needs to have a Location Alias (for the location sent by the story manager) and a Reference Alias (for the workshop reference of Location Alias).

 

Use additional alias (Fill Type) Conditions if you want to restrict the location or the workshop reference to specific locations or references, e.g., settlements only, Player Houses only, Sanctuary Hills, etc. And don't forget to uncheck the Run Once flag (Quest Data tab).

 

Quest template: MinRecruitLocationLoadedStub, SM Event Node template: MinRadiantLocationLoadedNode. Location Loaded is not listed on the Creation Kit wiki site.

 

Attach a script with OnWorkshopMode to the Reference Alias.

Edited by LarannKiar
Link to comment
Share on other sites

  • Recently Browsing   0 members

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