-
Member
actor.SummonerAcdDynamicId check
hello
i want to use different decorators for actors summoned by different monsters
how to create a condition to tell if an actor with a unique "SummonerAcdDynamicId" present on screen more then once (to count same and separate one actors from another) ?
or is it possible to tell if an actor summoned by "rare" or "champion" ?
-
Legendary
Originally Posted by
JohnWick
i want to use different decorators for actors summoned by different monsters
You could do it with a dictionary to store the different SummonerAcdDynamicId that you find by associating each one to a decorator.
Originally Posted by
JohnWick
or is it possible to tell if an actor summoned by "rare" or "champion" ?
Directly it doesn't seem possible but it does occur to me to do it indirectly using SummonerId. There is a problem: I can be wrong but it seems that it is bugged or limited by efficiency issues and it does not work with actors other than players, it would need to work with elites at least
Last edited by RNN; 11-03-2020 at 06:52 PM.
-
Member
Originally Posted by
RNN
You could do it with a dictionary to store the different SummonerAcdDynamicId that you find by associating each one to a decorator.
Directly it doesn't seem possible but it does occur to me to do it indirectly using SummonerId. There is a problem: I can be wrong but it seems that it is bugged or limited by efficiency issues and it does not work with actors other than players, it would need to work with elites at least
In a while I post a code here to show how I would do it.....
Plugins\RNN\
Summoned.cs
Hello, RNN, thank you for response
I guess i've done bad job explaining myself
Elite enemies with waller affix, creates walls, which has different time of existence, depending on if summoner is rare or champion
My goal is to set correct timers for different walls actors
Champion create one actor at a time for 4 seconds
Rare create more then one actor at a time for 5 seconds
All "_monsteraffix_waller_model" actors created by certain rare elite has same "SummonerAcdDynamicId" and same "Summoned_By_ACDID"
So my though was to check if there is more then one wall actor on screen with same "SummonerAcdDynamicId" or "Summoned_By_ACDID" then we can safely assume that it was summoned by rare elite and assign different decorator for it
Smt like that to check for it
var SummonedBy = actor.GetAttributeValue(Hud.Sno.Attributes.Summoned_By_ACDID,226808);
But i dont know how to create function to count and separate them
-
Legendary
You can use GroupBy
Code:
foreach (var WallerGroup in Hud.Game.Actors.Where(a => a.SnoActor.Sno == ActorSnoEnum._monsteraffix_waller_model).GroupBy(x => x.SummonerAcdDynamicId))
{
//var SummAcdDId = WallerGroup.Key;
var Counter = WallerGroup.Count(); // WallerGroup.Key found WallerGroup.Count() times
var Duration = (Counter > 1)? 5 : 4 ; // if == 1 -> 4 sec (champion) , if > 1 -> 5 sec (rare)
foreach (var Waller in WallerGroup)
{
// Decorator for actor Waller and duration "Duration"
}
}
Simple example:
Code:
using Turbo.Plugins.Default;
using System.Linq;
namespace Turbo.Plugins.RNN
{
public class wallerplugin : BasePlugin, IInGameTopPainter
{
public IFont DefaultFont { get; set; }
public wallerplugin()
{
Enabled = true;
}
public override void Load(IController hud)
{
base.Load(hud);
DefaultFont = Hud.Render.CreateFont("tahoma", 8f, 250, 0, 250, 0, false, false, 250, 0, 0, 0, true);
}
public void PaintTopInGame(ClipState clipState)
{
if (clipState != ClipState.BeforeClip) return;
if (!Hud.Game.IsInGame) return;
var actors = Hud.Game.Actors.Where(a => a.SnoActor.Sno == ActorSnoEnum._monsteraffix_waller_model);
if (actors.Any())
{
var i = 0;
foreach (var WallerGroup in actors.GroupBy(x => x.SummonerAcdDynamicId))
{
DefaultFont.DrawText(DefaultFont.GetTextLayout( "SummonerAcdDynamicId " + WallerGroup.Key + " Found " + WallerGroup.Count() + " Times"), 800 , 200 + i * 20);
i++;
foreach (var Waller in WallerGroup)
{
DefaultFont.DrawText(DefaultFont.GetTextLayout( (WallerGroup.Count() == 1)? "Champion":"Rare"), Waller.FloorCoordinate.ToScreenCoordinate().X , Waller.FloorCoordinate.ToScreenCoordinate().Y);
}
}
}
}
}
}
Last edited by RNN; 11-03-2020 at 05:58 PM.
-
Post Thanks / Like - 1 Thanks
JohnWick (1 members gave Thanks to RNN for this useful post)
-
Member
Perfect, thank you very much )