Jump to content

[LE] Quick Questions, Quick Answers


Recommended Posts

 

Found it:

 

https://forums.nexusmods.com/index.php?/topic/6041698-papyrus-refreshing-merchant-inventory/page-3&do=findComment&comment=54144758

scriptname SB_SkoomaCycler extends ReferenceAlias

FormList Property SB_Skooma Auto

Event OnInit()
    RegisterForSingleUpdateGameTime(48)
EndEvent

Event OnUpdateGameTime()
    RegisterForSingleUpdateGameTime(48)
    RemoveSkooma()
    AddSkooma()
EndEvent

Function AddSkooma()
    ObjectReference myRef = GetRef()
    Clear()
    ForceRefTo(myRef)
EndFunction

Function RemoveSkooma()
    GetRef().RemoveItem(SB_Skooma, 10000)
EndFunction

There's some shortcuts taken in this implementation because it was only being requested for one, specific, set of mod-created items. It can be extended to arbitrary items with some work, though it requires horsing around and/or SKSE to do so.

 

Awesome. So to implement a script like this, I would need to create a form list with anything I want removed from the chest, right? Basically a form list with all the items I added to the inventory of the Reference Alias. And then just swap out the SB_Skooma form list for my new form list (at the very least, just change this out in the script properties). No need to specify what items I want added to the container, since re-applying the reference alias already does that.

 

 

That's correct. If the items you're adding to the chest exist only with your mod, you can just throw everything your mod adds into it and have things work out.

Edited by foamyesque
Link to comment
Share on other sites

 

 

That's correct. If the items you're adding to the chest exist only with your mod, you can just throw everything your mod adds into it and have things work out.

 

Well, I want to add different sets of items to different vendors, so I'll need a few form lists to go with the corresponding reference aliases. But yes, all of the items I'll be adding to those reference aliases will be mod-added, so it should keep things simpler than if I was also including vanilla items that could already be in the vendor's inventory.

 

Thanks again for your very helpful comments.

Edited by candlepin
Link to comment
Share on other sites

 

 

 

That's correct. If the items you're adding to the chest exist only with your mod, you can just throw everything your mod adds into it and have things work out.

 

Well, I want to add different sets of items to different vendors, so I'll need a few form lists to go with the corresponding reference aliases. But yes, all of the items I'll be adding to those reference aliases will be mod-added, so it should keep things simpler than if I was also including vanilla items that could already be in the vendor's inventory.

 

Thanks again for your very helpful comments.

 

 

If they're all mod-added, you can just dump everything into one formlist regardless of what subset you're adding to a vendor, and use that. Calling RemoveItem for items that aren't there won't cause any problems. Saves you setting up multiple formlists.

Link to comment
Share on other sites

 

 

If they're all mod-added, you can just dump everything into one formlist regardless of what subset you're adding to a vendor, and use that. Calling RemoveItem for items that aren't there won't cause any problems. Saves you setting up multiple formlists.

 

Even better. Thanks again for the assistance!

Link to comment
Share on other sites

Why the hell isn't this working!! I did it before my HDD self destructed but now I can't recreate the effect. I just want to place an explosion centred on the PC via a script.

FF, Self. The explosion is also filled in the visual effect but I don't think that matters.

Scriptname AceScriptPlaceExplosion extends ActiveMagicEffect  

Explosion Property VampirismExplosion Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)

;tried both of these

	;ObjectReference ExplosionRef = akCaster.PlaceAtMe(VampirismExplosion, 1, false, false)
        akCaster.PlaceAtMe(VampirismExplosion)


EndEvent


The property is filled.

Link to comment
Share on other sites

My experience is that only a limited few of the explosion objects (the ones with prefixes "Explosion" as far as I remember) actually work when placed via PlaceAtMe. I have no idea why, but it has been pretty consistent on my PC. If your VampirismExplosion isn't one of those, try looking into it and see if there's any differences between the explosions with and without that prefix.

Link to comment
Share on other sites

My experience is that only a limited few of the explosion objects (the ones with prefixes "Explosion" as far as I remember) actually work when placed via PlaceAtMe. I have no idea why, but it has been pretty consistent on my PC. If your VampirismExplosion isn't one of those, try looking into it and see if there's any differences between the explosions with and without that prefix.

You mean in the naming of the explosion? Yeah, explosion is in the name and I'm using my own meshes but I've also tried changing the mesh with other possibilities.

Link to comment
Share on other sites

 

My experience is that only a limited few of the explosion objects (the ones with prefixes "Explosion" as far as I remember) actually work when placed via PlaceAtMe. I have no idea why, but it has been pretty consistent on my PC. If your VampirismExplosion isn't one of those, try looking into it and see if there's any differences between the explosions with and without that prefix.

You mean in the naming of the explosion? Yeah, explosion is in the name and I'm using my own meshes but I've also tried changing the mesh with other possibilities.

 

Yep, in Explosion as a prefix in the naming -- not that the actual name matters at all, but there seems to be a difference in how the vanilla explosions with and without this prefix works when using PlaceAtMe, so I'd guess there's some setting somewhere in either the CK or in the nif file itself that generally differs between those with and without the Explosion prefix. Try looking into it.

 

But first, let's figure out if this is even relevant to your specific issue. Try, for instance, changing your explosion property to point at one of the vanilla explosions with this prefix and see if it works in-game.

Link to comment
Share on other sites

 

 

My experience is that only a limited few of the explosion objects (the ones with prefixes "Explosion" as far as I remember) actually work when placed via PlaceAtMe. I have no idea why, but it has been pretty consistent on my PC. If your VampirismExplosion isn't one of those, try looking into it and see if there's any differences between the explosions with and without that prefix.

You mean in the naming of the explosion? Yeah, explosion is in the name and I'm using my own meshes but I've also tried changing the mesh with other possibilities.

 

Yep, in Explosion as a prefix in the naming -- not that the actual name matters at all, but there seems to be a difference in how the vanilla explosions with and without this prefix works when using PlaceAtMe, so I'd guess there's some setting somewhere in either the CK or in the nif file itself that generally differs between those with and without the Explosion prefix. Try looking into it.

 

But first, let's figure out if this is even relevant to your specific issue. Try, for instance, changing your explosion property to point at one of the vanilla explosions with this prefix and see if it works in-game.

 

Brilliant feature. Thanks for the help.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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