dizietemblesssma Posted August 23, 2022 Share Posted August 23, 2022 here is a funciton called by an MCM hotkey: Function dz_essential_key() debug.trace("DF4LT: dz_essential_key called") ;is the key pressed the essential hotkey? debug.trace("DF4LT: key down, second press is "+secondpress) If secondpress == False && !Utility.IsInMenuMode() dz_essential_toggle() ElseIf secondpress == True dz_setessential() EndIf EndFunctionhere is the funcion dz_essential_toggle() called by that function: Function dz_essential_toggle() debug.trace("DF4LT: essential toggle called") ;Actor NPCRef = Game.GetCurrentCrosshairRef() as Actor ;the actor under the crosshair Actor NPCRef = dz_get_crosshair_actor() If !NPCRef debug.messagebox("There is no NPC under the crosshair") Return EndIf String actorname = NPCRef.GetDisplayName() ;the actor's name debug.trace("DF4LT: NPC is "+actorname) ess_bool = NPCRef.IsEssential() ;is the actor essential? Bool prot_bool = NPCRef.GetActorBase().IsProtected() ;is the actor protected? String ess_status ;message about essentual status String prot_status ;message about protected status If ess_bool == True ess_status = "essential" Else ess_status = "non-essential" EndIf If prot_bool == True prot_status = "protected" Else prot_status = "not protected" EndIf ;String msg = "$status_msg" String msg = "press the key again within five seconds to change the essential status." debug.messagebox(actorname+ " is "+ess_status+ "\n and "+prot_status+" \n"+msg) secondpress = True ;while this is true a second press is diverted to dz_setessential() function ;debug.notification("secondpress is "+secondpress) Utility.WaitMenumode(5.0) secondpress = False ;now that 5 seconds are up, a second press no longer runs the dz_setessential() function ;debug.notification("secondpress is "+secondpress) ; Int ActKey = Input.GetMappedKey("Activate") ; Input.TapKey(ActKey) ;Send 'Enter' to close messagebox ConsoleUtil.ExecuteCommand("HideMenu MessageBoxMenu") EndFunction here is the function dz_get_crosshair_actor(): Actor Function dz_get_crosshair_actor() debug.trace("DF4LT: casting crosshair actor spell...") dz_get_crosshair_actor_spell.Cast(PlayerRef) Utility.Wait(0.2) debug.trace("DF4LT: crosshair_actor is "+crosshair_actor) Return crosshair_actor EndFunctionhere is the magiceffect script for the spell dz_get_crosshair_actor_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 now here is my papyrus.log.0:[08/23/2022 - 09:40:52PM] DF4LT: dz_essential_key called[08/23/2022 - 09:40:52PM] DF4LT: key down, second press is False[08/23/2022 - 09:40:52PM] DF4LT: essential toggle called[08/23/2022 - 09:40:52PM] DF4LT: casting crosshair actor spell...[08/23/2022 - 09:40:52PM] DF4LT: crosshair_actor is None it can be seen that the debug trace messages from the key being pressed are there:[08/23/2022 - 09:40:52PM] DF4LT: dz_essential_key called[08/23/2022 - 09:40:52PM] DF4LT: key down, second press is False the debug trace messages from the dz_essential_toggle functin being called:[08/23/2022 - 09:40:52PM] DF4LT: essential toggle called and the debug trace messages from dz_get_crosshair_actor being called are there:[08/23/2022 - 09:40:52PM] DF4LT: casting crosshair actor spell...[08/23/2022 - 09:40:52PM] DF4LT: crosshair_actor is None yet there is no sign of the magiceffect itself actually starting e.g. "DF4LT: crosshair actor spell effect started"The magic effect is attached to the spell, properties are set in the ck and I can see no errors.This is all based on a setup I used in a Skyrim mod so I'm wondering if there is something very different about magic effects and spells F4? diziet Link to comment Share on other sites More sharing options...
hereami Posted August 23, 2022 Share Posted August 23, 2022 I didn't follow the logic, but have noticed this string EndEventEvent OnEffectFinish(Actor Target, Actor Caster), is that copypaste error? Though should cause compiler error probably. Link to comment Share on other sites More sharing options...
RaidersClamoring Posted August 24, 2022 Share Posted August 24, 2022 It could be that you're just setting things up differently than me with folders and whatnot but I tend to forget the namespace from time to time when creating a ScriptObject property. I'll write:TheScriptToAddress Property scrpt Auto But what I'll need is actually:ProjectFolderName:TheScriptToAddress Property scrpt Auto Could that be it? Link to comment Share on other sites More sharing options...
dizietemblesssma Posted August 24, 2022 Author Share Posted August 24, 2022 It is a copy/paste thing the "EndEventEvent" should read:EndEventEventthe first being part of the comment:) I'm not using namespaces as it all became too fiddly with notepad++ and ppj files. diziet Link to comment Share on other sites More sharing options...
DlinnyLag Posted August 25, 2022 Share Posted August 25, 2022 (edited) Lets assume you haven't made a silly mistake and didn't face errors in papyrus logs Use https://www.creationkit.com/fallout4/index.php?title=Magic_Effect as a reference for magic effect definingWhat is the Delivery value?Do you have any Target Conditions defined for magic effect? What are Effect Archetype and Casting Type?What flags are set? Use https://www.creationkit.com/fallout4/index.php?title=Spell as a reference for Spell definingWhat is the Type of spell?Do you have any Conditions for Magic Effect you added to the Spell? Edited August 25, 2022 by DlinnyLag Link to comment Share on other sites More sharing options...
Recommended Posts