Jump to content
  • entries
    62
  • comments
    118
  • views
    8222

Yet Another rewrite, this time the scripts that effect 80-95% of the content


Nonseen

328 views

TLDR: I need rewrite and organize roughtly 10% of the scripts i already made, this scripts effect 80-95% of content the mod directly. This going to take few weaks. Leasson learned: dont make scripts that represent object and uise that script evry where. Going to end bead.

 

The Story:

 

To understand my story we need goo to Slavers of Skyrim mood general architecture.

 

The mod has a SLOS Core Script. this is the momy script for all of the children. Only momy stores propertys that not specificly belong to a script. You need a form list? go to momy! Need a weapon base object? Go to momy! Momy other function to spawn own childrens: basicly evry single quest that represents slaver bases, slaver traders or keep things running started by the momy!

 

Momy has some assistants to help keep things running, we not going to talk about this assistant today... we talk about its most important childrens:

The Quests that represent the slaver bases, the slave traders, and the quests that control player and player follower capture. From player point of view all of them Very important!

 

The architecture around this childs very simple: evry one is a twin! this is look very very nice! Need only one time code the stuff and can be used million times! At least this is the theory.

This childrens not simple scripts nope! Evry children more like a onion! Ther is a base script that common ammong all children we talking about.

 

Lets call this children script its name:  SLOS Quest Script

This one has 2 important functions: know how to reach momy and write report about events that happening...

 

First child of SLOS Quest Script a very important one: Slave Storage! as its named this one keep track evry slave that added to the quest. Plus do other things like give new captured salves amulet, make them counted as slave... so very important functionality.

 

The child of Slave Storage the Slaver base script: this one give the family ability to present it self as slaver base! Keep track things like where is the base, where need to place the newly captured slaves... seeams inportant stuff.

 

Here our littile family tree got broken lot of direction: if the quest used as salver guild base, a differend end script come as child of slaver base, other casses wandering slave trader come who has no real slaver base but need one to able handle the slave amulet removal so that to child of slaver base.

 

the next very important child of slaver base the capture quest script. this one give very basic capture functionalitys for important special guests like player and player follower... but nothing specific.

 

special things like how to handle follower capture stored on the child of Capture script: the capture follower script.

this one make possible remove follower from active followers, or kill the follower if player fail to rescue in time.

 

child of the follower capture quest is the actual capture follower script that control the exact events of follower capture.

 

in player capture quests case same as follower capture quests case: the child of capture quest script is capture player script, that control the basic functions of player capture.

then that child is the actual player capture quest.

 

this is the family tree i dealing with this moment inside my slavers of skyrim mod. I know looks impressive! :D

The theory is if i need add let say a new type of special npc capture like: evil slavers capture player wifu... i make it the child of capture quest script. add a new script like capture wifu script then a script that in pratice run the wifu capture quest.

 

so far evrything worked right and good!

Until not!

 

The problem:

i needed change how capture procces happen.

if you look the above writing easy to spot Slave storage is the place where need change things.

here is the capture stuff happens.

well i did it.

 

and worked well but i realised a problem: this change important roughtly 3-10% of the captures that salves made. To filter out this 3-10% i need run checks on 100% of the captures.

this is not optimal. and not okay.

for one thing to be handled 90-97 other suffer too.

Solution? make a new separate script function for that 3% -10% cases when capture happen where most easy dicide what need called call the right type of capture script and job done.

well in papaer its easy to do but...

 

when capture happens its happen on a magic effect script that script expected run instant fast runing when fighting take place!

that script around 400-600 lines already... but okay.

secund problem:

when capture happens the captured actor need teleported away. Where to teleport is depend on what slaver base has free space to store captured slaves( this information stored on slave storage ). Where to send slave stored on slaver base.

 

So here is how its works this: the capture quest orders the slaver base to make new salve a slave and move away the slave. Slaver base after reciving order order the slave storage to store the slave, if no space in slave storage... slave cannot be taken away, Need look another slaver base...

so if all go well slaver base recive conformation from slave storage: i stored the slave! then slaver base teleport away the slave, and report the succes to capture script.

 

this same thing run down when player or follower got captured.

or anything basicly....

okay player case in the new version a different rute taken so the slaver amulet can be removed any normal way.

 

but to make this change i needed change the script that effected the follower capture as both run trought the capture quest.

all of this confusing and sound messy?

yes it is!

 

imagine finding bugs here....

or making any changes.

 

i built this thing in the hopes this way i need make less code and more easy to implement changes that effect evrything at once. make my mod less heavy waight and more compatible with other mods.

 

turned out yestoday its a dead end. the mod in my estimate around 5-9% complite script system wise. i mean this: near 10% of the framework for scripting systems are built.

i expect need make lot of changes but as this mess growing bigger and bigger.... this not okay.

 

the momy going to stay untuched as its do own job well: provide data to children as they need, and make them running when needed.

the assistants going stay too... but evrything else... this mess need to go.

 

Design wise my new design idea is this:

instead make lot of things depend on each other i make them flat.

evry single functionality need own script that script do only that functionalty and nothing more.

this way if i need x functionality i place the script that can provide exactly that one.

if i need a functionality that very close to existing one but not excactly that one... i not going change the existing one! Nope! make a new one for that exact use case.

this way i hope avoiding to making this messy system i have the moment.

added benifit if i need z new functionality i not need change anything that exiting and providing different functionality.

 

At least this is whay i hope for!

0 Comments


Recommended Comments

There are no comments to display.

×
×
  • Create New...