SandMouseAnarchy Posted May 26, 2019 Share Posted May 26, 2019 His guys I'm trying to figure out how to detect if the player hits a tree, I tried using "Onhit" event tied to a weapon and tied to a reference alias quest script but that only seems to run against an actor not an object or rock or tree, and I think I also read that Onhit event has to be on the object/actor that gets hit(?) Can I use Onhit event for non actors and if so how?If Onhit event can't be used, how else can I detect which object is hit? ((my thoughts are that the game can tell if a weapon hits a tree/wood because it places a small effect on the tree where a weapon hits it.)) Link to comment Share on other sites More sharing options...
hereami Posted May 31, 2019 Share Posted May 31, 2019 (edited) Interesting. Still lazy to try, but possibly Combat Hit Spell may work, it is said that single MGEF archetype, which works for non-actors is Script, logical to assume that spells can hit any object then. Spell should be conditioned to Subject.GetIsObjectType or similar and trigger whatever farther actions by script.Downside here is that there can be only one Combat Hit Spell active per shot.Also there'll be no info about exact material, it's only available inside OnHit event, i guess. PS. OnHIt event on a weapon applies to the weapon as an object, E.g. when a dropped gun is hit. https://www.creationkit.com/index.php?title=OnHit_-_ObjectReference Also, if spells do hit non-living targets, something like that can be done(?):- constant effect on player, configured to delivery type Target Location: "Effect is applied to the object/landscape under the crosshairs";- mgef script forces the target into an alias, which provides required Alias.OnHit script;Idk, if it's possible for the game to process realtime alias update for such method.PPS. Should be Cloak somehow? I'm confused now, how to cast it on target. Need to try to try later. Edited May 31, 2019 by hereami Link to comment Share on other sites More sharing options...
SandMouseAnarchy Posted June 1, 2019 Author Share Posted June 1, 2019 Ah, really interesting idea hereami! :) I had tried the combat hit spell method, but I got stuck figuring out how to get it to use and register the target, have you had any luck? There seems to be an option for "tree" under the getisobjecttype but I'm really unsure what "trees" it refers to and I couldn't figure out how to get my own list of trees into that drop down box. The idea for the target location constant effect sounds cool, I'll have to try that ^.^ have you had any luck? Link to comment Share on other sites More sharing options...
Zorkaz Posted June 1, 2019 Share Posted June 1, 2019 I'm guessing you are making a mod about cutting trees and you're using an activator instead of an static.My wild guess: Maybe you can do edit something in the destruction data Link to comment Share on other sites More sharing options...
hereami Posted June 2, 2019 Share Posted June 2, 2019 (edited) Didn't try yet, stuck with another thing. Honestlty i doubt now, just an assumption, those who know, keep silence :smile:If you made sure, that your Combat hit spell does actually hit everything, do whatever thing with akTarget parm for OnEffectStart event.If your only objects of interest are custom forms, then simply attach OnHit scripts to all of them.Otherwise, to filter out custom set of targets - might use IsInList condition func, either in MGEF, or inside Perk. But possibly, having multiple conditions GetIsId can be more effective. That's really weird, there are no TREEs utilized in F4, all trees are STAT. I looked into Skyrim esm, and there are real TREEs, which can be widely configured - bend etc. (that time i wanted to "steal" Better Trees mod for Skyrim, or whatever it's called). Too bad, they've discarded it in F4. PS. Again, if custom trees to harvest, maybe think about making it Flora? Or use destruction stages processing, as Zorkaz suggested. Edited June 2, 2019 by hereami Link to comment Share on other sites More sharing options...
Zorkaz Posted June 2, 2019 Share Posted June 2, 2019 At least you'd had to replace them which will break precombines.Like my mod already did:https://www.nexusmods.com/fallout4/mods/37139 The other issue to face: A lot of trees are actually groups of trees, as they are static collections, so you can't just remove them piece by piece Link to comment Share on other sites More sharing options...
SandMouseAnarchy Posted June 3, 2019 Author Share Posted June 3, 2019 ah, some really great ideas here guys. i had initially thought about adding destruction data to the trees, i might still look into that once i have a way of targeting trees correctly. im using a few quests and refcollectionalliases at the moment and im fairly close to a solution there, i just need to figure out how to refill my aliases. Zorkaz, thankyou for the replies mate! your mod was actually an inspiration for this part of my mod :) i thought it was very cool how you made the trees disable after cutting them down... shame to hear it breaks precombines! i had a feeling it might unfortunately. so i had an idea for replacing the target(tree's) texture with an invisible texture, so the tree looks like its invisible, then replace the tree with a stump, or if i can figure it out ill try replacing the trees with furniture versions of the meshes so i can add destruction data without actually disabling the original Static :) i cant think of another way to add destruction data to an object though, im pretty sure a static object cant hold destruction data in its form?? Link to comment Share on other sites More sharing options...
Zorkaz Posted June 3, 2019 Share Posted June 3, 2019 I think destruction data is only possible with activators and movable statics to variable degrees.It's impossible with furniture (You can give it destr. data but it doesn't get destructed) and statics as far as I recall.(I could be wrong though) Unless you use a script of course. Btw, if you can figure out the "OnHit" part I'd suggest using explosion data to spawn either scrap wood or the stump itself.Just an idea. Link to comment Share on other sites More sharing options...
SandMouseAnarchy Posted June 3, 2019 Author Share Posted June 3, 2019 Ahh yes using the explosion for wood debris is a great idea! ^.^ I'll look into that ^.^ And Yeh I think you're right mate about the movable statics, I'll have to look into it though because I'm unsure ^.^ thanks very much for the ideas, the inspiration and the advice mate! Much appreciated! Link to comment Share on other sites More sharing options...
Recommended Posts