Best Implementation of Self-Targeted Skills #6019
Replies: 2 comments 2 replies
-
I feel like changing targetfind to allow self for targeting with a new flag (or perhaps no new flag?) is probably the way to go The only caveat I could see is "what if the mob dies during the ability and its the first target" |
Beta Was this translation helpful? Give feedback.
-
A little late post but this older PR might be of relevance. #5745 |
Beta Was this translation helpful? Give feedback.
-
Posting this as a discussion since Zach asked for it here.
I fixed the ability of mobs to use self-targeted skills regardless of initial target being out of range (IE: Self-Destruct - Even if a player runs out of range while the skill is readying, the skill should still go off and the bomb would still blow up). Everything is tested and working as expected now, but I have some questions since this needs to go up to LSB.
This is a bit tricky to explain, but basically because of skills that cause the mob to die (Self-Destruct, Meltdown, Thermal Combustion, etc...) are doing so within the skill script with
mob:setHP(0)
, I am forced to call theluautils::OnMobWeaponSkill()
function on itself (See Code Segment Below) otherwise, the mob wouldn't die when it should be. In doing so, this causes an additional check to be needed within the mob script where aif mob ~= target
check before applying additional effects (like stuns) and damage from happening on the mob itself.Referenced Code Segment:
self-destruct.lua Update:
I can get around this by hard-coding the skill ID's that do insta-kill the mob into core (As much as I hate to do that, there is already hard-coded things within that same file for certain families and a specific skillID for ix'ion). If I do it this way, I can get around having to call
OnMobWeaponSkill
on itself and this all becomes a nil issue.Depending on how the above handled, I would have to either update each self-kill skill script to remove the
mob:setHP(0)
since its handled in core -OR- any skill that makes use of the new flag (ALWAYS_FIRE) would need to be updated in the skill script to check for theif mob ~= target
so that the skill is not inflicting damage or status effects on the actual mob (the case where the original target has moved out of range of the skill and now its callingOnMobWeaponSkill
on itself)Hard-coding is the "easy" way to do it since there is a limited number of skillID's that kill the mob, but this also means that if SE ever comes up with a new self-kill skill, then it has to go into core and not the mob script. The alternative is leaving things as is, but it would require checks on the mob skill scripts that are self-targeted and would be a decent amount of file changes.
Updating the one skill script has the effect of updating all associated skills (IE: Multiple skill ID's for self-destruct_1 - So its entirely feasible to just update the associated skills on this front.
However, the number of non-kill skills that are self targeted (such as Typhoon, Thunderbolt, etc..) that don't kill the mobs would also have to be updated since the skill script is potentially being called on itself.
Ex: If the initial target for thunderbolt manages to get out of range before it fires, the skill script it being called on the mob and that skill then needs to have the check to prevent the skill from stunning/damaging the mob as well. So the number of self-targeted skills is greater than the number of just self-killing skills that could be hard-coded.
In theory, its probably better if nothing is hard-coded in core (even if there is already stuff hard coded), but the work of updating each skill is also ten-fold in comparison.
Additionally, the
mob_skill_flag
values in the database would also need to be updated to use this new flag (in addition to figuring out which skills should fire regardless of targets in range).So, while I have the core fix ready, I am not sure which is the best way to implement this
Hard Code Self-Death Skills vs Update Mob Script files?
What should go into the initial PR for this?
Just the core changes?
DB updates and Skill Script Updates in another?
Everything all in one?
Beta Was this translation helpful? Give feedback.
All reactions