Jump to content

Detect hit location and "safely" uninstalling scripts


Zyox

Recommended Posts

Greetings!

 

First off, I did search for these topics, but I was unable to find anything useful. Whether it's because my searching abilities suck or the relevant information is simply buried too deep, I do not know.

 

I need to know of any method that would allow detecting where on the body of an actor a hit was performed and how to create relatively "safe" uninstall routines for scripts (avoid breaking saves).

 

Thank you very much for reading this and I look forward to contributions.

Edited by Zyox
Link to comment
Share on other sites

Few views and no replies... Doesn't anybody want a stable alternative to Locational Damage? ATM, I'm only planning to enable headshots, but if I can build a lightweight (script-wise) system, I might turn it into a locational hit detection framework. Think of the possibilities.

 

A post explaining why it wouldn't be possible would be good enough, though I don't believe that's the case. I already requested the source code from Kahmul78, but it may take a while to get a reply, and there are no guarantees that I'll get the code.

 

About the uninstallation routines, I understand that I'd basically have to replace everything in the script with inert versions of it. I was looking for best practice pointers (ATM, I plan to do it with control variables and states) and whether there was any way to truly remove them (not just disable). I know this one is something that's definitely feasible, please contribute. You don't have to type out everything and explain it, a link will suffice (I did say that's what I was searching for, but couldn't find).

Edited by Zyox
Link to comment
Share on other sites

Would you believe I'm trying to provide a link for uninstalling orphaned scripts, but the dialog box isn't working? Here, just go to the files page, click on the search box & type "Save file cleaner". That should get you at least a couple of listings.

 

As for "detect hit location", you might try "Duel - Combat Realism."

Link to comment
Share on other sites

Thank you so much for replying (finally, someone did)!

 

Downloaded both versions of Duel - Combat Realism, will test. I had stumbled upon it before, but somehow missed the part about headshots. Hopefully, they come with their source code. I'm only looking to create a very simple headshot mod, since my heavily scripted setup has already exceeded the Papyrus engine's capacity. If I do figure it out, I'll publish it for others experiencing the same problem to have an alternative. Or maybe D-CR is light enough and has an MCM menu (to disable the parts I don't need/want), so I don't have to bother with creating anything...

 

About uninstalling scripts, I was actually referring to something a bit different, already have the Papyrus Data Transfer utility and SaveTool. I am actually getting into mod creation (haven't made anything yet, though I've already learned most of what's on the CK wiki), and I wish to know how to make my own scripts uninstall themselves when the option is selected through the MCM menu (yep, learned SkyUI's MCM API too), and make them uninstall themselves when the mod is gone (let's face it, users don't always follow instructions; me included).

 

Again, thanks for the reply!

Edited by Zyox
Link to comment
Share on other sites

Here's the skinny on uninstalling scripts:

 

If the script is attached to a fire-and-forget spell, or an non-persistent item that never leaves the inventory, uninstalling is relatively easy. Unregister for any updates (not strictly necessary since this should be done automatically but it's better safe than sorry), unequip the item/spell, then remove the spell or item from the player.

 

If the script is attached to a persistent object, unique actor, or any item that may have an object reference in the world (in other words, any item that the player might have dropped, or was placed in the world by the CK), things are a bit messier. Unregister for any updates and remove or replace all of the events attached to the object. Do NOT delete any properties. If the properties are filled by other forms, just leave them alone. If the properties are object references, fill them with "none."

 

If the script is attached to a spell ability, unregister for any updates and remove or dispel the ability.

 

If the script is attached to a quest or quest alias, unregister for any updates, then stop the quest. In some cases you may want to actually reset the quest too, but that shouldn't be necessary most of the time.

 

To make a script uninstall itself, you could implement a check that verifies the presence of a global variable associated with your mod, set to a non-zero number. When the mod is removed without uninstalling, the check will return false (i.e. that the global no longer exists). You can then execute the uninstall routine. This is a bit less than ideal, though, as many o f the forms will no longer be present. My perspective is that any player who doesn't use the uninstall option has made their own bed.

Edited by lofgren
Link to comment
Share on other sites

  • 2 months later...

Hi!

 

I'm also looking for an effective way to detect hit location without using trigonometry. Using activators attached to each body part could be a way. Activators are ObjectReference type, so scripts with OnHit events can be attached to them, and they can use collision geometries. This method could have multiple advantages, like right hit detection during animations, and easy creation of hit zones on creatures. Unfortunately I don't know yet if it's even possible. I've been digging in the creation kit and even in NifSkope, founding nothing that could help this, but I could really have missed something.

 

This idea come from a post on the forums where someone used preloaded activators and moved them to actor nodes but I haven't been able to figure out how he was doing that : http://forums.nexusmods.com/index.php?/topic/927840-need-help-with-an-idea-math-related/?hl=%2Bactivator+%2Bnode&do=findComment&comment=7555826

Link to comment
Share on other sites

  • Recently Browsing   0 members

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