Jump to content

Selecting an NPC


Recommended Posts

Edit:

 

Since in SkyrimVR it is not possible to target NPCs in order to select them for different mod MCM menus, this small mods adds a spell - "Select NPC" that lets you do that.

 

Select NPC for MCM.7z

 

Includes patches for :


- Extensible Follower Framework v4-0-5
- SOS Full
- Lazy Tools AIO
- Lazy Heels
- SL or FG Aroused
- SLIF
- Manipulator
- LazyBikiniArmor

 

Also works with the SL VR patch, thanks to reikiri for implementing support in the patch.

 

 

If there are other mods that would benefit from this please let me know. And please provide links to the mods in order to prevent confusion.

 

 

Files for patching  Nether's Follower Framework v2.6.7 (warning, this is now an older version)

 

SelectNPCforNethers2.6.7.7z

 

 

Below is the original post:

------------------------------------------------------------------------

 

I wonder if somebody has found out how to select a NPC.

In the flat game you can target NPCs and select them for use in MCM. For example with SOS to change the schlong of the NPC.

Now that PapyrusUtil  is ported to VR The Manipulator seems to work, but it requires selecting a NPC in order to add them to the harem or do something else with them. But I can't find a way to do it. 

Link to comment
11 hours ago, CPU said:

The only safe way in VR to select a NPC is to use a dialogue.

And this is not always possible. And not supported by many mods.

I looked at some possibilities to overcome this problem so the mods can be patched. I guess "OnCrosshairRefChange" doesn't trigger in SkyrimVR and we need some other way of selecting an actor. I'm thinking about a spell, because having a dialogue option will only add more clutter.

I'm going to try this with Manipulator. Create a new spell "Select NPC" that triggers a custom event and replace the OnCrosshairRefChange in the Manipulator config script with a listener for the custom event. Or is there a better way to do this?

Link to comment

A spell of type Fire and forget (not hostile) should work.

Of course it should be done as patch for the mods.

It should be possible also to patch multiple mods at the same time.

Have the spell to fill an Actor property in a quest with a global getter.

Then provide patched psc and pex for the mods using the crosshairref. There get the quest from its global and then put the actor from the property inside the variable used by the mod.

In this way you can provide patches for mods also if the mods are not installed.

 

If you need help creating the global getter for the quest I can help. 

Link to comment

So create a stand-alone mod that has the spell and a quest that will have an alias with a reference to the last selected actor. Then create patches that would replace OnCrosshairRefChange with getting that reference.

So far so good.

As far as I understand I can't simply broadcast a custom event, I need it tied to an object. And the reference in the quest in this case is the object. It would send a custom event to the patches so they update their references to the selected actor.

 

Alternatively instead of sending an event the mods can update the selected actor on OnConfigOpen which is probably the better solution.

 

So in the spell I get the target of the active magic effect and use "ForceRefTo" in order to assign it to the alias. Is this correct?

 

 

Link to comment

Be aware that to do a seamless patch to a script of another mod, you are not allowed to change the properties of the original script. Or you will need to edit also the esp of the mod.

While, using the reference to the global quest directly will not require to alter the properties, and you can use the "actor" from its property any time the getCurrentCrossHairRef is called.

Link to comment

OK, now I understand what you mean by global. I guess it will depend on how different mods have implemented the selection.

In the case of Manipulator the actor property is defined as "default" in the ESP and then the script defines it as none. Then the crosshairref listener (event handler) triggers and fills the property. In this case it should be OK to simply comment out that, create OnConfigOpen function and assign the reference from the quest alias.

Will also see how SOS is doing it before I start. Will experiment with this tonight and tomorrow. Thanks for your help!

 

Link to comment

	Scriptname nySelectingQuest extends Quest
	 
	Actor Property selectedActor
	 
	nySelectingQuest Function getInstance() global
	    return Game.getFormFromFile(0x123456, "MySelectActorVR.esp") ; be sure to put the ID of the quest and the name of the mod
	endFunction
	

 

	Scriptname selectActorMagicEffect extend activemagiceffect
	 
	funciton OnEffectStart(Actor caster, actor target)
	    nySelectingQuest.getInstance().selectedActor = target
	endFunction
	

 

Here an example (that should work) for the two script you need. One has to be put in a Quest, the other as the script associated to the MagicEffect of the spell you will create.

 

In side the other mods, when you have the crossHarRef actor used (not set, used) just replace the value to something like:

 

theActor = nySelectingQuest.getInstance().selectedActor

 

Recompile the PSC and you can provide a patch to the mod by just providing the PEX and PSC, no need to alter the mod. And, n case the modded mod is not installed, the PEX file will just be ignored.

Link to comment

I got stuck on the quest script:

Scriptname NSMQuestScript extends Quest  

Actor Property NSMActor auto

 NSMQuest Function getInstance() global
    return Game.getFormFromFile(0x000D62, "NPCSelectForMCM.esp") 
endFunction

Returns "cannot return a form from getinstance, the types do not match (cast missing or types unrelated)". The ID of the quest is NSMQuest.

I tried different values for the return type but got the same error. I don't understand what response type are we declaring this way.

 

Link to comment

My bad. I forgot to cast it.

 

return Game.getFormFromFile(0x000D62, "NPCSelectForMCM.esp") as NSMQuestScript

Be aware your function should return the auet script and not the quest. (NSMQuestScript Function getINstance() global)

Link to comment
13 hours ago, CPU said:

[....]

It works ?

 

I'll upload a test version of the mod in the OP in this thread. SOS seems to work completely, so there will be a patch for it in the archive.

Recompiling the config of Manipulator was quite a journey, I had to download the sources for Racemenu and UIExtentions because I didn't want to cut out the functionality in case they become available in VR at some point. It generally works, but sending people to the harem doesn't. I'll debug some more in the next few days so for now there will be no patch for it.

 

 

What was confusing for me was casting as a specific script instance.  In my mind casting is done to a type of a thing (int, float, object... or actor, faction...) and not to a thing (specific number or Ulfric specifically) so I'm trying to understand how casting the quest script fits. I did try to add to the return line "as Quest" and "as ObjectReference". Now looking at it I should have guesses that the return has to be casted to the same thing the function is specified to return.  But it is good to know that you can get access to a thing by casting it's form to it's ID. Sorry for the many things in the last sentences, hope it makes some sense.

Link to comment

In Papyrus the "casting" works in different ways.

 

If you are using basic objects (int, float, string) then there is an actual conversion of the object.

If you are using objects (everything else is an object) then the cast will just change the inheritance of the object. Remember that all objects come from "Form" (OK, ActiveMagicEffect does not, but supports most of Form methods thru SKSE.)

A script is actually a specification to an object. You cannot have (in Skyrim) scripts instances disconnected from objects (you can in other Beth games.)

 

So, if your script extends a quest, you have all Quest methods and properties. And because Quest extends Form, you get all Form methods and properties too.

Link to comment
8 hours ago, babbo21 said:

i guess my computer is treating the link as malware. this has never happened before...

Do you understand how serious is to accuse somebody of spreading malware? And that people will be affraid to download the mod because of what you imply here? So is it or is it not?

Link to comment
7 hours ago, babbo21 said:

I didn't mean to accuse. My Avast antivirus is very aggressive. I'm gonna add an exception and try again. Thanks again for replying.

I'm not worried about an accusation as I know the file is OK. I'm worried that people will read it and will be afraid to download it. 

On an internet forum people don't know what you want to say, just what you do say. And you did say that this is happening for the first time, which means you exclude an aggressive antivirus and imply that there is something wrong with specifically this file.  Anyway, glad it is sorted out, just wanted to point how what you wrote can be read by other people.

Link to comment
15 hours ago, prinyo said:

I'm not worried about an accusation as I know the file is OK. I'm worried that people will read it and will be afraid to download it. 

On an internet forum people don't know what you want to say, just what you do say. And you did say that this is happening for the first time, which means you exclude an aggressive antivirus and imply that there is something wrong with specifically this file.  Anyway, glad it is sorted out, just wanted to point how what you wrote can be read by other people.

Thanks for your reply and concern. I was able to download the file and use it for SOS, but not for LazyBodyEdit or Heels. also the load order mattered. Having the Manipulator mod loaded before it caused CTD when pulling out the spell.

Link to comment
7 hours ago, babbo21 said:

I was able to download the file and use it for SOS, but not for LazyBodyEdit or Heels.

As the post says, currently this test upload patches only SOS. So it is expected at the moment it would work only with SOS.

I'm going to add patches for several other mods in the next few days when the holiday craziness dies down and I get some more "me time".

However as the post says, please suggest mods that need patching as I can't know about all possible mods that use NPC selection. At the moment my plans for mods to patch are FG Aroused and Manipulator. If you expect some other mod to be patched then you need to suggest it here (with a link to the mod).

 

Since at the moment this mod has nothing to do with Manipulator I don't see how it can lead to crashes related to it. In my own setup it is loaded after Manipulator. The load order shouldn't matter.  The install order does - as this mod patches other mods it needs to be installed after them.

 

Link to comment
8 hours ago, prinyo said:

As the post says, currently this test upload patches only SOS. So it is expected at the moment it would work only with SOS.

I'm going to add patches for several other mods in the next few days when the holiday craziness dies down and I get some more "me time".

However as the post says, please suggest mods that need patching as I can't know about all possible mods that use NPC selection. At the moment my plans for mods to patch are FG Aroused and Manipulator. If you expect some other mod to be patched then you need to suggest it here (with a link to the mod).

 

Since at the moment this mod has nothing to do with Manipulator I don't see how it can lead to crashes related to it. In my own setup it is loaded after Manipulator. The load order shouldn't matter.  The install order does - as this mod patches other mods it needs to be installed after them.

 

I see. I checked my load order and Select NPC is installed after Manipulator, like you said, and I get no crashes. Thanks for your work and Happy New Year! (in the US)

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