Nexusmodsaccountno2 Posted December 30, 2018 Share Posted December 30, 2018 I want to make a weapon that heals the player's combat target. Setignorefriendlyhits seems the best way to do this but that function requires a reference to work right? Actorref.Setignorefriendlyhits 1 I want to be able to heal any actor, so how do I set up the script so all actors everywhere ignore a friendly hit and don't get aggroed at the player for trying to heal them? Link to comment Share on other sites More sharing options...
Radioactivelad Posted January 1, 2019 Share Posted January 1, 2019 (edited) I don't have an answer, but I do have a lead you can investigate. The Groovatron uses a "weapon" to trigger effects on NPCs without turning them hostile. How ever it's done there should be adequate for your Medic Gun. Edited January 1, 2019 by Radioactivelad Link to comment Share on other sites More sharing options...
dubiousintent Posted January 1, 2019 Share Posted January 1, 2019 Looking at how other mods handle a similar situation is a useful idea. There is the mod "Medicine Gun George - NPC Healing Medical Rifle", which uses two different types of ammo to put the "patient" to "sleep" (probably "unconscious" by way of zero fatigue) before healing, then different ammo to "wake them up". The mod "Heal Others" or the related "Heal Others - Craftable" uses "aid items" such as a stim-pack instead of a weapon. It's my understanding that, as stated, your goal of a script affecting ALL actors is unobtainable. The best you could do would be to affect all the actors in the current cell, but there isn't a built-in function for that. (You would have to build an array of all the actor references in the cell whenever the cell loads, and then apply your desired effect to each ref in the array.) But for your purposes, that wouldn't work out either. In order for someone to "Ignore friendly hits", they first have to be a member of a "faction" which is friendly to the "player faction". And if they are "friendly", then they aren't going to be "hostile" in the first place. It would appear what is needed in order to use the specific "Setignorefriendlyhits" function is an "object effect" to the weapon's projectile which then set the actor into a special faction which is already "friendly", then inflict the "healing" damage, and finally remove them from that special faction (perhaps after the "effect duration"). -Dubious- Link to comment Share on other sites More sharing options...
yummy2 Posted January 1, 2019 Share Posted January 1, 2019 Shameless plug but I made a gun that had exactly this: https://www.nexusmods.com/newvegas/mods/66111The ionic scrambler ammo heals companions and does not aggro neutrals, but knock down hostiles. Feel free to rip out the code and change the actor filtering conditions however you need. The gun does it by ref walking but for your purpose, GetCombatAllies should be enough. Link to comment Share on other sites More sharing options...
Nexusmodsaccountno2 Posted January 1, 2019 Author Share Posted January 1, 2019 Thanks all for the helpful advice. I looked at the groovatron code...that is some complex scripting right there...From what I can tell it seems to have a mix of things happening. Stopcombat Seems to be in there but it won't quite work for what I want. There is some faction changing and other stuff that I have no idea what it is doing. I'll check out those other mods and see if I can make some sense of what is going on, thanks for the leads. I considered listing each and every actorref.setignorefriendlyhits to get the job done...there are only what, a couple hundred actors to list right...heh. Link to comment Share on other sites More sharing options...
Recommended Posts