adianda Posted August 7, 2018 Share Posted August 7, 2018 (edited) I'm making a Health Overhaul mod for Fallout 4 that utilizes a variety of new Actor Values that are somewhat similar to the vanilla survival needs such as hunger and thirst.What I'm trying to do right now is make it so that whenever the player takes damage a script will run that modifies the aforementioned Actor Values based on the damage taken and the type of the damage received. For example if the player takes 20 damage from a pipe gun, several AVs would get modified in relation to the 20 ballistic damage taken (adding 20 to them or something to a similar effect). I'm not looking to apply enchantments to weapons to modify the Actor Values as that wouldn't achieve the desired results.I'm a noob when it comes to Papyrus so I'm having trouble achieving the results I want using the OnHit event. If anyone has any advice or wants to help that would be greatly appreciated. I'll leave a link to my plans for the mod below in case anyone is interested in assisting me with this road stop I've hit. Hardcore Player Wellness Overhaul Documentation Edited August 7, 2018 by adianda Link to comment Share on other sites More sharing options...
Reneer Posted August 7, 2018 Share Posted August 7, 2018 (edited) Check out the RegisterForRemoteEvent command. That should get you started. Edit: What SKK50 posted is an easier solution. Edited August 7, 2018 by Reneer Link to comment Share on other sites More sharing options...
SKKmods Posted August 7, 2018 Share Posted August 7, 2018 (edited) Look up the following functions and events in www.creationkit.com/fallout4 EDIT: updated with a script I just wrote for some debugging. Its a quest script, but you can use most of it in a magic effect or whatever delivery mechanism you chose. Scriptname SKK_476UtilityQuestScript extends Quest ObjectReference Property pPlayerRef Auto Const Mandatory ;********************************************************* Event OnQuestInit() RegisterForHitEvent(pPlayerRef) EndEvent ;********************************************************* Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial) If akTarget == pPlayerRef Debug.Trace ("SKK_476UtilityQuestScript.ONHIT,Target," + akTarget + ",Aggressor," + akAggressor + ",ActorBase," + (akAggressor as Actor).GetActorBase() + ",Weapon," + akSource + ",Range," + akAggressor.GetDistance(akTarget) as Int ) RegisterForHitEvent(pPlayerRef) Endif EndEvent ;********************************************************* Event OnQuestShutdown() UnregisterForAllEvents() EndEvent ;********************************************************* Edited August 7, 2018 by SKK50 Link to comment Share on other sites More sharing options...
adianda Posted August 8, 2018 Author Share Posted August 8, 2018 Thanks SKK50 and Reneer for responding so quick, I am pretty surprised at how fast you guys responded.So I've began using the script you sent me as a template for a OnHit Event in my management quest in charge of running and tracking all of the various aspects of the mod but when I begin trying to use the OnHit event it starts throwing an error at me and I can't figure out what it is trying to tell me. Can't find anyting online about the error either. It only occurs once I type up the OnHit Event so I know its there 100%.The error:C:\Users\\AppData\Local\Temp\PapyrusTemp\HPWO_Manager_Script.psc(13,0): the parameter types of function onhit in the empty state on script hpwo_manager_script do not match the original script scriptobject Scriptname HPWO_Manager_Script extends Quest ObjectReference Property PlayerRef Auto Const Mandatory ActorValue Property HPWO_Pain Auto Mandatory GlobalVariable[] Property HPWO_PainLimits Auto Const Potion[] Property HPWO_PainEffects Auto Const Event OnQuestInit() RegisterForHitEvent(PlayerRef) EndEvent Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) EndEvent Event OnQuestShutdown() UnregisterForAllEvents() EndEvent Link to comment Share on other sites More sharing options...
shavkacagarikia Posted August 8, 2018 Share Posted August 8, 2018 Onhit has two objectrefereference type parameters - target and aggresor, but you have only agressor, add objectreference aktarget parameter as well.I suppose you took the event signature from skyrim's onhit. Back in skyrims papyrus, onhit was a member of objectreference script so you didnt want to have target as parameter as it would be a script itself where you use it. In fo4 papyrus you can use onhit on any script object so it has one more parameter Link to comment Share on other sites More sharing options...
adianda Posted August 8, 2018 Author Share Posted August 8, 2018 Onhit has two objectrefereference type parameters - target and aggresor, but you have only agressor, add objectreference aktarget parameter as well.I suppose you took the event signature from skyrim's onhit. Back in skyrims papyrus, onhit was a member of objectreference script so you didnt want to have target as parameter as it would be a script itself where you use it. In fo4 papyrus you can use onhit on any script object so it has one more parameterI love you all equally.<3 Juicy Link to comment Share on other sites More sharing options...
adianda Posted August 8, 2018 Author Share Posted August 8, 2018 (edited) Anyone have any ideas on how to find the damage taken by a source whether it be by weapon or otherwise. I'm trying to figure it out right now and if I find anything I'll update this post but at the moment I have nothing.EDIT: Never mind, this was a stupid question fueled by sleep deprivation... I'm not a very smart man. Edited August 8, 2018 by adianda Link to comment Share on other sites More sharing options...
langnao Posted August 8, 2018 Share Posted August 8, 2018 Read the health actor value? The base and current value to determine how much was lost? Link to comment Share on other sites More sharing options...
adianda Posted August 9, 2018 Author Share Posted August 9, 2018 (edited) So does anyone know why when I have 2 magic effects for modifying an actor value, one for increasing and one for decreasing, that the magic effect for increasing the actor value's... value does not work? The decreasing effect has the detrimental flag marked and it works perfectly but the increasing effect does nothing even though its effect appears in the status effects tab in game.As a test I flagged the increasing effect as detrimental and it worked for reducing the value but the second I remove that flag it no longer has any effect on the actor value. Also tried changing Effect Archetype to Peak Value Modifier but got the same results. Both effects are set to Value Modifier, Fire and Forget, and Self delivery; both are also applied by potions in game. Neither effects have any scripting attached to them as well as having the No Area flag.Ive been trying to figure this out for the last couple days so any help would be greatly appreciated.EDIT:At this point I have managed to get the value to increase by one increment of the effect (80 up to 81.2) but after that it stops increasing the value; I did this by applying the recovery flag. Will continue my mad science... Edited August 10, 2018 by adianda Link to comment Share on other sites More sharing options...
adianda Posted August 10, 2018 Author Share Posted August 10, 2018 Alright I solved my problem albeit in a very round-about way. I slightly modified a script I found online for applying Magic Effects over time via script and got it working for the most part. Doesn't increment values in a completely predictable way but it does the job for now.If anyone idea on how to increase an Actor Value PROPERLY without scripting using a Magic Effect I would love to know how you go about with your wizardry.I'd like to thank everyone on here for helping me out so quickly, honestly can't say thank you enough to you guys. Link to comment Share on other sites More sharing options...
Recommended Posts