Script file (place in User\OSBot\Scripts\):
https://www.sendspace.com/file/bo4giu
Source:
Code:
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.List;
/**
* Created by HaiderPC on 16-4-2016.
*/
@ScriptManifest(name = "NpcSpawnDumper", author = "Poesy700", version = 1.0, info = "", logo = "http://i.imgur.com/36i4Y6m.png")
public class NpcSpawnDumper extends Script {
private ArrayList<Integer> dumpedSpawns = new ArrayList<Integer>();
@Override
public void onStart() {
// walking.webWalk(Banks.FALADOR_EAST.getRandomPosition());
}
@Override
public int onLoop() throws InterruptedException {
List<NPC> nigga = getNpcs().getAll();
for (NPC n : nigga) {
dumpNPC(n);
}
return 100;
}
public boolean dumpNPC(NPC n) {
try {
if (dumpedSpawns.contains(n.getIndex()))
return false;
if (n.getId() == -1)
return true;
int npcId = n.getId();
int x = n.getX();
int y = n.getY();
int z = n.getZ();
int direction = n.getRotation()/512;
File f = new File("C:\\Users\\HaiderPC\\Documents\\spawns", "spawns.txt");
BufferedWriter w = new BufferedWriter(new FileWriter(f, true));
textOnLine(w, "{");
textOnLine(w, "\"id\": "+npcId+",");
textOnLine(w, "\"position\": {");
textOnLine(w, "\"x\": "+x+",");
textOnLine(w, "\"y\": "+y+",");
textOnLine(w, "\"z\": "+z);
textOnLine(w, "},");
textOnLine(w, "\"direction\": "+direction+",");
textOnLine(w, "\"random-walk\": false,");
textOnLine(w, "\"walk-radius\": 0");
textOnLine(w, "},");
w.flush();
w.close();
dumpedSpawns.add(n.getIndex());
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
public void textOnLine(BufferedWriter w, String line) throws Exception {
w.write(line);
w.newLine();
}
}