Jump to content

[LE] How to use spell (or crouch activate) to set object reference for script?


corrado33

Recommended Posts

I've seen a few mods that used a spell to set the "target" of the script.

 

Mainly the "dynamic auto sort" mod. Basically you cast a spell at a forge or something then that forge can access all of the items in all of the mod's chests.

 

I want to know how that worked. How can I use a spell to mark a chest as "special" and then refer to that "special" chest in a script?

Or better yet, how can I do that in GAME in ANYWAY. Whether by putting something in the chest, or by crouch activating it, etc.

Link to comment
Share on other sites

If you're just wanting to take over a container then the easiest non-SKSE solution is to give the player some special item that can be placed in container of the player's choice. They you just put a script on that item and use the OnContainerChanged event to record the container as the item is placed into it.

 

If you're using SKSE then you can use a simple scripted magic effect and the GetCurrentCrosshairRef function.

 

You can override the default activate action using a Perk with conditions on player state (like sneaking, actively casting a certain spell, etc.) and type of thing being activated (container) to run a small script fragment.

 

There are also ways to use projectile spells that then try to locate the nearest container after the projectile stops. But setting up those spells and the scripts required is somewhat complicated.

 

I would say that the first three of those are all equally easy. The only real reason for using that projectile spell method is if you wanted the player to be able to select some type of object that can't normally be activated (and even then the Perk method might still be a possibility).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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