jangofett890 Posted July 3, 2016 Share Posted July 3, 2016 So I'm trying to make it so when you shoot at an object a few times it explodes and replaces itself with a different object, however the OnHit event never fires when I shoot at it.My code Scriptname MQNS_OnHit extends ObjectReference ObjectReference Property AltMe Auto Int Property TimesHit Auto ObjectReference Property ToDisable Auto Const event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, \ bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial) TimesHit += 1 debug.notification("I'm hit! " + TimesHit + " Times!") if TimesHit == 5 ToDisable.disable() AltMe.Enable() endif EndEvent The debug.notification never apears so I can only assume that the event is never firing. I do have a mod enabled that may be causing it but I am not sure called Weapons of Fate http://www.nexusmods.com/fallout4/mods/12986/?The only reason I think that might be causing it is because it messes with the bullet physics and such. P.S I am unsure how to make an explosion effect (And sound?) appear and that information would also be helpful Link to comment Share on other sites More sharing options...
Engager Posted July 3, 2016 Share Posted July 3, 2016 It will not work that way. You need to register for that event first using RegisterForHitEvent (http://www.creationkit.com/fallout4/index.php?title=RegisterForHitEvent_-_ScriptObject). Event fires only once, and after that you need to register it again. Link to comment Share on other sites More sharing options...
KataPUMB Posted July 3, 2016 Share Posted July 3, 2016 I think that for this case is better to try with Actor.OnCripple(), OnHit() now require previous registration with registerforhitevent() and everytime a hit happens you have to register it again so yea... easier with cripple i think... Check this CK article for more info. Link to comment Share on other sites More sharing options...
EmissaryOfWind Posted July 3, 2016 Share Posted July 3, 2016 You could also use destruction states to achieve this, rather than a script! Link to comment Share on other sites More sharing options...
jangofett890 Posted July 3, 2016 Author Share Posted July 3, 2016 Thanks, I'll probably have to have it register because I'm doing it for a terminal, and turning it into a broken one, I'm looking at the wiki for destructible objects and it seems like it only uses models and activators, which a working terminal is obviously not just a model. Link to comment Share on other sites More sharing options...
Recommended Posts