Working Slaves mod Modmakers Guide ------------------------------ Written in the year: 2023 motnh: 07 day: 23 For version: V2.0 Realise 6 By NonSeen ------------------------------ Porpuse of this guide: ------------------------------ Give informations for mod makers, very advanced users, how they can interact with my mod, add extension to it or change own mod to suport this one. If you looking make only minior change to my mod you wish to look for advanced user guide not this one. Reader expected to udnerstand porpuse of the module, knwolage how to use Creation kit, Xedit or Skyrim Special Edition Edtior (SSE Edit ) ------------------------------ How to use this guide: ------------------------------ to navigate faster i this guide i suggest make use tableof contents and search function. evry chapter name made uniqe with a simbol of this : ! so if you use search function for this simbol or the string it self you find what for looking for quick ------------------------------ Table of contents: ------------------------------ !Making new workplace !Making a new Classic workplace: !Chest limitations !How make location workplace frendly !Ways to interact my mod by scripts !Detailed informations about addons !how to make new addon ------------------------------ !Making new workplace: ------------------------------ Workplaces and wokrplace functions linked to quests. If you make a copy of a exiting wokrplace quest you make a new workplace in general. Problm is this laone not enught to my system to able to make us of the new workplace, and wokrplace has some special data linked to it that need changed. Let see what need to done exactly for a new normal non classic workplace! 1 - Quest ID, name need to be changed to be uniqe so user can direntiate betwen quests 2 - in scripts: WS Workplace Script: Fallowing propertys need to be changed for a new form list: --WSNPCList -here the system sotre the disabled npcs --ProductList -here system sotre the curent production order, this items get produced on production run if all of this set up with a new empty form list wokrplace ready! Final step is, add this quest to the: WSWorkplaceQSTList This list contain all possible workplace quest that can be used. we not done yet! you need read the fallowing chapter and make new production and sample chests: !Chest limitations in sort: make copy of procution and storage chest can be found in WScell i suggest make copy of the interior cell named: WSCell name it to make uniqe to you and make sure enught chest in it to cover your wokrplace number 1 workplace need covered: 1 production and 1 storage chest! ------------------------------ !Making a new Classic workplace: ------------------------------ Classic workplaces are the system that ment for users who not like interact to mutch with my player menu and wish know littile to the sytem. Just wish plug and play. I add in future very few classic wokrplaces becuse this is not dinamyc as user made workpalces, may activate as part of normal game play and take out resources that going to be wasted if this workplaces not in use. For this reasons i suggest only if you have very good reason make new classic workplace, if you sure player going to use it. Easyest route to make copy of a exiting classic workplace, and change things that told in Making new workplace chapter. Bit harder if you change a normal workplace to classic one here is what need to do this case: in Quest aliases: -LocationAli: location alias need to be changed fill the none variable with the location where your classic wokrplace active -Storagechest need changed: Set: Location Alias Reference, Ref type need to set: WSProductionStorage Remove all conditions from condtions! in scripts: Do all what told in making new wokrplace chapter. then change the classicmode value = true in form lists: you need fill the workplace production list with items becuse player not able to fill it. As player has no acces to sample chest in classic mode. in pratice i suggest add only 4 items here. After finished making a new workplace quest, and setting up its forms. time to add the classic workplace quest to the classic workplace form list. namely: WSListClassicQuest Then adding the location of the classic workplace location list: WSListClassicLocation it is very important this list need in order! so if a workplace in classicquests located in the 3th place, the location and global linked to this quest need the 3th place all list! if you fail to that you make a big mess and lot of errors. After all of this done need make a new global variable named like this: WSClassic Set value: 0 this varible used as a flag if set 1 means workplace in use. the new global variable need to be added: "WSListClassicGlobals" formlist now we ready to make a new change location event endpoint in character/sn event node/Change Location event Here locate the WorkingSlavesLocationNode, then inside ClassicModeLocation, here you need add new quest node then the quest. Simply copy a existing working slaves classic quest node conditions to the new one and change the global to the new one you made. Then change the GetLocationCleared: location to the workplace location what you made. Well we not done yet, you need prepare the workplace! All you need known writen down in the "!How make location workplace frendly" chapter ------------------------------ !Chest limitations ------------------------------ This need a littile explanation so be with me. Working Slaves uses chest to store products and samples for productions. i added a special cell called WScell where lot of this chest can be found. This chest used as fall back option. When the system make a new workplace the system attemt to locate localy placed workplace production and storage chests. if none detected, then call a special quest that search for avible Production and Storage chests. This quest provide this data to player used spells that places production and storage chests. As menitioned before this is the fall back option. Primary expected source of these chest the wokrplace location. Any container objectreference, can be used as sotrage or production chest. Just need to be flaged as LocationReference type: WSProductionStorage WSSampleStorage All of this means we have a hard limitation problem: All normal wokrplace quest need a pair of chest to be ready in wscell location. if you add lot of new wokrplace quest i suggest make own cell, add to wscelllocation. this way your mod going to work fine with other mods that may make use my mod, and all of your workplaces get suplied with production chests. ------------------------------ !How make location workplace frendly ------------------------------ My mod as new workplace made attempt detect production and sample chests in the loaded area if new wokrplace made by player. if Classic workplace activated the system run checs for entire location where the workplace is linked. Classic workplaces need to find in the linked workplace location 1 production chest to able fully function! if this not happen you are in world of truble. To make a location workpalce frendly i suggest fallow this guild lines: -place a production and sample chest near the first interior entrance right side so players easy time to find it. -add both production and sample chest a revelant Location reference type: WSProductionStorage WSSampleStorage doing this you mark this chest to findeble by workplaces and useble -mark this object disabled, my mod enable them as they needed any way. other possible rute: you can mark any exiting chest to storage chest or sample chest by adding the apratiate location reference type to it. i suggest this containers set no respawning! Problem with this aproch: if workplace get disabled the production and sample chest get disabled to! So mark chest sample and production reference that its okay to get disabled/moved around. ------------------------------ !Ways to interact my mod by scripts - General owerview ------------------------------ I suggest use the fallowing script to link up with my mod: WSCorescript WSCoreCode ;this line can be placed here but not ideal... Bool Function LinkUpWithWorkingSlaves() if (Game.GetModByName("WorkingSlaves.esp") != 255) ;check my mod is in the load order Quest WSCore = Game.GetFormFromFile(0x000D67, "WorkingSlaves.esp") As Quest ;load the ws core quest if wscore == none Debug.Notification("Failed to load Working Slaves Core Quest!") Debug.Trace("Located the WorkingSlaves mod but failed to load the WSCore Quest!") return( false ) endif WSCorescript WSCoreCode = ( WSCore as WSCorescript ) Debug.Trace("Link up complite!") ;place here what you wish to do return( True ) ;linked up with wscore so ready to use, and done things that need to done endif return( false ) EndFunction Functions that made for external usage: Impoortant: All of the function made the way that accept a actor as input and based on actor curent location script do what need done. feeding in location is a alternative way most cases to specify where need to do the things. After the list of things i show some example! 1.add slave to specific workplace Int Function ExternalAddSlave( actor akActor, location akLocation = none ) ;add slave to the specified workplace of akLocation OR if akLocation is none then add to workplace where akActor in the time of calling. ;/Return values are: 1 = actor added to the location -1 = unknown error -2 = no actor recived -3= failed to locate a location -4= no active workplace in the input location -5= workplace is failed to add slave /; 2.rem,ove a specific slave from a workplace Int Function ExternalRemoveSlave( actor akActor, location akLocation = none ) ;remove a working slave from a specified workplace of akLocation OR if akLocation is none then add to workplace where akActor in the time of calling. ;/Return values are: 1 = actor removed from the location -1 = unknown error -2 = no actor recived -3= failed to locate a location -4= no active workplace in the input location -5= workplace is failed to add slave /; 3.make a new workplace a specific location, or a actor postion Int Function ExternalMakeWorkplace( actor akActor=none, location akLocation = none ) ;make a new workplace the specifed location or recived actor location ;/Return values are: 1 = workplace made on the requested location -1 = unknown error -2 = failed to recive any input -3 = no location found in recived data -4 = location is invalid for workplace to make. -5 = no avible workplace found -6 = failed to start reason unknown /; 4. remove a specfic workplace from location or based on a actor curent locations Int Function ExternalRemoveWorkplace( actor akActor=none, location akLocation = none,Quest akQuest=none ) ;remove a active workplace, defined by a actor position, a location or the workplace quest it self ;/Return values are: 1 = workplace removal started! -1 = unknown error -2 = failed to recive any input -3 = no location found in recived data -4 = location is invalid, no workplace found here! /; 5.Detect a workplace based on any given input: actor, objectreference, location any of them accepted Quest Function ExternalGetWorkplace( actor akActor=none, Location akLocation=none, objectreference akObjectReference=none ) ;/ Return values are: none - no wokrplace found the passed location quest - a workplace qwuest that active in this location /; 6. Order production run executed a workplace of you choice. The script capable lookate the workplace based on location, actor, objecreterence. But the script work faster if a workplace quest given. int Function ExternalRunProduction( actor akActor=none, Location akLocation=none, quest akQuest=none, objectreference akObjectReference=none ) ;execute a production run on selected workplace, the workplace selected based on inputs ;/Return values: 1 - Started the production run, production vent well -1 = unknown error -2 = failed to recive any input -3 = no location found in recived data -4 = location is invalid, no workplace found here! -5 = Production run started, but for some reason failed to produce any item /; 7. Forces a standard non classic workplace to use the input form list as production list. in other words: sample chest functions not in use, instead a form list that feed in as "AkListToForce" useful if you wish a specific workplace use a specific form list. just place a tigger in the location where player going to go trought and call this script on player ref or the local workplace. int Function ExternalForceProductionUseList( FormList AkListToForce, WSWorkplaceScript akWSCode=none, actor akActor=none, Location akLocation=none, quest akQuest=none, objectreference akObjectReference=none ) ;use a form list to produce items in the selected workpalce ;/Return values: if operation is a succes return how many item added to the production list -1 = failed to locate workplace /; 8.Another way to manipulate slaver production form outside witout player interaction! This one make possible to randomize the slavers local production. Added bonus this one accept leveled item list if placed to the formlist that feed in. int Function ExternalForceRandomizedProduction( FormList akRandomFormList, WSWorkplaceScript akWSCode=none, actor akActor=none, Location akLocation=none, quest akQuest=none, objectreference akObjectReference=none ) ;the workplace forced to use randomized production based on the passed in akrandomformlist, if none formlist added the randimzed production mode on the workplace get stoped ;/Return values: if operation is a succes return how many item added to the production list 1 = evrything good -1 = Failed to locate any workplace in the location check the logs! /; Examples: i assume you use: wscorescript wscorecode wscode.ExternalAddSlave( newSlave ) adds new slave to the workplace where is the moment new slave standing. if no workplace here error come back. ( errorcode -4 ) wscode.ExternalMakeWorkplace( playerref ) make a new workplace if possible where is the player curently standing, if possible. ------------------------------ !Detailed informations about addons ------------------------------ Addons is a mini framework like things i implemented during working on Realise 3. Porpuse of this system to make possible add modules to working slaves, start sad modules witout any link of scripts. In other words: start a module that contain possibly lot of scripts, using script. but the starter script not depended on the started script. Add to this requirement: not only the starter script not know what script going to be started but not even what object containg sad script. First my system need detect a module is avible or not. This archived using global variables. i made 3 global variables for this porpuse: WsAddonSlot0 WsAddonSlot1 WsAddonSlot2 all default value set 0. This value oweritten by the addons when addon added the load order. The system going to know what addon installed based on what global changed. First global ( WS Addon Slot 0 ) assigned to Sex Modul Secund global ( WS Addon Slot 1 ) assigned to Quest Modul Third global ( WS Addon Slot 1 ) assigned the custum moduls, that may other mod makers make. From this point in things going to be confusingly complex i try write down simple english for this reason. So in theory you can assign any value to any global to let the system know a addon is installed. But this value get used to tigger modul start! Here is how things works: After the system detect one of the global values different than 0 the player get option to use addon menu. Here can select any addon, if a addon is active (value bigger than 0) the system take that value and send out with the keyword: WSAddonStartKeyword - Value 1 Then the SN event node, script event recive the keyword and procces itt. Evry Addon slot has own uniqe value so the system going to know what modul slot chosen by player! Then the SN event node system start the linked quest or quest... becuse one keyword can start multiple quests! or in our case multiple addon modul. To look more deep this option you need go in creation kit: SM Event Node, Script Event, Stacked Branch Node: WorkingSlavesNode, Stacked Branch node: AddonStartBranch Here you can see 3 sub branch: AddonSlot00BranchNode AddonSlot01BranchNode AddonSlot02BranchNode if you look closer all require different event value. to more precise: Get Event Value, Value 1 == for Addonslot00 this value is 1 for addonslot01 this value is 2 for addonslot02 this value is 3 This means if your modul addon need to be started as player chose sex modul you need owerite WSAddonSlot0 Global Variable with 1 This tell the system sex modul installed, so player can click that option, and as player do your mod going to recive a Script event. For more information about this type of event i suggest look for creation kit wiki. search for this: SendStoryEvent to make things more easy as i tested out the system i made a dummy test addon modul this uploaded as: WorkingSlaves-Addon-TestModul-R0 if you extract the bsa you going to find out the source files and can study the whole system in the working. i added lot of free to use quest node under all addon slot. i done this to make space other modmakers to use this slot to add own quests. during testing turn out if two mod add own new quest node and quest to the branch their going to owerite each other. but if all get own separate spot no owerite done. &&About stoping modules: Starting a module is one thing but as you might noticed my mod made a away that all part need to be stoped from central command or one by one. This functionality true for addon modules too! i made a keyword for this porpuse: WSStopAddonKeyword and assigned for this keyword a separate branch: "AddonStopALLBranch" All quest under this recive the keyword genereted event. This quests made to stop the module they part of. This way from one keyword can be used to stop all active modules! Its important to SN event node all sett sahare event! in the last realise version i not done that so watch it! ------------------------------ !how to make new addon ------------------------------ i suggest download and analyze the falowing file: WorkingSlaves-Addon-TestModul-R0 inside the bsa i packed all the source code. other information how the keyword and scipt event works can be found in creation kit. look for fallowing things: SendStoryEvent OnStoryScript(Keyword akKeyword, Location akLocation, ObjectReference akRef1, ObjectReference akRef2, Int aiValue1, Int aiValue2) in sort how to make new modul to my mod: make a copy of the Test Modul and start change the menu part, add new quests and things you need to. This way i made the sex modul and this way i going to make the quest modul addon i planning to make. i give out few other pointers here: you need change the fallowing global variable default value to 3: WsAddonSlot2 This let know the working slaves player menu a active mod ready in the custum mods. you need to add the menu quest of your modul to the sn event node, script event,WorkingSlavesNode, addonstartbranch, AddonSlot02BranchNode: here look for a non used quest node, that no other modmaker made use of and add here yout menu quest dont forget your stopall quest add to AddonStopAllBranchTo! or you can make your own branch node just copy the conditions you see here, and make sure "shares event" option is on ( ticked )! This is very important!