JPTR1 Posted November 27, 2021 Share Posted November 27, 2021 (edited) Hello,i would need a reliable triggerzone(firetrap) to kill an NPC, no matter which Level, which resistences, it has. If i use the "DB10FireDamageTriggerBox" for example, its not able to kill my enemy at high levels, and on low levels it dies to fast, same for the player. Now i found this script, seems to have a constant percentage damage output, ignoring armor and resistences, which is perfect, but it only affects the player.Is there any chance to let this script affect the NPC only and ignore the player? Scriptname MansionLightDamageScript extends ObjectReference{the trigger that deals damage to the player if they are in the light}; false = minimum damage; true = maximum damageBOOL PROPERTY maxDmg AUTOEFFECTSHADER PROPERTY effect AUTOINT INTRIGGER=0EVENT ONTRIGGERENTER(objectreference ref)IF(ref as ACTOR == game.getPlayer())INTRIGGER += 1effect.play(game.getPlayer())while(INTRIGGER > 0)IF(maxDMG)game.getPlayer().damageAV("health", (game.getPlayer().getBaseAV("health") * 0.2))ELSEIF(maxDMG == FALSE)game.getPlayer().damageAV("health", (game.getPlayer().getBaseAV("health") * 0.05))ENDIFutility.wait(0.5)endWHILEeffect.stop(game.getPlayer())ENDIFENDEVENTEVENT ONTRIGGERLEAVE(objectreference ref)IF(ref as ACTOR == game.getPlayer())INTRIGGER -= 1ENDIFENDEVENT Edited November 27, 2021 by JPTR1 Link to comment Share on other sites More sharing options...
ReDragon2013 Posted December 4, 2021 Share Posted December 4, 2021 (edited) jptLightDamageTriggerScript Scriptname jptLightDamageTriggerScript extends ObjectReference {trigger that deals damage to any actor if they are in the light} ; https://forums.nexusmods.com/index.php?/topic/10771768-need-this-damage-script-to-affect-enemies-not-only-the-player/ EffectShader PROPERTY effect auto ; shader effect to play Bool PROPERTY maxDmg auto ; [default=False], minimum damage, set TRUE for maximum damage FormList PROPERTY ActorList auto ; a new created formlist with CreationKit to check for multiple actors in a light triggerbox Bool bRunning ; [default=False] ; -- EVENTs -- EVENT OnCellAttach() bRunning = TRUE ; *T* gotoState("Action") ; ### STATE ### RegisterForSingleUpdate(1.0) ENDEVENT EVENT OnCellDetach() bRunning = False ; *** UnRegisterForUpdate() gotoState("") ; ### STATE ### ActorList.Revert() ; clear any script added entry ENDEVENT ;========================== State Action ;=========== EVENT OnUpdate() WHILE (bRunning) ; outer loop int i = 0 WHILE (i < ActorList.GetSize()) ; inner loop actor aRef = ActorList.GetAt(i) as Actor IF ( aRef ) float f = aRef.GetBaseActorValue("health") IF ( maxDMG ) f = f * 0.2 ELSE f = f * 0.05 ENDIF aRef.DamageActorValue("health", f) ENDIF i = i + 1 ENDWHILE ; i* Utility.Wait(0.5) ; cooldown time ENDWHILE ; o* ENDEVENT EVENT OnTriggerEnter(ObjectReference triggerRef) IF (triggerRef as Actor) ; https://www.creationkit.com/index.php?title=AddForm_-_FormList Effect.Play(triggerRef) ActorList.AddForm(triggerRef as Form) ENDIF ENDEVENT EVENT OnTriggerLeave(ObjectReference triggerRef) IF (triggerRef as Actor) ; https://www.creationkit.com/index.php?title=RemoveAddedForm_-_FormList ActorList.RemoveAddedForm(triggerRef as Form) Effect.Stop(triggerRef) ENDIF ENDEVENT ;======= endState Keep in mind this is a concept. You have to try it is working for your purpose! And you have to create an empty formlist with the creation kit, that can be used to fill the script property ActorList !! Edited December 9, 2021 by ReDragon2013 Link to comment Share on other sites More sharing options...
JPTR1 Posted December 8, 2021 Author Share Posted December 8, 2021 Thanks a lot ReDragon! I will check this out. Link to comment Share on other sites More sharing options...
ReDragon2013 Posted December 9, 2021 Share Posted December 9, 2021 Sorry I mad a mistake in my code. Please check my first posting here again! State Action ; some code inside endState Link to comment Share on other sites More sharing options...
Recommended Posts