Jump to content

[LE] Issue with overpowered player and enchantment's script.


maxarturo

Recommended Posts

Hi everybody.


I discovered this issue about a week ago with my "Singularity Bolt", but only the last couple of days i've been trying to fix, but... i'm stuck !... mainly cause i'm so tired, lately i've been working long hours...


The issue:

If the player is overpowered he can kill with one shot of his crossbow the enemy and the bolt's enchantment script won't fire, or the whole enchantment won't fire.

* Other than this "Overpowered Plyer" issue the whole thing is working as it suppose to.


Set Up:

- The projectile has an explosion

- The explosion has an enchantment

- The enchantment has a magic effect

- And the magic effect has the SIngularity Script


This is a simple script:



Scriptname aXMDdwarvenXcrossbowBoltFx extends activemagiceffect
{Script for the Dwarven X Singularity Bolt}

Float Property DispelDelay Auto
Float Property fDamage Auto
{The Singularity's damage}
Actor Property PlayerREF Auto
Float Property SeekRange Auto
Float Property TransSpeed Auto
Explosion Property SinExploIN Auto
Explosion Property SinExploOUT Auto
Ammo Property Xbolt Auto


Event OnEffectStart(Actor akTarget, Actor akCaster)
Actor AActor = Game.FindRandomActorFromRef(akTarget, SeekRange)
Actor BActor = Game.FindRandomActorFromRef(akTarget, SeekRange)
Actor CActor = Game.FindRandomActorFromRef(akTarget, SeekRange)
akTarget.PlaceAtMe(SinExploIN, 1)
If AActor
If ( AActor.IsDead() == False ) && ( AActor.isHostileToActor(PlayerREF))
AActor.TranslateToRef(akTarget, TransSpeed)
EndIf
EndIf
If BActor
If ( BActor.IsDead() == False ) && ( BActor.isHostileToActor(PlayerREF))
BActor.TranslateToRef(akTarget, TransSpeed)
EndIf
EndIf
If CActor
If ( CActor.IsDead() == False ) && ( CActor.isHostileToActor(PlayerREF))
CActor.TranslateToRef(akTarget, TransSpeed)
EndIf
EndIf
Utility.Wait(0.5)
akTarget.PlaceAtMe(SinExploOUT, 1)
akTarget.DamageActorValue("Health", fDamage)
If ( AActor.isHostileToActor(PlayerREF))
AActor.DamageActorValue("Health", fDamage)
EndIf
If ( BActor.isHostileToActor(PlayerREF))
BActor.DamageActorValue("Health", fDamage)
EndIf
If ( CActor.isHostileToActor(PlayerREF))
CActor.DamageActorValue("Health", fDamage)
EndIf
RegisterForSingleUpdate(DispelDelay)
EndEvent


Event OnUpdate()
Dispel()
EndEvent



* The singularity bolt will on impact explode destabilizing the singularity which will pull towards it random foes and explode again with devastating force doing extra damage to the initial target and to the other targets it pulled towards it, at the same time the singularity explosion will knock down all targets around its radius and cause damage by instant combustion which last only a few seconds.


Those 3 versions of bolts are quite expensive to forge and to buy them from the only merchant that sells them, so if you are overpowered the singularity becomes useless.

I NEED TO FIX THIS SOMEHOW !!!!.


* Ticking the "No Death Dispel" does absolutely NOTHING to the Enchantment's Magic Effect.


Thank you very much for reading all this and for your time.

Link to comment
Share on other sites

Hmm.. look at next code, maybe an issue with "Game.FindRandomActorFromRef()" and I use an array to hold all actors

 

aXMDdwarvenXcrossbowBoltFx

 

Scriptname aXMDdwarvenXcrossbowBoltFx extends ActiveMagicEffect  
{Script for the Dwarven X Singularity Bolt}
; https://forums.nexusmods.com/index.php?/topic/9326813-issue-with-overpowered-player-and-enchantments-script/

  Explosion PROPERTY SinExploIN  auto
  Explosion PROPERTY SinExploOUT auto

  Ammo PROPERTY Xbolt auto                ; UnUSED by default

  Float PROPERTY SeekRange   auto
  Float PROPERTY TransSpeed  auto
  Float PROPERTY DispelDelay auto
  Float PROPERTY fDamage     auto        ; {The Singularitys damage}

  Actor[] a        ; will be assigned by runtime


; -- EVENT --
 
EVENT OnEffectStart(Actor akTarget, Actor akCaster)
    myF_FindEnemies(akTarget)

; place explosion near the target
    akTarget.PlaceAtMe(SinExploIN, 1)        ; first explosion target only

    myF_TranslateEnemies(akTarget, akCaster)
    Utility.Wait(0.5)

    akTarget.PlaceAtMe(SinExploOUT, 1)        ; second explosion target + enemies nearby the target

    myF_DamageEnemies(akTarget)
    Utility.Wait(DispleDelay)
    
    self.Dispel()
ENDEVENT


; -- FUNCTIONs -- 3

;---------------------------------------
FUNCTION myF_FindEnemies(Actor akTarget)  ; find other npc by random around the target with given range
;---------------------------------------
    a = new Actor[3]            ; init array
    actor aRef

; fill entries
    a[0] = Game.FindRandomActorFromRef(akTarget, SeekRange)        ; 1
;---
    aRef = Game.FindRandomActorFromRef(akTarget, SeekRange)        ; 2
    IF ( aRef )
        IF (aRef == a[0]) || (aRef == akTarget)
        ELSE
            a[1] = aRef        ; second actor
        ENDIF
    ENDIF
;---
    aRef = Game.FindRandomActorFromRef(akTarget, SeekRange)        ; 3
    IF ( aRef )
        IF (aRef == a[0]) || (aRef == a[1]) || (aRef == akTarget)
        ELSE
            a[2] = aRef        ; third actor
        ENDIF
    ENDIF
ENDFUNCTION


;----------------------------------------------------------
FUNCTION myF_TranslateEnemies(Actor akTarget, Actor player)  ; we assume akCaster is the player
;----------------------------------------------------------
int i = 0
    WHILE (i < 3)
        actor aRef = a[i]        ; get npc
        IF ( aRef )
            IF aRef.IsDead()
                a[i] = None                        ; remove script persistence of actor (dead npc)
            ELSEIF aRef.IsHostile(player)
                aRef.TranslateToRef(akTarget, TransSpeed)
            ELSE
                a[i] = None                        ; remove script persistence of actor (friendly to player)
            ENDIF
        ENDIF
        i = i + 1
    ENDWHILE
ENDFUNCTION


;-----------------------------------------
FUNCTION myF_DamageEnemies(Actor akTarget)
;-----------------------------------------
     akTarget.DamageActorValue("Health", fDamage)

int i = 0
    WHILE (i < 3)
        actor aRef = a[i]
        IF ( aRef )
             aRef.DamageActorValue("Health", fDamage)
             aRef = None
             a[i] = aRef                           ; remove actor persistence by script
        ENDIF
        i = i + 1
    ENDWHILE
ENDFUNCTION

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

Thanks ReDragon2013 for your reply.


The issue is not with the script but with the fact that the "Projectile's Explosion Enchantment" just won't fire if you kill with one shot the actor (overpowered player).


The script was the first thing that i tweak, i even remove everything from it and just place a Debug.Notification, the script as you saw is a very simple one to be able to cause any issue.


Things are narrowing down a lot, unfortunately since the only way to attach a script to a "Projectile" (bolt or arrow) is through the Enchantment placed on the Explosion, there isn't an abundance of options and none of the existing events are helping also.


* I still have a couple of things i want to try before giving up.


* I fear that this is one of those occasions where you just hit a WALL... !



Thank you very much for your interest my friend, and as always right to the point.

Link to comment
Share on other sites

Capture the current HP of the initial target then limit the projectile's damage to not exceed that value. It's a cheaty workaround but the player won't notice because the secondary explosive will finish the kill. Worth a shot at least.

I'm not aware of a good way to do that dynamically.

 

However, I wonder how the Dawnguard exploding bolts are done, and if they have the same issue. If not, you could perhaps borrow from that implementation.

Link to comment
Share on other sites

*shrug* Explosion-on-hit is a rather finicky feature. I was looking at Auriel's special arrows to figure out why my throwing potion bottles kept failing to explode unless they hit human instead of any impact type. I ended up just copying an existing Impact data set.

 

I suppose he could set the bolt damage to 0 and mod the damage via script. Throwing out ideas might help him come up with a workaround.

Link to comment
Share on other sites

@ Shadohz

Thanks, but your proposal is not feasible, even if you lower the 'Bolt's' damage the issue remains, the issue is the player's output damage that is reflected in his upgraded crossbow and armor's enchantments.


@ foamyesque

Yes, the Dawnguard exploding bolts have the same issue.


* I still have a couple of things to experiment with, but whenever i've the time and i'm in the mood for it...

After years of working in this project, i currently am in a state that i can't even look at the CK's desktop icon, i'm kind of fed up with it...


Thank you both very much for your interests.

Link to comment
Share on other sites

I ran across another suggestion someone made to selectively debuff the player using a custom perk but for the life of me I can't remember where I saw. One of the downsides of a privacy browser. No history. Sorry I couldn't help.

 

Not a problem my friend, all opinions are more than welcome.
Let me rephrase:
Is not feasible inside the parameters i want it to, this means that the solution must include editing ONLY the projectile and its components and nothing else.
It can be done, one way is by having the payer in an 'Alias' in any of my quests or make a new quest just for this.
- then run an "OnObjectEquipped()" event and check for a "Crossbow" equipped, bla... bla... etc.
- then run an "GetActorValue()" function and "GetLevel()", run a comparison to a pre measured 'Overpowered Kill', bla... bla... etc.
- then according to your result / returned value you will add to the player the corresponding debuff perk, bla... bla... etc.
And although this can do the job, from my point of view it's an "Overkill" and a very ugly workaround.
I as a player wouldn't like having a mod that silently intervince in such a way with my game !, so this approach is a big no no for me.
Have a nice weekend.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...