Jump to content

Recommended Posts

Posted

I have had great help from IsharaMeridan and dylbill on my scripts, they work great now but I wonder if I am doing something naive in the parts I was not having trouble with; things that a newbie like me might not realise can be done differently to increase performance/ memory usage/ avoid persistemce etc.

 

My scripts are very simiilar top each other, here are the two more complicated ones:

 

 

  Reveal hidden contents

 

 

 

 

  Reveal hidden contents

 

 

The latter references a quest for an MCM menu, I can post that if useful.

This is not an urgent thing, my scripts are now working and this is just a thought about fine tuning.

 

diziet

Posted (edited)

You wrote: ".. my scripts are now working and this is just a thought about fine tuning."

I had a look inside and I doubt that any script version you posted here is really working as intend!

 

An activator (as Trigger) which has such kind of script attached will be triggered by every objectReference and actor (player included).

Every time an actor came across with the trigger your script variables could be changed unexpected.

 

Its always a good idea to keep the papyrus code inside events as small as possible. Its better to use functions instead for overview, maintenance and stack management.

 

dz_mcm_ver2_nakedactivator

  Reveal hidden contents

edited 20 March 2020

Edited by ReDragon2013
Posted
  On 3/18/2020 at 6:34 PM, ReDragon2013 said:

You wrote: ".. my scripts are now working and this is just a thought about fine tuning."

I had a look inside and I doubt that any script version you posted here is really working as intend!

 

An activator (as Trigger) which has such kind of script attached will be triggered by every objectReference and actor (player included).

Every time an actor came across with the trigger your script variables could be changed unexpected.

 

Its always a good idea to keep the papyrus code inside events as small as possible. Its better to use functions instead for overview, maintenance and stack management.

 

dz_mcm_ver2_nakedactivator

  Reveal hidden contents

 

To clarify then, putting most of the logic in functions outside of events is better for performance etc.?

I didn't know you could do:

player.GetEquippedArmorInSlot(i + 53)

this avoids one more variable, cwl.

 

Not sure what the comment means here or why you did this:) did you mean !disrobes ?

IF ( disrobes )

RETURN ; - STOP - threadLock active

ENDIF

 

As for scripts not working, good job I posted, I've got tens of patches on my mod page using them:)

Query...can non-actors trigger a triggerbox then? A flying bucket or something?

I had thought that only NPCs and the player would trigger the box, which is why I thought to check for if the the trigger was NPC or player but not otherwise.

 

This is also why I haven't got any check for magiceffect as you have, since I thought that checking for player versus NPC on leaving thevtrigger would be enough; as an NPC leaving the trigger would have to have entered the trigger and thus have the spell, also isn't it harmless to dispell a spell an NPC doesn't have? Is this an important thing to do? I'm assuming that the actual magic effect to put in the code would be the one used in the creation kit to make the spell?

 

This is interesting, I shall have to consider a full makeover of my scripts.

 

Thanks for responding

 

diziet

Posted (edited)

FAQ: "Query...can non-actors trigger a triggerbox then? A flying bucket or something?"

no idea.. whether a flying bucket could trigger a triggerbox or not.. its a flying object

but maybe a sword from death actor, an animated creature or something similiar could trigger

 

 

FAQ: "Not sure what the comment means here or why you did this:) did you mean !disrobes ?"

make sure you do not equip items and the player is (in this time) running again in the triggerbox, which would make the player unequip all items

 

 

FAQ: "isn't it harmless to dispell a spell an NPC doesn't have?"

That's the question.. better check before.

 

your code ;fill the first armour array

    Int slot1  = armor_1.length + 30
    Int index1 = armor_1.length

    WHILE (index1)
        index1 -= 1

        armor_1[index1] = PlayerRef.GetEquippedArmorInSlot(slot1)

        slot1 -= 1
    ENDWHILE

You wrote: "I didn't know you could do:"

    int i

    i = armor_1.Length
    WHILE (i)
        i = i - 1
        armor_1[i] = player.GetEquippedArmorInSlot(i + 31)
    ENDWHILE

FAQ: "To clarify then, putting most of the logic in functions outside of events is better for performance etc.?"

as I wrote already its better for maintaining, not really faster (because of stack swapping for the function overhead)

Edited by ReDragon2013
Posted
  Quote

 

AQ: "Not sure what the comment means here or why you did this:) did you mean !disrobes ?"

I was also referring to the 'threadlock' mention, don't know what threadlock is :):

  Quote

 

IF ( disrobes )

RETURN ; - STOP - threadLock active

ENDIF

 

Anyway, I've incorporated most of your ideas into a newer version of my script, undressing seems - subjectively - a little slower, but re-dressing is super fast from before, so thanks :)

 

diziet

Posted
  On 3/20/2020 at 4:47 AM, ReDragon2013 said:

Please have a look to my last post I changed the script code a bit.. for better runtime and added "shout" equip

Ah, didn't notice the edit there, I don't th9nk the shout is not necessary for my particular patch mod since i'm concerned about the physical appearance of NPCs and the player in baths/pools etc. but it's a useful thing to have anyway.

And I've worked out what you mean by:

 

IF ( disrobes )
    RETURN    ; - STOP -    threadLock active, do not make player naked more than once at same time
ENDIF
;---------------------
    disrobes = TRUE            ; *T*

 

It's a typo:) For 'disrobes' read 'disrobed' ! Then of course if it is already true: IF ( disrobes ) yes? Then exit the function, else set the variable and carry on right?

And in the trigger leave function at the end set the 'disrobed' to false.

 

I admit that I can't see how in practice a player could trigger the entering of a box a second time without leaving, but I see the efficacy in planning for it anyway, because computers. :)

 

This has been very interesting and again, thankyou.

 

diziet

Posted
  On 3/20/2020 at 5:50 AM, dylbill said:

Hey, the fastest way to get equipped items on an actor would be to use Papyrus Extender: https://www.nexusmods.com/skyrimspecialedition/mods/22854 which has:

Form[] function AddAllEquippedItemsToArray(Actor akActor)

I'll look this up, I don't want to ask users to download extra dependencies if the functionality can already be there, but a check to see if it is already there and using it seems a good idea if it will help performance etc. ?

 

diziet

Posted

You don't need to add them as "extra dependencies", you just include in your mod (in their corresponding folders) the "scripts - pex - psc" and the "po3_papyrusextender.dll" in the skse plugins folder.

That's all...

  • Recently Browsing   0 members

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