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

SLOS Magic Capture Script rought history so far


Nonseen

358 views

This story starts early stage of devlopment...

 

When the basic architecture and how this mod going to work changed a lot... weakly some times dayli basis.

one thing known for sure:

 

Capture magic effect going to be used to capture player, player follower and npcs.

 

This magic effect need a script to control and execute the capture event, so i needed write the script: SLOSMagicCaptureEffectScript

 

This one at first is simple and done only few things: check the target is not dead, user of the effect is belong to SLOSTagCaptureFaction. This faction used to signal this actor can capture slaves.

 

if all checked out the system check who is the target:

-if target belong SLOSVictimFaction -normal npc that ment to be captured, normal npc capture executed.

-if target is a player or player follower, or hireing Capture Ready quest called if possible.

--this means attemting activate one of the 2 type quest: Capture player or Capture folllower.

 

in case normal npc capture happen well...

the system first look for the capturing npc orgin where its from.

if the home is a slaver base and it has free storage room for slaves... the victim sent here.

 

in case no free storage or not located the home, the system start search any base where free storage room can be found. then add here the slave.

 

this is the first generation.

 

Secund generation:

slave amulet introduced: all captured salve need to wear this....

the amulet come won script of corse, and whit it own bugs.

 

this fixed realtive quick...

 

Third generation:

player can join the slaver guild, so can capture slaves...

this case player action need to rewarded with guild trust incrase.

 

so right now the script need decide the attacker is player or not, valid to capture slave or not.

and if player capturing other valid npcs what to do.

 

Sortly after this introduced added another function:

if player own a slaver base, and slaver base has free storage space the new slave need to be sent here.

 

this script version has lot of problems.

to solve that i written the new generation

 

Forth Generation:

this is after the big rewrite of most of the code that provided the slaver bases functionality and turned out not ideal.

 

this time i revritten the script near from 0 to something.

the script this time activated when the target hit by the magic effect!

 

Take in mind: so far ALL other check done by the condition system, outside of any papyrus scripting! like checking the target heath.

this new script evry 0.01 secund run a check on target heath, if target heath go below the 50% maximum the system start the capture procces.

 

this script has many problems like the capture effect teleportation not worked as intended, when i added more time before capture run trought the script broke.

it seams when i use OnUpdate event, and inside the OnUpdate event run a function that use: utility.Wait the script go broken.

probably becuse the wait time in my case: 0,5 secund.... same time multiple onupdate need to proccesed...

 

this tuned out a dead end too.

the script this time tryed do too many things.

 

Fifth generation ( the curent one ) :

 

another rewrite done.

This  time i keept the heath check inside the script. this proven MORE realible when i kept the heath check on conditions.

so the script not even started if target hp above the limit!

 

Removed the target need ot be memebr of SLOSVictimFaction requirement.

 

Basicly what i done is this:

the script now checks the caster is the player or not, if its the player checks the player belong any of the fallowing 2 factions:

SLOSTagCaptureFaction

SLOSPlayerClaimLocationFaction

 

the first one given to player when player join slaver guild.

secund one given to player when player take owenership of a location... this one is VERY intresting becuse make possible to capture slavers not only victims!

 

Then if deterimanted what type of capture need to be used the script cast a spell on target.

This is big.

Here is why:

The curent script NOT need to know anything about what the spell going to do or how its works, or the script that inside the spell what does.

This is very important for compatibility and extending the system! Let me explain:

 

i have Script A that do things, and i have another mod that has Sciprt B that do own things.

Let say i want to ask Script B to do its things one of my actor i hold in Script A.

 

To do this directly i need some how call from Script A to Script B and let know script B hey do your things with my actor!

This can be done and all good. Problem is: with this action Script A become dependent on Script B existance.

to call script B inside Script A, my Script A need to know Script B and let say implement to it.

 

This create dependency that may create later times problems.

Using cast spell is one good way to avoid this dependency here is how:

 

i write a script that work on a magic effect. When the spell casted on a actor the script on spell effect going to Call Script B.

i add this spell to Script A, and order it to cast on the actor.

Script A depending this case a Spell NOT a script.

 

Now i can make the spell on SlaversOfSkyrim.esp

the script A exist on SLOS-Script-Core, and make use the spell.

Script B can exist on let say SLOS-Extension-1 and owerite the spell.

 

what you see here is the way that Script A and Script B not know each other directly NOT depend on each other directly but they can work together.

 

bouty of this in future might some need use Script C that activate instead of Script B. this case just need make a new esp that owerite the same spell and now Script A instead call Script B going to call Script C.

 

this archived witout changing the original script A.

this means if one time a script A written and tested NOT NEED test agin evry time something on the other end changed.

 

back to our fifth generation capture script:

 

the script right now determiante what need to do, and cast the pre determianted spell on target. that spell do own things.

This seams work fine, at least on my tests.

 

The secund and third generation has around 450-500 line code.

All code in single event: when the spell casted run.

it seams to my the papyrus system not like the loong complex functions or other codes.

 

This script engine more optimalized for realtive sort littile functions. simple code pices that call each other when needed.

 

Whati learned from all of this:

1 - each future and function need to get own separate code

2 - each future and function need to get own separate VARIABLES, this include factions ( exaple: captuing actors early linked only one faction now linked 2 faction )

3 - event proccesing scripts ideal if sort and can run very quick

4 - Condition system for heath check on combat not ideal on magic effects, lets to this inside the script

5 - a script that dicide what sub script need to be called more effective thant a script that not only dicide what need to do but can do all the variant it self

( this broke the realization 1 on it self by the way, as one script do lot of things instead one! )

0 Comments


Recommended Comments

There are no comments to display.

×
×
  • Create New...