vaultbait Posted August 16, 2022 Posted August 16, 2022 3 hours ago, izzyknows said: Prolly not the "best" way, and it might not even work, but place an xmarker and add the keyword "home" to her... I forget the keyword, but it's what causes NPC's to always move to the volume or marker. Warwick, Abernathy, County Crossing, Bunker Hill NPC's... all have it. Looks like you're talking about the WorkshopLinkHome keyword but this is not a workshop actor nor in a workshop location. Does that matter? 2 hours ago, naaitsab said: You could use a marker and "link" the NPC to it. It's either linked ref or one of the other refs if you double click it in the render window in the CK. I linked the actor to the marker (and the marker to the actor, just in case). Is there some keyword I should use? Like the WorkshopLinkHome mentioned above? 2 hours ago, naaitsab said: You could check other game files which it is I always forget. I believe RH also contains a few mats with special RH animation/stances you could also try those with a package. I'll keep this in mind, but RH is a soft dependency for the mod in question, so I'd probably need to perform a reference swap in script to place one of those (definitely possible to do though, I already do something similar to swap vanilla toilets, showerheads and bathtubs with CWSS equivalents). If there's some way I can override it using vanilla markers, that's preferable. 2 hours ago, naaitsab said: A bit more nasty is the disableAI command. Which makes the NPC do nothing. Which might not fit your needs. Yeah, I thought about that and/or calling SetRestrainted() but the results are not very natural.
vaultbait Posted August 16, 2022 Posted August 16, 2022 17 minutes ago, Kharos said: RH_BoundHandsWait is basically a fallback package for bound NPCs when no other package applies - if you look at the package list in RH_MainQuest, it is the lowest priority package and selected when no other package applies. It will cause a bound NPC to stay where they are. They are not bound to a specific place, so if you bump into them and push them away they will stay at their current place. Most probably your best bet is the RH_BoundHandsStayAtLinkedMarker package. Place some kind of marker where you want the NPC to stay and link them to the marker with the keyword RH_WaitMarkerLink, this should trigger the package if the NPC is bound. It should cause her to wait at the marker, and if you move her away far enough she will return to the marker (if you just push her just a short distance the AI might not trigger the return to the marker, so it may not be 100% foolproof). You can dynamically add/remove linked refs from papyrus using SetLinkedRef. It may also be possible to do it statically in the creation kit, I am not 100% sure though. [Edit] You can also use something different than a marker, e.g. a furniture, rug, etc. Basically any object reference should work. Thanks! This sounds promising. I should be able to do it in the same part of my scripts where I conditionally apply the handcuffs.
Kharos Posted August 16, 2022 Author Posted August 16, 2022 16 minutes ago, vaultbait said: Thanks! This sounds promising. I should be able to do it in the same part of my scripts where I conditionally apply the handcuffs. I forgot, you may need to call `Actor.EvaluatePackage(true)` after setting the link to force the AI to switch to the new package (not sure).
vaultbait Posted August 16, 2022 Posted August 16, 2022 4 hours ago, Kharos said: Most probably your best bet is the RH_BoundHandsStayAtLinkedMarker package. Place some kind of marker where you want the NPC to stay and link them to the marker with the keyword RH_WaitMarkerLink, this should trigger the package if the NPC is bound. It should cause her to wait at the marker, and if you move her away far enough she will return to the marker (if you just push her just a short distance the AI might not trigger the return to the marker, so it may not be 100% foolproof). You can dynamically add/remove linked refs from papyrus using SetLinkedRef. Thanks again, this worked perfectly. I ended up leaving out the EvaluatePackage() since I could apply the keyword prior to equipping the cuffs (it was all happening in the same block of script). Good to know that might be helpful if someone needs to set things up in reverse order though. 1
Kanlaon Posted August 21, 2022 Posted August 21, 2022 Is there a easy way to detect if the player is wearing handcuffs. (For use in a script of some other mod) With the DD patch it is possible to check for a single keyword, but without this patch ?
Kharos Posted August 21, 2022 Author Posted August 21, 2022 1 hour ago, Kanlaon said: Is there a easy way to detect if the player is wearing handcuffs. (For use in a script of some other mod) With the DD patch it is possible to check for a single keyword, but without this patch ? From scripts, use ThirdPartyAPI.HasHandsBoundBehindBack(Actor akActor), this should work for both player and npcs. From conditions in the creation kit, you can check for keyword RH_BoundHands. 1
JB. Posted August 22, 2022 Posted August 22, 2022 Hey, @Kharos, I'm making a mod and I also use RealHandcuffs. The mod does interesting things "through the collar", like various restrictions, but the truth is that the collar is only aesthetic. Any external mod can step in and take the collar off the player. The mod will still behave as if the player had a collar on. My question is, do you know if there is an event to hear if the collar has been removed?
vaultbait Posted August 22, 2022 Posted August 22, 2022 6 minutes ago, JB. said: Hey, @Kharos, I'm making a mod and I also use RealHandcuffs. The mod does interesting things "through the collar", like various restrictions, but the truth is that the collar is only aesthetic. Any external mod can step in and take the collar off the player. The mod will still behave as if the player had a collar on. My question is, do you know if there is an event to hear if the collar has been removed? Maybe overkill, but your script could RegisterForRemoteEvent(Game.GetPlayer(), "OnItemUnequipped") and then have a Event Actor.OnItemUnequipped(...) block to do whatever you want after confirming the thing that was unequipped was the collar. 1
Kharos Posted August 23, 2022 Author Posted August 23, 2022 (edited) 6 hours ago, JB. said: Hey, @Kharos, I'm making a mod and I also use RealHandcuffs. The mod does interesting things "through the collar", like various restrictions, but the truth is that the collar is only aesthetic. Any external mod can step in and take the collar off the player. The mod will still behave as if the player had a collar on. My question is, do you know if there is an event to hear if the collar has been removed? There are three custom event on RealHandcuffs.Library, see here: https://github.com/RealHandcuffs/RealHandcuffs/blob/master/package/0_Common/Scripts/Source/User/RealHandcuffs/Library.psc#L100 I am using them myself to lock and unlock the settings in hardcore mode, see here for how to use them: https://github.com/RealHandcuffs/RealHandcuffs/blob/master/package/0_Common/Scripts/Source/User/RealHandcuffs/Settings.psc#L697 https://github.com/RealHandcuffs/RealHandcuffs/blob/master/package/0_Common/Scripts/Source/User/RealHandcuffs/Settings.psc#L730 Note that the registration is not per actor, it is for all actors, so you will get an event every time a restraint is removed - not just for the player but also for NPCs, and not just for collars but also for handcuffs. The event is probably not very common so it should not be a performance issue, but you need to "filter" in papyrus code. Or use @vaultbait 's suggestion, that would work too. Edited August 23, 2022 by Kharos 1
Kanlaon Posted August 23, 2022 Posted August 23, 2022 8 hours ago, JB. said: Hey, @Kharos, I'm making a mod and I also use RealHandcuffs. The mod does interesting things "through the collar", like various restrictions, but the truth is that the collar is only aesthetic. Any external mod can step in and take the collar off the player. The mod will still behave as if the player had a collar on. My question is, do you know if there is an event to hear if the collar has been removed? I would follow the idea from @Vaultbait if it is intended for the player only, because it would had better performance. Something similar is done in the Bomb-Collar-quest in "NudeBasics" only the equipping of some of the "interesting collars" is done in script for a refencealias on the player. Therefore the collar-quest and script soes not need to run all the time. One of the reasons that Fallout 4 runs so much more better than skyrim is the fact that the "eventsystem" of the game is more restricted not so overloaded as in skyrim. 1
vaultbait Posted August 23, 2022 Posted August 23, 2022 5 hours ago, Kanlaon said: I would follow the idea from @Vaultbait if it is intended for the player only, because it would had better performance. "Better performance" is debateable. I'm implementing a nudity tracking system in a mod I've got under development, and one of the things it does is watch equipping and unequipping on the player. There are a lot more of those events than you might at first expect. Every time you use a consumable, it fires an equipped event. Even if you filter down to just wearable items (by recasting the base object Form to Armor and checking it against None), there are many things which still fire these events you wouldn't expect... for example, if you're using the Pip-Pad mod, its "effects" implementation equips and unequips an "armor" item every time you bring up or dismiss your pad (thankfully it and similar mods share a common keyword so I can filter those out too). Many mods implement control items as "armor" which gets equipped and instantly unequipped (TSEX/Hardship makeup mirror and config menu item, Player Comments dialogue toggle, Rogg's No-Strip Items Manager, DD Items Manager, and so on) which I've so far not found a great way to isolate. However, unless you're doing expensive calculations triggered by these events, it probably doesn't matter which solution you use. In my case I'm having to work around the fact that there's no "WornCoversBipedSlot" check exposed in the native API or F4SE, so I'm having to rely on nested iteration over all slots followed by individual slotmasks I care about, and that's around 1-2 seconds of iterating depending on how much priority it gets over the game engine's timeslices. I've been able to mitigate the impact to some extent by wrapping calls in an ad hoc mutex and queue with a depth of 1, so I can at least keep the function calls from trying to run more than one concurrently and skip any redundant calls if another is already waiting.
Kanlaon Posted August 23, 2022 Posted August 23, 2022 36 minutes ago, vaultbait said: "Better performance" is debateable. I'm implementing a nudity tracking system in a mod I've got under development, and one of the things it does is watch equipping and unequipping on the player. There are a lot more of those events than you might at first expect. Every time you use a consumable, it fires an equipped event. Even if you filter down to just wearable items (by recasting the base object Form to Armor and checking it against None), there are many things which still fire these events you wouldn't expect... for example, if you're using the Pip-Pad mod, its "effects" implementation equips and unequips an "armor" item every time you bring up or dismiss your pad (thankfully it and similar mods share a common keyword so I can filter those out too). Many mods implement control items as "armor" which gets equipped and instantly unequipped (TSEX/Hardship makeup mirror and config menu item, Player Comments dialogue toggle, Rogg's No-Strip Items Manager, DD Items Manager, and so on) which I've so far not found a great way to isolate. However, unless you're doing expensive calculations triggered by these events, it probably doesn't matter which solution you use. In my case I'm having to work around the fact that there's no "WornCoversBipedSlot" check exposed in the native API or F4SE, so I'm having to rely on nested iteration over all slots followed by individual slotmasks I care about, and that's around 1-2 seconds of iterating depending on how much priority it gets over the game engine's timeslices. I've been able to mitigate the impact to some extent by wrapping calls in an ad hoc mutex and queue with a depth of 1, so I can at least keep the function calls from trying to run more than one concurrently and skip any redundant calls if another is already waiting. Ok maybe there is no WorncoversBipedSlot for FO4, but one fine day i stumbled across this (undocumented !) function : GetSlotMask. It is very helpful and i used it for my own naked detections etc. very often. Here is an example Bool Function IsWearingClothing() Actor:WornItem wI = Player.GetWornItem (3) armor attire = wI.item as armor if attire if Math.LogicalAnd (attire.GetSlotMask(), 0x0008) if attire.getname () != "" ; Devious devices have the name assigned to the inventory item, not the rendered item return true endif endif endif return false EndFunction I assume it can be helpful for your mod too. - Just forget, that my detection here only works for the regular FO4 slot no. 3 ? With my own expierience "IS" that can be used in conditions seems not so reliable working than "AS".
JB. Posted August 23, 2022 Posted August 23, 2022 Thanks for the help guys! I just tested the Real Handcuffs custom event and it worked perfect. ?
vaultbait Posted August 23, 2022 Posted August 23, 2022 7 hours ago, Kanlaon said: Ok maybe there is no WorncoversBipedSlot for FO4, but one fine day i stumbled across this (undocumented !) function : GetSlotMask. It is very helpful and i used it for my own naked detections etc. very often. Excellent suggestion, that's precisely what I'm using in fact. The problem is that there's no reverse lookup, so if you want to know if any worn item covers biped slot 17 for example, you have to check every biped slot for a WornItem, then check the SlotMasks of each and every one of those to see if one of them covers slot 17, because querying the slot only gets you the item for which that slot is primary but not for other items that cover it as a non-primary slot. I'm not going to even try to guess why the CK condition for that didn't get included in the API exposed to Papyrus.
Kharos Posted August 24, 2022 Author Posted August 24, 2022 (edited) 19 hours ago, vaultbait said: Excellent suggestion, that's precisely what I'm using in fact. The problem is that there's no reverse lookup, so if you want to know if any worn item covers biped slot 17 for example, you have to check every biped slot for a WornItem, then check the SlotMasks of each and every one of those to see if one of them covers slot 17, because querying the slot only gets you the item for which that slot is primary but not for other items that cover it as a non-primary slot. I'm not going to even try to guess why the CK condition for that didn't get included in the API exposed to Papyrus. This may be a dumb idea as I have not tested it myself. Did you check carefully what happens when you call GetWornItem(17) when the slot is covered by an armor that has it as a non-primary slot? The source of the F4SE ActorScript.psc says: ; F4SE additions built 2020-04-05 23:13:41.964000 UTC struct WornItem Form item ; Can be ARMO, WEAP or ARMA Form model ; Can be ARMA or WEAP depending on item string modelName ; Model override name Form materialSwap ; Material swap form TextureSet texture ; TextureSet override EndStruct ; Slot index is valid from 0-43 ; Item can be none and still contain other information at a particular slot ; When the item is an ARMA, it means that the item takes multiple slots, ; and that particular slot is not where the ARMO lives WornItem Function GetWornItem(int slotIndex, bool firstPerson = false) native It is possible to understand this such that item is None but model is not None in that case, or that item is not None but (item as Armor) will be None (i.e. item will be a Form that cannot be cast to Armor or Weapon). Of course only careful testing will show what actually happens... [Edit] I see that F4SE adds an ArmorAddon class, so you can try to cast model or item to ArmorAddon and see if the result is != None. Edited August 24, 2022 by Kharos
vaultbait Posted August 24, 2022 Posted August 24, 2022 (edited) 4 hours ago, Kharos said: It is possible to understand this such that item is None but model is not None in that case, or that item is not None but (item as Armor) will be None (i.e. item will be a Form that cannot be cast to Armor or Weapon). Of course only careful testing will show what actually happens... [Edit] I see that F4SE adds an ArmorAddon class, so you can try to cast model or item to ArmorAddon and see if the result is != None. That's an interesting observation. I should be able to query one of the underarmor slots with a vanilla outfit on and see what's returned. They all use primary slot index 3 (body) but cover 6-10 as well. Thanks for the idea! Edit: No dice, sadly... [item = [Armor < (0001EED7)>], model = [Form < (0001F0E0)>], modelName = "clothes\vault111suit\FemaleVault111Suit.nif", materialSwap = None, texture = [TextureSet < (000F7E66)>]] at slot index 3 [item = None, model = None, modelName = "", materialSwap = None, texture = None] at slot index 6 [item = None, model = None, modelName = "", materialSwap = None, texture = None] at slot index 7 [item = None, model = None, modelName = "", materialSwap = None, texture = None] at slot index 8 [item = None, model = None, modelName = "", materialSwap = None, texture = None] at slot index 9 [item = None, model = None, modelName = "", materialSwap = None, texture = None] at slot index 10 That's the structs returned by GetWornItem() calls for slot indices 3,6-10 while wearing a vaultsuit, which the BOD2 record in Fallout4.esm says covers first person flags 33,36-40. At any rate, I've gone over the function carefully removing or precaching any redundant external function calls, and flattened the loops as much as possible, which got the execution time down to consistently under a second judging from debug timestamps I'm echoing into the Papyrus log (I haven't tried more fine-grained profiling yet), so it should be good enough for now. Once it's released, if users see significant lag, I can probably squeeze a little more out of it by only setting discrete values for nudity instead of building scalars to reflect varying degrees of nudity. Worst worst case, I'll dust off my old C++ references and try to make an F4SE plugin to do this part, but hopefully it won't come to that. Edited August 24, 2022 by vaultbait
Kharos Posted August 25, 2022 Author Posted August 25, 2022 11 hours ago, vaultbait said: Edit: No dice, sadly... Well it was worth a try ?
FO4Life Posted August 26, 2022 Posted August 26, 2022 (edited) On 8/23/2022 at 3:58 PM, vaultbait said: "Better performance" is debateable. I'm implementing a nudity tracking system in a mod I've got under development, and one of the things it does is watch equipping and unequipping on the player. There are a lot more of those events than you might at first expect. Every time you use a consumable, it fires an equipped event. Even if you filter down to just wearable items (by recasting the base object Form to Armor and checking it against None), there are many things which still fire these events you wouldn't expect... for example, if you're using the Pip-Pad mod, its "effects" implementation equips and unequips an "armor" item every time you bring up or dismiss your pad (thankfully it and similar mods share a common keyword so I can filter those out too). Many mods implement control items as "armor" which gets equipped and instantly unequipped (TSEX/Hardship makeup mirror and config menu item, Player Comments dialogue toggle, Rogg's No-Strip Items Manager, DD Items Manager, and so on) which I've so far not found a great way to isolate. However, unless you're doing expensive calculations triggered by these events, it probably doesn't matter which solution you use. In my case I'm having to work around the fact that there's no "WornCoversBipedSlot" check exposed in the native API or F4SE, so I'm having to rely on nested iteration over all slots followed by individual slotmasks I care about, and that's around 1-2 seconds of iterating depending on how much priority it gets over the game engine's timeslices. I've been able to mitigate the impact to some extent by wrapping calls in an ad hoc mutex and queue with a depth of 1, so I can at least keep the function calls from trying to run more than one concurrently and skip any redundant calls if another is already waiting. Hi, I stumbled on this conversation by accident... interesting concept (detecting nudity). My first thought was to check Damage Resistance rating but then I checked and quite a lot (most?) of clothing options have this value set to zero. My second thought, a work around to the first idea was to edit every clothing item and if Damage Resistance = 0 then edit that to 1 instead; while this would have a negligible impact on the game, I am guessing that would be like building a high tech factory to make one jar of honey?! Then I thought of weight... would it be possible to run a function that summed slot weights? If zero, then nude. What about your assumptions, and what you are really trying to achieve: if a character is wearing nothing but a hat, or a pair of gloves, would you consider this nude or not? What about a hat, glasses, gloves and scarf? What about jewelry mods and those slots? Perhaps define which slots that really impact on nudity and run a "weight checksum" on the applicable slots? EDIT IIRC, a long time ago in a galaxy far, far away... a Skyrim mod allowed you to define the nature of clothing items; I don't remember the exact definitions but I think that users had the choice to consider each clothing/armour item/set as normal or "nude" [equivalent]. A more elegant solution, in my eyes, would be to develop such a mod [resource] for FO4 and allow users to define each clothing/armour item as "standard", "flirty" or "trashy". Perhaps enough "trashy" [think highly provocative] could be considered a trigger for an event that you may (or may not) be targetting instead of all or nothing nude? For a while now, I have considered learning to program (oof) because I would like to see a mod that varied NPC interactions; my idea would be to have an MCM control panel allowing choice of more real and brutal dialogues (charming/flirty, aggressive flirty, degrading...). Alternatively, use different dialogue styles and piggyback twistedtrebla's morality system [Sexual Harassment, much kudos!]. Sorry to have deviated, I was trying to second guess why you needed a nude detect function, and got a little lost in the process. Edited August 26, 2022 by FO4Life
vaultbait Posted August 26, 2022 Posted August 26, 2022 7 hours ago, FO4Life said: What about your assumptions, and what you are really trying to achieve: if a character is wearing nothing but a hat, or a pair of gloves, would you consider this nude or not? What about a hat, glasses, gloves and scarf? What about jewelry mods and those slots? Perhaps define which slots that really impact on nudity and run a "weight checksum" on the applicable slots? It's pretty straightforward: If the player has nothing equipped covering any of the 10 torso, arm or leg underarmor or armor slots then they're considered 100% "nude" from my mod's perspective (yes I understand lots of mod clothing uses slots outside that range and I may extend the function later to accommodate user customization). It actually tracks how many of these slots are covered and whether they're armor or underarmor slots, and stores ratios (in both global variables and actor values for use in different CK features) of how unclothed, unarmored or nude the player is at any given point in time. This is in service of perks which activate bonuses or abilities when not wearing things, a "nudist's" legendary effect which gives attack bonuses and some combat spell effects to some unique weapons, NPC travel packages which cause certain actors to follow the player around or become non-hostile when the player gets undressed, and so on. Note that this is not the mod itself, it's just a feature in larger a story/setting mod I'm building, I just wanted a lot of the story elements and rewards to revolve around getting naked, and to help balance playthroughs for players who like to not wear a lot. 1
riicky83 Posted September 3, 2022 Posted September 3, 2022 Has anyone had this glitch with the handcuffs? I had one in my inventory and it's started self replicating in my inventory (possibly making the game a little laggy in places). Try to put them in a container and it freezes/crashes the game, dropping is impossible as the constant increase stops you from dropping them and instead thinks you want to put them on.
Im_The_Real_Deal Posted September 3, 2022 Posted September 3, 2022 (edited) When I have an enemy intimidated, and put on a collar or handcuffs, the options menu when putting them on forces my gun away. Meaning they become aggressive again. Edited September 3, 2022 by Im_The_Real_Deal
JB. Posted September 8, 2022 Posted September 8, 2022 (edited) Can someone help me? It's about my mod. It turns out that if I remove the handcuffs from the player, who has a collar on, the player ends up dead. I should only kill the player if the collar is removed. Function LoadRH() RegisterForCustomEvent(RHLibrary, "OnRestraintUnapplied") Endfunction Event RealHandcuffs:Library.OnRestraintUnapplied(RealHandcuffs:Library akSender, Var[] akArgs) If _CS_Enslaved.GetValueInt() == 1 If playerRef.wornhaskeyword(RH_ma_shockcollar) Var[] xkArgs = new Var[2] xkArgs[0] = PlayerREF xkArgs[1] = 4 Debug.MessageBox("Collar removed without permission. Proceeding to kill the user.") Utility.Wait(1) ;PlayerREF.Kill() EndIf EndIf EndEvent Note that I hardly know what I'm doing. ? Edit: I just looked at Kharos' example and realized how silly my approach was. This works perfectly. Event RealHandcuffs:Library.OnRestraintUnapplied(RealHandcuffs:Library akSender, Var[] akArgs) Actor player = PlayerREF If _CS_Enslaved.GetValueInt() == 1 If ((akArgs[0] as Actor) == PlayerREF) && (akArgs[1] as int == 4) Debug.MessageBox("Collar removed without permission. Proceeding to kill the user.") Utility.Wait(1) PlayerREF.Kill() EndIf EndIf @Kharos In case you are interested in including it in your main post, I use you handcuffs intensively in my mod Nuka Ride. I don't use the collar for plot reasons, but that will change soon in my next mod. This would not be possible without the help of naitsaab who provided me with a template. Edited September 8, 2022 by JB.
MrNicoras Posted September 8, 2022 Posted September 8, 2022 (edited) On 8/23/2022 at 9:44 AM, Kanlaon said: Ok maybe there is no WorncoversBipedSlot for FO4, Raknar's Futa FEV mod uses this function: Edited September 8, 2022 by MrNicoras
vaultbait Posted September 8, 2022 Posted September 8, 2022 3 hours ago, MrNicoras said: Raknar's Futa FEV mod uses this function: Yes, that's the built-in condition function I'm emulating. It works fine if what you want is a condition in a plugin, but there's no equivalent accessible to Papyrus scripts if you need to do something more dynamic with it, and what is available to scripts when it comes to identifying slot coverage is very round-about, making the script a bit more hefty than I'd like (though I've optimized the hell out of it at this point). 1
naaitsab Posted September 8, 2022 Posted September 8, 2022 12 hours ago, JB. said: Can someone help me? It's about my mod. It turns out that if I remove the handcuffs from the player, who has a collar on, the player ends up dead. I should only kill the player if the collar is removed. @Kharos In case you are interested in including it in your main post, I use you handcuffs intensively in my mod Nuka Ride. I don't use the collar for plot reasons, but that will change soon in my next mod. This would not be possible without the help of naitsaab who provided me with a template. Nearly got the nickname right but yeah the second option with checking the results array is far better. I'm guessing it might be due to the fact that the collar is not always on the player if in menu's etc if I recall the code correctly. To prevent modding/unequipping it. Any teasers for the new mod? If you want to reverse it, you could also trigger the explosion on the collar if the cuffs are removed by tampering. I'm not sure if you need to apply the "bomb" modification first before that can be triggered. Otherwise it might only trigger a shock. Also something to check if the event is persistent between saves. Some types are not and need to be registered everytime you load a game. Another thing that can cause headaches with troubleshooting.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now