MadRabbitX Posted December 15, 2016 Share Posted December 15, 2016 (edited) Hello there. I'm trying to make a script based mod, and i have some trouble with it. I need to know when NPCs around player are being hit. The only way i found is too complicated, and quite inaccurate, so i'm asking for your help. Maybe there is a faster, and more accurate way that i don't know about. They way that i'm doing it right now, is when player enter the combat, i'm getting NPCs form player's combat group, then register them for OnHit event. To make sure that any new hostiles, that enter a combat after player, will be registered, i have to run a really short timer (right now it's 10s), then re-register every single NPC, if tragets count was changed. I think that you already can see why i don't want to use this method, but my main issue with this, is that i can't register friendly NPCs (i need to know even if two friendly NPCs are fighting each other).Do you have any ideas about that? I would be glad for any help that i can get, and if you can point me towards some code that i can study, that would be really helpful too. Thank you in advance. Edited December 15, 2016 by MadRabbitX Link to comment Share on other sites More sharing options...
Lisselli Posted December 16, 2016 Share Posted December 16, 2016 Perhaps you can work with FindAllReferencesWithKeyword and GetAllCombatTargets. Both are array functions. Link to comment Share on other sites More sharing options...
MadRabbitX Posted December 17, 2016 Author Share Posted December 17, 2016 Thank you for your answer! As i said, i already was using GetAllCombatTargets, so it's no use to me, but FindAllReferencesWithKeyword is actually what i was looking for, thanks.I actually remember the old way of doing that (i was using it back in Oblivion days), which is casting a spell with big AoE from player, after which you can work with NPCs that where hit with that spell. But FindAllReferencesWithKeyword already doing what i need without any shenanigans with spells and magick effects. Link to comment Share on other sites More sharing options...
Lisselli Posted December 20, 2016 Share Posted December 20, 2016 (edited) Ok good, and yeah I read that, but I tried my hand at it by grabbing all combat targets and storing them to an array variable to "do things later", but that required some advanced array work, I'm not familiar with yet(basically swapping between two arrays). Edited December 20, 2016 by Lisselli Link to comment Share on other sites More sharing options...
Recommended Posts