Jump to content

F4SE equivalent to GetCurrentCrossHairRef


Recommended Posts

There isn't much documentation on these two. (https://mod.gib.me/fallout4/functions.html)

PickNextRef (PNR)

Select the the next ref in the center of the screen outside the console

PickNextActor (PNA)
Select the the next actor in the center of the screen outside the console"
The LL FourPlay solution sounds more precise but I haven't tried it.
Link to comment
Share on other sites

I found that :

ObjectReference ref = ConsoleUtil.ExecuteFunction("pna")

wouldn't work but the following did:

Actor Function dz_get_crosshair_actor()
ConsoleUtil.ExecuteCommand("PickNextActor")
ObjectReference ref = ConsoleUtil.GetSelectedReference()
;ConsoleUtil.ExecuteCommand("PickRefByID")
debug.trace("DF4LT: ref is "+ref)
EndFunction

except for the line ObjectReference ref = ConsoleUtil.GetSelectedReference()

the papyrus.0.log shows '

DF4LT: ref is None'

I can see in the console that the selected actor has its details listed - which is why I had to comment out the PRID line!

the line:

ObjectReference ref = ConsoleUtil.GetSelectedReference()

is derived from consoleutil.psc - which I had to search for:)

 

So how to get the result of PickNextActor into a script variable?

 

diziet

edit: seems it may be a bug in consoleutil, on the mod page there is a bug report that some actors return None whereas others don't, in my testing I have found this also. Which still leaves me wtih my question:(

Link to comment
Share on other sites

I remembered that in one of my mods for Skyrim I used a spell to get the actor fro VR users, so I adpated that fro F4, but I can't seem to get the player to cast a spell. I read here:

https://forums.nexusmods.com/index.php?/topic/6081238-apply-magic-effect-to-actor-via-script/

that I'm supposed to call the spell's method instead of the object ref method.

But I don't know what that means:)

my spell:

Scriptname dz_get_crosshair_actor_effect_script Extends ActiveMagicEffect
;;;this script adapted from my Skyrim Auto Outfits mod;;;
dz_F4_little_things_quest_script Property scriptRef Auto        ;this line fills the scriptRef property with the script that has the actor property you wish to fill
;EffectShader Property AbsorbGreenFXS   Auto        ;green aura for later

Event OnEffectStart(Actor Target, Actor Caster)
debug.trace("DF4LT: crosshair actor spell effect started")
debug.trace("DF4LT: crosshair actor spell  target is "+target)
;AbsorbGreenFXS.Play(Target)               ;place green aura around the target
scriptRef.crosshair_actor = Target             ;this line fills the actor property in the script of your choice, edit the scriptRef property above to suit

EndEventEvent OnEffectFinish(Actor Target, Actor Caster)
debug.trace("DF4LT: crosshair actor spell effect finished")
;AbsorbGreenFXS.Stop(Target)
EndEvent

it is called from a quest script using an MCM hotkey:

Actor Function dz_get_crosshair_actor()
  debug.trace("DF4LT: casting crosshair actor spell...")
  dz_get_crosshair_actor_spell.Cast(PlayerRef As ObjectReference)          ;this is the spell that identifies the actor the spell is cast at, that spell fills the variable spell_npc
  Utility.Wait(0.2)
  debug.trace("DF4LT: crosshair_actor is "+crosshair_actor)
  Return crosshair_actor
EndFunction

I get the debug trace "DF4LT: casting crosshair actor spell..."

but not "DF4LT: crosshair actor spell effect started"

all properties are set in the F4 CK.

 

diziet

 

Link to comment
Share on other sites

Sorry for the confusion; the "prid" command should be executed only AFTER you've secured the ObjectReference (Using PickNextActor). PNA and PickNextActor are the exact same commands, PNA is just shorthand which the console will accept (tried and tested). But it seems glitchy anyway. It is certainly possible that either the console command or ConsoleUtil code has some bug or is inconsistent.

And yeah, ConsoleUtil didn't include his source papyrus file in the download for some reason. You found it, but for others who want it it can be found here:

https://github.com/clayne/ConsoleUtilF4

Link to comment
Share on other sites

  • Recently Browsing   0 members

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