I'm currently working on zalcano's falling rock attack, and I've got most of it working however. I need to define the coordinates of the players that are being hit:
Code:
CycleEvent event = new CycleEvent() {
int rockTick = 0;
@Override
public void execute(CycleEventContainer container) {
Misc.shuffle(targets)
.stream()
.limit(20)
.forEach(plr -> {
System.err.println(rockTick);
final Location locs = plr.getLocation();
if (rockTick == 1) {
plr.asPlayer().getPA().createPlayersStillGfx(1727, plr.getX(), plr.getY(), 0, 0);
}
if (rockTick == 6) {
if (plr.getLocation().equalsIgnoreHeight(locs)) {
plr.appendDamage(Misc.random(1, 2), Hitmark.HIT);
}
}
});
if (rockTick >= 8) {
container.stop();
}
//container.setTick(1);
rockTick++;
}
};
What I colored out should take the players coordinate, however since we're looping their coordinates keep changing and thus players keep getting hit.
I've tried this:
Code:
CycleEvent event = new CycleEvent() {
int rockTick = 0;
@Override
public void execute(CycleEventContainer container) {
Misc.shuffle(targets)
.stream()
.limit(20)
.forEach(plr -> {
System.err.println(rockTick);
if (rockTick == 1) {
final Location locs = plr.getLocation();
}
if (rockTick == 2) {
plr.asPlayer().getPA().createPlayersStillGfx(1727, plr.getX(), plr.getY(), 0, 0);
}
if (rockTick == 6) {
if (plr.getLocation().equalsIgnoreHeight(locs)) {
plr.appendDamage(Misc.random(1, 2), Hitmark.HIT);
}
}
});
if (rockTick >= 8) {
container.stop();
}
//container.setTick(1);
rockTick++;
}
};
But I cannot open that final on tick 6 and it's now allowing me to make it public
I've been trial & erroring for over 4 hours now with no luck.
Also I can grab their location before the cycle event, however that will only grab the location of the NPC's target and not all the players that are gonna get hit resulting in everyone getting hit or no one getting hit (Depending if the actual targets stepping away or not)