maxarturo Posted April 14, 2019 Share Posted April 14, 2019 Is there a way to make this simple Script to exclude followers from taking damage. I'm thinking that players might be annoyed - dissatisfied if they end up with their followers killed. ( the script does damage to all Actors - attached to a trap meant for the Boss ). The only alternative way i came up in doing this, is to make a script with 16 Actors Ref ( for all foes Actors + Player ). Scriptname aXMDdamageActorsHealthOnEnter01 extends ObjectReference {Damage all Actors Health Value OnTriggerEnter} Event OnTriggerEnter(ObjectReference triggerRef) if triggerRef as actor && !(triggerRef as actor).isDead() if !(triggerRef as actor).DamageActorValue("Health", 500.0) endif EndIf EndEvent Many thanks in advance !. Link to comment Share on other sites More sharing options...
Evangela Posted April 14, 2019 Share Posted April 14, 2019 Alter it a bit and use this: if triggerRef as Actor == TRUE && (triggerRef as Actor).isPlayerTeammate() == FALSE Link to comment Share on other sites More sharing options...
maxarturo Posted April 14, 2019 Author Share Posted April 14, 2019 (edited) Thanks Rasikko. Is this tested ? i'm just asking because right now is a big trouble for me to load a save to test it. Plus i don't have not a single follower mod installed. Edited April 14, 2019 by maxarturo Link to comment Share on other sites More sharing options...
Evangela Posted April 14, 2019 Share Posted April 14, 2019 No, but logically speaking, it'll run if the reference is an actor and the actor is not a follower of any sort. Link to comment Share on other sites More sharing options...
maxarturo Posted April 14, 2019 Author Share Posted April 14, 2019 Ok, i keep that in mind, thanks again !. Link to comment Share on other sites More sharing options...
ReDragon2013 Posted April 14, 2019 Share Posted April 14, 2019 Maybe a bit too much, who knows. aXMDdamageActorsHealthOnEnter01 Scriptname aXMDdamageActorsHealthOnEnter01 extends ObjectReference {Damage Actors Health} ; use a triggerBox and calling OnTriggerEnter() ; https://forums.nexusmods.com/index.php?/topic/7567737-script-alternative/ ; -- EVENT -- EVENT OnTriggerEnter(ObjectReference triggerRef) IF (triggerRef as Actor) ELSE RETURN ; - STOP - no actor, no damage ENDIF ;--------------------- IF (triggerRef as Actor).IsDead() RETURN ; - STOP - dead actor, no health left ENDIF ;--------------------- myF_DamageActor(triggerRef as Actor, 500.0) ENDEVENT ; -- FUNCTION -- ;--------------------------------------------- FUNCTION myF_DamageActor(Actor aRef, Float fD) ;--------------------------------------------- IF aRef.IsPlayerTeammate() RETURN ; - STOP - actor is players teammate, as Rasikko posted ENDIF ;--------------------- float f = aRef.GetActorValue("Health") ; get current value of health IF (aRef == Game.GetPlayer()) aRef.DamageActorValue("Health", f / 2) ; 50 percent damage ELSE aRef.DamageActorValue("Health", fD) ENDIF ENDFUNCTION Link to comment Share on other sites More sharing options...
Evangela Posted April 15, 2019 Share Posted April 15, 2019 Ok, i keep that in mind, thanks again !.I'll say this in a different way: isPlayerTeammate() is the way to go for what you're wanting to do with the trigger. For actual followers and those functioning as followers but not "officially made" a follower, if that makes sense. I did not test because I didn't have patience to go acquire a follower, and even moreso jump through all the hoops to create one. Link to comment Share on other sites More sharing options...
maxarturo Posted April 15, 2019 Author Share Posted April 15, 2019 (edited) Ok, i keep that in mind, thanks again !.I'll say this in a different way: isPlayerTeammate() is the way to go for what you're wanting to do with the trigger. For actual followers and those functioning as followers but not "officially made" a follower, if that makes sense. I did not test because I didn't have patience to go acquire a follower, and even moreso jump through all the hoops to create one. It does makes complete sense and i did changed the line as you suggested.By "keep in mind" i meant that when i'll do my final complet testing ( install the mod - load save with fully modded game ) if something goes wrong with followers in this particularly cell, i'll know what it meight be. I also meant that is been added to my notebook as a reminder among the other things in there for final testing and checking, and due to the size of the mod when that time arrives i'll have forgotten this particular issue if not noted. Thanks again !. Edited April 15, 2019 by maxarturo Link to comment Share on other sites More sharing options...
Recommended Posts