Asterra Posted March 17, 2020 Share Posted March 17, 2020 IsWeaponOut doesn't work, because the function only counts when the weapon is fully out, and returns 0 if it's in the process of being drawn or holstered. GetAnimAction doesn't work, because it changes when the animations begin and end, which simply does not correspond at all to when the weapon actually hits the actor's hand. In Skyrim, I believe I could get this done through the use of HasNode, but I see no equivalent here. Maybe, however, there is some sort of way I can take advantage of what is available to render a usable result. Sadly, the frame-by-frame accuracy of this event is important, so I can't fudge it with approximations. Link to comment Share on other sites More sharing options...
Mktavish Posted March 18, 2020 Share Posted March 18, 2020 There is ... https://geckwiki.com/index.php?title=GetEquippedAnd you will see a few more at the bottom of it's page. Then there is this script block https://geckwiki.com/index.php/OnEquipWhich you would put in a script on the weapon. Or if you can't use a script specific to the weapon because you don't want to put one on every stinking weap.Then there is an EventHandler , specifically "OnActorEquip" Here is the general page https://geckwiki.com/index.php/Event_Handling But look at the bottom for "SetEventHandler" of how to set them up , plus I think you will be able to use a formlist with the weapon filter ? Incase that is what you are needing. Link to comment Share on other sites More sharing options...
Asterra Posted March 19, 2020 Author Share Posted March 19, 2020 There is ... https://geckwiki.com/index.php?title=GetEquipped Equipping and wielding are two different things. In the latter case, that's what IsWeaponOut is meant to be for, though it has the unfortunate limitation I already elaborated. There's one point to differentiate. While the NVSE functions understand "equip" to mean when an actor starts wearing a weapon, GetAnimAction's "equip" means when they're in the process of actually wielding it. Unfortunately, as previously noted, it also is no use in this case. Link to comment Share on other sites More sharing options...
Mktavish Posted March 19, 2020 Share Posted March 19, 2020 OIC , well your title was misleading , and you didn't really make it clear in the post. But when you said wielding , that cleared it up I think ? So you don't want when the weapon is out , but the moment the player tries to bring it out ? Which is easy ... https://geckwiki.com/index.php/IsControlPressedorhttps://geckwiki.com/index.php?title=IsKeyPressed Hope that is what you wanted .Or do you mean an NPC ?In which the event handler "OnStartCombat" might work ??? But also try this ... https://geckwiki.com/index.php?title=GetCurrentAIProcedure Set up a script that will yield you a float clock , and the procedure index , while observing an npc in game do the action you want.Then after that , you can set up 2 or 3 checks for the inbetween spaces , in order to execute what you want to happen.Guessing stuff like ...Observe combatAlarmAcquireCombat At least in theory it may work. Here's another one that may yield a variable amount you can track for the frame per frame.https://cs.elderscrolls.com/index.php?title=GetShouldAttack But in case what I'm alluding to isn't clear ... you take known spots , after observing it along side a millisecond read out in testing. Then you use a getsecondspassed check piggy backed with some other check to execute when you want. Link to comment Share on other sites More sharing options...
Asterra Posted March 19, 2020 Author Share Posted March 19, 2020 (edited) But also try this ... https://geckwiki.com/index.php?title=GetCurrentAIProcedure[...]Then you use a getsecondspassed check piggy backed with some other check to execute when you want. Some top tier suggestions in this. I hadn't heard about that one there. And I wish it were as easy as that. The specific context is that NPCs can be told to wield by default, and such behavior is dictated by a GECK entry. But the thing I'm watching for is 100% dependent on a single variable: Is the thing in their hand right now or not? (And it's worth repeating that IsWeaponOut won't register this until the weapon is *fully* out.) As it happens, if I hand an NPC a weapon and force them to wield it, GetCurrentAIProcedure does not budge from 0. All I can really do is kludge it. Assume that the weapon will eventually be in their hand if I detect the anim event. Watch for NPCs coming from other areas, who might already be wielding it. (I actually don't know a good way of doing that. Frame-by-frame monitoring for new NPCs, just in case. I'm not going to pretend there's a chance somebody set up an event for something like that.) The problem with relying upon anim actions is that different actors have different speeds, different weapons have different speeds, and even different scenarios (Turbo? VATS?) have different speeds. It's chaos. Edited March 19, 2020 by Asterra Link to comment Share on other sites More sharing options...
UnvalidUserName Posted March 19, 2020 Share Posted March 19, 2020 (edited) JIP Plugin has GetEquippedItemRef. This will always return a reference to the weapon. It only fails to work when you don't have a weapon at all. The syntax is for example: player.GetEquippedItemRef 5 With the reference you can get almost any info from the weapon for comparisons and such. You can use it in combination with IsWeaponOut to see if the actor is "wielding" the weapon or just has it equipped Edited March 19, 2020 by UnvalidUserName Link to comment Share on other sites More sharing options...
Asterra Posted March 19, 2020 Author Share Posted March 19, 2020 With the reference you can get almost any info from the weapon for comparisons and such. You can use it in combination with IsWeaponOut to see if the actor is "wielding" the weapon or just has it equipped Thank you. That's unfortunately not the issue I have. Just to cover the specifics in one breath: There is an animation which occurs for every weapon when the actor chooses to wield it. Before this animation plays, the weapon is regarded as equipped, but not "out". During this animation, the weapon is regarded as equipped, but still not "out". Only when the animation completely finishes is the weapon finally considered "out". What I need, on the other hand, is to know exactly when the weapon enters the actor's hand. This occurs at some moment midway through the animation. That moment depends on the actor's stats, the weapon, and other factors. Although it's certainly possible for someone to create a function that watches for this specific thing, it evidently cannot be done with what we currently have. There are no tricky alternative methods for pinning this instant down, either. HasLoaded3D, IsSoundPlaying, MoveToNode, etc. Various unexpected limitations conspire to prevent any of this from being of any use. Link to comment Share on other sites More sharing options...
Mktavish Posted March 19, 2020 Share Posted March 19, 2020 Ya I see what you mean with "GetCurrentAIProcedure"A bunch of 0's when they are obviously not Traveling. As if the function is just being bypassed by the hard coding obsidian put in place. Which I bet is the case with a lot of functions that probably worked with Fo3 ? All I can say is try the testing script I mentioned ( a float clock with PrintC) along with individual check functions to PrintC when they are true. Which will at least give you a time line map of what to expect after various scenario testing. Without knowing what you're trying to do for game side render with this info ( because code behind the scenes is not what really matters right ?) It's hard to help you come up with a solution to your final product vision. Which my experience with the engine is many non obvious routes can be found in a lot of cases.But I understand if you want to keep your prospective mod idea's to your self. Link to comment Share on other sites More sharing options...
UnvalidUserName Posted March 19, 2020 Share Posted March 19, 2020 What about calculating the moment? You can get the total time the animation takes to play and then with some testing pindown in what fraction of the animation the actor finally touches the weapon. It will change if the actor's agility changes but otherwise should be fine.Then you just run a script that only last for the animation and triggers whatever effect you need in that moment. The script would have to run frame by frame thou Link to comment Share on other sites More sharing options...
Mktavish Posted March 20, 2020 Share Posted March 20, 2020 What about calculating the moment? You can get the total time the animation takes to play and then with some testing pindown in what fraction of the animation the actor finally touches the weapon. It will change if the actor's agility changes but otherwise should be fine.Then you just run a script that only last for the animation and triggers whatever effect you need in that moment. The script would have to run frame by frame thouIsn't that pretty much what I was saying ? PrintC of the float clock , along with PrintC of points that are true. Otherwise how else do you imagine "calculating the moment" ? Link to comment Share on other sites More sharing options...
Recommended Posts