dizietemblesssma Posted July 26, 2022 Share Posted July 26, 2022 As the title, it seems that F4SE does not have the SKSE GetCurrentCrossHairRef function, is there a way to do this in F4? diziet Link to comment Share on other sites More sharing options...
RaidersClamoring Posted July 26, 2022 Share Posted July 26, 2022 By ways of ConsoleUtil you can do this. ConsoleUtil.ExecuteFunction("PNR") But as you may be aware, this console command can end up selecting stuff like mist or dust particles that happen to be in front of you. PNA is probably better (actor under your crosshairs).https://www.nexusmods.com/fallout4/mods/51951 Link to comment Share on other sites More sharing options...
DlinnyLag Posted July 26, 2022 Share Posted July 26, 2022 (edited) Take a look to LL FourPlay plugin (that is also included to AAF)It has LastCrossHairRef that seems similar to GetCurrentCrosshairRefBut I'm not sure that this function works exactly as SKSE's one Edited July 26, 2022 by DlinnyLag Link to comment Share on other sites More sharing options...
dizietemblesssma Posted July 26, 2022 Author Share Posted July 26, 2022 @DanielIllah2I'm unfamiliar with the console commands PNR or PNA and I can't find any reference to them, can you expand? @DlinnyLagThat might be useful, though I have to sign up to the sexmad people in order to get it:) diziet Link to comment Share on other sites More sharing options...
RaidersClamoring Posted July 27, 2022 Share Posted July 27, 2022 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 More sharing options...
RaidersClamoring Posted July 27, 2022 Share Posted July 27, 2022 Anyway, the correct sequence would beObjectReference ref = ConsoleUtil.ExecuteFunction("pna") ConsoleUtil.ExecuteFunction("prid") Because you also need to deselect asap Link to comment Share on other sites More sharing options...
dizietemblesssma Posted July 29, 2022 Author Share Posted July 29, 2022 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) EndFunctionexcept 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 More sharing options...
dizietemblesssma Posted July 29, 2022 Author Share Posted July 29, 2022 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) EndEventit 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 EndFunctionI 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 More sharing options...
dizietemblesssma Posted July 30, 2022 Author Share Posted July 30, 2022 For the record, the problem with the spell was the effect was 'aimed' which worked fine in SkyrimSE, here I had to change it to 'target actor'. diziet Link to comment Share on other sites More sharing options...
RaidersClamoring Posted July 31, 2022 Share Posted July 31, 2022 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 More sharing options...
Recommended Posts