Jump to content

Recommended Posts

He is right, anim replace should be renamed to AnimationEventReplace, because it allows to replace call of one event with another but not the actual animations. For example you could use it to replace move forward with eat bread, not very useful :P but I guess some mods could use it to restrict certain actions by player. I wanted to originally make it the way you described it, to allow change behavior through script, but knowing nothing about how animations work in engine and no one to explain I gave up.

Link to comment

He is right, anim replace should be renamed to AnimationEventReplace, because it allows to replace call of one event with another but not the actual animations. For example you could use it to replace move forward with eat bread, not very useful :P but I guess some mods could use it to restrict certain actions by player. I wanted to originally make it the way you described it, to allow change behavior through script, but knowing nothing about how animations work in engine and no one to explain I gave up.

 

It's an interesting idea. But I think if someone would start looking for possible reasonable uses he would only spent hours of running into bad results and unexplainable side-effects. Like those many users I have seen experimenting with SAE() to execute animations like carrypot or stagger, and then come to me to ask why AnimObjects are not unequipped, or why the "wrong" stagger is played. And I believe that exchanging animevents would only exponentiate these issues.

 

The only thing which probably works well is exchanging one loose idle by another. But that can usually be done with other means, including FNIS.

 

Like your example with move forward (actually movestart, which is movement in any direction) by eat bread. I don't want to test this, but I assume it will slide the player over the ground while performing the eating animation. And this will start again every time you press a forward key. Generally you can't restrict player movement with behaviors. This is always under the engine's control.

 

I didn't want to pick on your example. I just don't have any other to explain why I can't see reasonable use for it.

Link to comment

I don't know what SAE is. In my tests when I changed movestart with eating bread and then pressed W it just stood there and started to eat bread, not sliding or moving in any way. When jumping it stopped animation properly. Not saying it's bug free or should be used but it does replace call animation event in engine before any processing of it is done.

 

I don't know what the state of FNIS is now, I haven't modded or played in a long time but at the time when I made this it was not possible to change FNIS behavior or animations while game is running. This was the only reason to do any of this.

Link to comment

It really stops the move. Oh, I didn't expect that. This would indeed be a good use of this function. Something neither FNIS or any other function can do.

 

Sorry if I was somewhat dismissive about this feature. I just had too many inquiries recently about the unsuccessful use of SAE (SendAnimationEvent) in order to play specific animations..

Link to comment

It varies depending on the event that is getting replaced by the function, or the event replacing it. 

 

When I was testing the animation replace functions while re-writing the plugin, I tested it by replacing the forward movement event with the bard audience clap animation. For me pressing W started the clapping animation but the player still glided forward during the animation. I can't remember which event I replaced however, I don't think it was MoveStart in any case, so that may have been why.

Link to comment

I was going to ask that a notice be added to the documentation for the "RemoveAllPackageOverride" function to warn against using that function unless you are absolutely sure yours is the only mod which added an override package to an actor. Otherwise mods ought to track the overrides they add so they can be removed individually.

 

Then I thought, perhaps the function itself could be fixed to remove only the overrides added by the calling mod, leaving any overrides added by other mods intact and thus lessening the inevitable mod clash.

Link to comment

I was going to ask that a notice be added to the documentation for the "RemoveAllPackageOverride" function to warn against using that function unless you are absolutely sure yours is the only mod which added an override package to an actor. Otherwise mods ought to track the overrides they add so they can be removed individually.

 

Then I thought, perhaps the function itself could be fixed to remove only the overrides added by the calling mod, leaving any overrides added by other mods intact and thus lessening the inevitable mod clash.

 

 

It only removes the package it's given from the argument on all actors, not all packages on all actors. The function name is abit confusing. 

Link to comment

I'm working on cleaning up a lot of stuff again for the next release. I plan on removing the MiscUtil.GetNodeRotation() function for sure, considering it more or less only does half a job and I'm pretty sure nobody is using it, plus b3lisario's SkeletonUtils plugin has more or less replaced it.

 

I'd also like to remove MiscUtil.ReadFromFile(), MiscUtil.WriteToFile(), and MiscUtil.ExecuteBat() as well, as those functions as they are now are pretty major security risks, and securing them likely isn't worth the time as again, I don't think anybody is using them, but I am less sure of that compared to the GetNodeRotation().

 

If you happen to be running a mod using any of those 4 functions, or think they should be left in for whatever reason, speak now.

Link to comment

Is there a way to remove none references from formlists, short of clearing the list completely? I have an actor list that might end up with temporary actors, and looks like after those are removed from the game, they stay on the list. I have a detection in one place to see if a none item is encountered, but looks like the removal doesn't work in that case.

Link to comment

Is there a way to remove none references from formlists, short of clearing the list completely? I have an actor list that might end up with temporary actors, and looks like after those are removed from the game, they stay on the list. I have a detection in one place to see if a none item is encountered, but looks like the removal doesn't work in that case.

 

FormListRemove(obj, "key", none, true)

Link to comment

Yep, pretty much what I have:

Actor a = FormListGet(self, "list", n) as Actor
If a && !a.IsDead()
    ...
Else
    FormListRemove(self, "list", a, true)
EndIf

Then elsewhere without the checking I get bunch of

[11/04/2014 - 08:42:30PM] warning: Assigning None to a non-object variable named "::temp119"

with values gotten from the list even after that removal part has been run. I'll try if straight "none" works in the remove instead of the variable.

 

Hmm.. unless there's somehow a non-actor in that list, since that would be cast as none there as well. That shouldn't be possible though.

Link to comment
int i = StorageUtil.FormListCount(obj, "list")
while i
	i -= 1
	Form FormRef = StorageUtil.FormListGet(obj, "list", i)
	if !FormRef || FormRef.IsDisabled() || FormRef.GetType() != 62 || (FormRef as Actor).IsDead()
		StorageUtil.FormListRemoveAt(obj, "list", i)
	endIf
endWhile

Remove all none, disabled, non-actor, or dead actors.

Link to comment
  • 2 weeks later...

version 2.8 

 

I am having trouble with JsonUtil.FormListHas and JsonUtil.FormListFind returning false / -1 for an ObjectReference when its form ID is >= 0x80000000, e.g. more than 128 mods.

 

Ref = JsonUtil.FormListGet(FileName, ListName, Index) as ObjectReference
debug.trace(Ref +" "+ JsonUtil.FormListHas(FileName, ListName, Ref) +"|"+ JsonUtil.FormListFind(FileName, ListName, Ref)

 

works as expected as long as form ID of Ref is low enough.

Link to comment

version 2.8 

 

I am having trouble with JsonUtil.FormListHas and JsonUtil.FormListFind returning false / -1 for an ObjectReference when its form ID is >= 0x80000000, e.g. more than 128 mods.

 

Ref = JsonUtil.FormListGet(FileName, ListName, Index) as ObjectReference

debug.trace(Ref +" "+ JsonUtil.FormListHas(FileName, ListName, Ref) +"|"+ JsonUtil.FormListFind(FileName, ListName, Ref)

 

works as expected as long as form ID of Ref is low enough.

 

By works as expected, I assume that means the FormListGet() works correctly on the high order form, along with other FormList functions besides find and has? Can you show me the contents of the json file? Preferably with both a broken and working form stored in a form list.

 

 

EDIT:

Just tested it with a form from the 188th and 207th loaded mod, find and has both worked correctly with it. I tested using my current development version for 2.9, so it may be it was fixed accidentally somewhere along the way, though I can't think of anything that's changed that would've fix it.

 

I don't have time at the moment to do a test using the current 2.8 release, but heres the script I used for testing it, incase anybody wants to try replicating the bug. Just equip some armor from a high load order mod and run it.

 

 

 

Scriptname sslEffectDebug extends ActiveMagicEffect

event OnEffectStart(Actor TargetRef, Actor CasterRef)
	JsonUtil.FormListClear("FormTest", "TestList")

	int i = 30
	while i < 60
		Form WornForm = CasterRef.GetWornForm(Armor.GetMaskForSlot(i))
		JsonUtil.FormListAdd("FormTest", "TestList", WornForm)
		if WornForm
			Log(WornForm+" - "+WornForm.GetFormID())
		endIf
		i += 1
	endWhile

	i = JsonUtil.FormListCount("FormTest", "TestList")
	while i
		i -= 1
		Form FormRef = JsonUtil.FormListGet("FormTest", "TestList", i)
		if FormRef
			Log("["+i+"] "+FormRef+" - "+JsonUtil.FormListHas("FormTest", "TestList", FormRef)+"|"+JsonUtil.FormListFind("FormTest", "TestList", FormRef))
		endIf
	endWhile

	JsonUtil.Save("FormTest")
endEvent

function Log(string log)
	Debug.Trace(log)
	MiscUtil.PrintConsole(log)
endfunction

Debug log output:

 

[Armor < (0003C9FE)>] - 248318

[Armor < (0003CA00)>] - 248320
[Form < (C4018034)>] - -1006534604
[Form < (B1010AD6)>] - -1325331754
[28] [Form < (B1010AD6)>] - TRUE|28
[12] [Form < (C4018034)>] - TRUE|12
[7] [Armor < (0003CA00)>] - TRUE|7
[2] [Armor < (0003C9FE)>] - TRUE|2

The two negative numbers from GetFormID() are the high load order forms.

 

 

FormTest.json contents afterwards:

 

 

{
    "formList" : 
    {
        "testlist" : [ "0", "0", "64148|Ursine Armor Pack.esp", "0", "0", "0", "0", "248320|Skyrim.esm", "0", "0", "0", "0", "0", "0", "0", "0", "98319|PatchusMaximus.esp", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "64148|Ursine Armor Pack.esp" ]
    }
}

 

 

 

 

Link to comment
  • 3 weeks later...

I have troubles with ActorUtil.AddPackageOverride and ActorUtil.RemoveAllPackageOverride - it often CTD

 

What I am doing:

After I have entered an interior cell I iterate through all NPCs (type 43) and assign a DoNothing package to them via ActorUtil.AddPackageOverride.

Before I leave the cell I call ActorUtil.RemoveAllPackageOverride with this DoNothing package. And this leads often to a CTD.

 

What is wrong here - is there an alternative to keep all NPCs silent and force them to stop doing their business?

 

PS: The DoNothing package is a never ending infinity wait package.

Link to comment

Try instead of RemoveAllPackageOverride to keep an internal list of all NPC you add the package to and remove manually after by looping this NPC list, some people said it worked if I remember. Also make sure any package you add with these functions are custom packages from your plugin only.

Link to comment

the package problem is a known issue, it's already fixed in current development versions of PapyrusUtil 2.9, and has been for some time. More or less just waiting for some word on how long the wait for SKSE 1.7.2 will be.

Link to comment

And it seems there are also some troubles with storing / restoring formlists. My mod (WIP Maria Eden) crashes often during game load / save and if I disable formlists the crashes are gone. Also fixed in 2.9?

No formlist issues that I'm aware of currently. Post your Formlist scripts and PapyrusUtilDev.log from your root Skyrim directory directly after experiencing such a crash.

Link to comment

Crashes on save game

Code:

 

 

event OnInit()
	Trace("OnInit")
	clothes_key = new string[6]
	clothes_key[0] = "slave_clothes"
	clothes_key[1] = "succubus_clothes"
	clothes_key[2] = "whore_clothes"
	clothes_key[3] = "master_clothes"
	clothes_key[4] = "dancer_clothes"
	clothes_key[5] = "succubus_body"
	zbf = zbfUtil.GetMain()
	RegisterForSingleUpdate(3)
endevent

event OnUpdate()
	InitializeClothes()
endevent

function InitializeClothes()
	if JsonUtil.Load("maria")
		Form[] c = new Form[15]
		int i = clothes_key.Length
		while i
			i-=1
			Form[] clothes = GetClothes(i)
			ClearFormList(c)
			JsonUtil.FormListSlice("maria",clothes_key[i],c)
			CopyFormList(c,clothes)
			Trace("load " + clothes_key[i] + " size=" + GetFormListSize(clothes))
		endwhile
	endif
endfunction

function CopyFormList(Form[] from, Form[] to) global
	int f = from.Length
	int t = to.Length
	int i = 0
	if f < t
		i = f
	else
		i = t
	endif
	
	int x = 0
	while i
		i-=1
		if from[i] != none
			to[x] = from[i]
			x += 1
		endif
	endwhile
	t -= 1
	while x < t
		to[x] = none
		x += 1
	endwhile
endfunction

function ClearFormList(Form[] list) global
    int i = GetFormListSize(list)
    while i>0
      i-=1
      list[i] = none
    endwhile
endfunction

int function GetFormListSize(Form[] list) global
    int i = list.Find(none)
    if i<0
       return list.Length
    else
       return i
    endif
endfunction

 

 

 

The log

 

 

Loading
Storage Reverting...
Done!

Storage Loading...
DATA: 2905
Skyrim.esm
Update.esm
INTV Load
FLOV Load
STRV Load
- length: 36
FORV Load
INTL Load
FLOL Load
- length: 70
STRL Load
- length: 2221
FORL Load
- length: 31
PACK Load
Done!

Papyrus Loading File: ../../../Meshes/Cumshot/AdjustValues.json
Papyrus Loading File: maria.json
Papyrus Loading File: maria.json
Storage Saving...
Done!

Storage Reverting...
Done!

Storage Loading...
DATA: 2905
Skyrim.esm
Update.esm
INTV Load
- length: 511
FLOV Load
STRV Load
- length: 36
FORV Load
INTL Load
FLOL Load
- length: 70
STRL Load
- length: 2221
FORL Load
- length: 31
PACK Load
Done!

Papyrus Loading File: maria.json
Storage Saving...
Done!

 

 

GetClothes() returns a Form Array property (15 elements)

Link to comment

Crashes on save game

Code:

 

 

event OnInit()
	Trace("OnInit")
	clothes_key = new string[6]
	clothes_key[0] = "slave_clothes"
	clothes_key[1] = "succubus_clothes"
	clothes_key[2] = "whore_clothes"
	clothes_key[3] = "master_clothes"
	clothes_key[4] = "dancer_clothes"
	clothes_key[5] = "succubus_body"
	zbf = zbfUtil.GetMain()
	RegisterForSingleUpdate(3)
endevent

event OnUpdate()
	InitializeClothes()
endevent

function InitializeClothes()
	if JsonUtil.Load("maria")
		Form[] c = new Form[15]
		int i = clothes_key.Length
		while i
			i-=1
			Form[] clothes = GetClothes(i)
			ClearFormList(c)
			JsonUtil.FormListSlice("maria",clothes_key[i],c)
			CopyFormList(c,clothes)
			Trace("load " + clothes_key[i] + " size=" + GetFormListSize(clothes))
		endwhile
	endif
endfunction

function CopyFormList(Form[] from, Form[] to) global
	int f = from.Length
	int t = to.Length
	int i = 0
	if f < t
		i = f
	else
		i = t
	endif
	
	int x = 0
	while i
		i-=1
		if from[i] != none
			to[x] = from[i]
			x += 1
		endif
	endwhile
	t -= 1
	while x < t
		to[x] = none
		x += 1
	endwhile
endfunction

function ClearFormList(Form[] list) global
    int i = GetFormListSize(list)
    while i>0
      i-=1
      list[i] = none
    endwhile
endfunction

int function GetFormListSize(Form[] list) global
    int i = list.Find(none)
    if i<0
       return list.Length
    else
       return i
    endif
endfunction

 

 

 

The log

 

 

Loading

Storage Reverting...

Done!

 

Storage Loading...

DATA: 2905

Skyrim.esm

Update.esm

INTV Load

FLOV Load

STRV Load

- length: 36

FORV Load

INTL Load

FLOL Load

- length: 70

STRL Load

- length: 2221

FORL Load

- length: 31

PACK Load

Done!

 

Papyrus Loading File: ../../../Meshes/Cumshot/AdjustValues.json

Papyrus Loading File: maria.json

Papyrus Loading File: maria.json

Storage Saving...

Done!

 

Storage Reverting...

Done!

 

Storage Loading...

DATA: 2905

Skyrim.esm

Update.esm

INTV Load

- length: 511

FLOV Load

STRV Load

- length: 36

FORV Load

INTL Load

FLOL Load

- length: 70

STRL Load

- length: 2221

FORL Load

- length: 31

PACK Load

Done!

 

Papyrus Loading File: maria.json

Storage Saving...

Done!

 

 

 

GetClothes() returns a Form Array property (15 elements)

 

 

I've got an updated version of the plugin I've been getting ready for release in a day or two, just needs some minor cleanup and documentation written for all the new functions in PapyrusUtil.psc. Try it and and let me know if the problem continues while using it, or if any other problems happen as a result update. If the problem continues using this update, then post your /data/skse/plugins/storageutildata/maria.json file as well.

 

If anybody else reading this, are willing to help test this update, let me know your results so I can prepare it for release asap.

 

papyrusutilv30.BETA.zip

 

Changelog:

  • Fixed crash related to package override
  • Fixed some potential crashes related to loading/saving json files
  • Added many native array related utility functions to PapyrusUtil.psc
  • Changed the method of load order handling and formid updates between save/load serialization events.
  • Removed some insecure and uncommonly used functions such as GetNodeRotation, ExecuteBat, ReadFromFile, WriteToFile
  • Updated boost and jsoncpp libraries to latest versions
  • Switched compiler for plugin from VS2008 to VS2010
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use