Check if there's a monster on given coordinates

All resolved question will be found here. It is recommended that you browse / search through this section first and see if your question has been answered before

Moderators: Moderators, Documentation Writers

Message
Author
nousername
Noob
Noob
Posts: 2
Joined: 07 Feb 2011, 20:56
Noob?: No

Check if there's a monster on given coordinates

#1 Post by nousername »

Is there a way to check if theres a monster at (x, y) using @eval()?
It would be something like $::field->isWalkable($x, $y), but for monsters instead of blocks.

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: Check if there's a monster on given coordinates

#2 Post by EternalHarvest »

Something like

Code: Select all

List::MoreUtils::any { $_->{pos}{x} == $x && $_->{pos}{y} == $y } @{$monstersList->getItems}

Locked