What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

WiN

Member
Joined
Sep 2, 2014
Messages
294
Reaction score
15
I am trying to update the Summon Spectre routine to be a bit more specific - i.e. target only certain mobs, not just anything in range. I have tried messing with using target.Name in the where, but it doesn't like that - any advise on how to go about this in a better way?

private Monster BestDeadTarget
{
get
{
var myPos = LokiPoe.Me.Position;
return LokiPoe.ObjectManager.GetObjectsByType<Monster>()
.Where(
m =>
// m.Distance < 30 && m.IsActiveDead && target.Name == "Stygian Revenant" && m.CorpseUsable &&
m.Distance < 30 && m.IsActiveDead && m.Rarity != Rarity.Unique && m.CorpseUsable &&
 
1) It's not the whole code.
2) Use FirstOrDefault instead of Where.
 
1) It's not the whole code.
2) Use FirstOrDefault instead of Where.

Yep, so you can nullcheck it afterwards. FoD() returns either an object or null.

also, your linq reference is "m" and you use "target.Name", should be "m.Name"
 
Back
Top