Quest Helper Basic
AdvancedOverlayA basic quest helper that highlights NPCs and objects needed for quests. Demonstrates quest state tracking.
22 min read
What It Does
A basic quest helper that highlights NPCs and objects needed for quests. Demonstrates quest state tracking.
Source Code
java
1package com.example;
2
3import net.runelite.api.Client;
4import net.runelite.api.NPC;
5import net.runelite.api.TileObject;
6import net.runelite.client.ui.overlay.Overlay;
7import net.runelite.client.ui.overlay.OverlayManager;
8import net.runelite.client.plugins.Plugin;
9import net.runelite.client.plugins.PluginDescriptor;
10import javax.inject.Inject;
11import java.awt.*;
12
13@PluginDescriptor(
14 name = "Quest Helper Basic",
15 description = "Highlights quest NPCs/objects"
16)
17public class QuestHelperPlugin extends Plugin {
18 @Inject
19 private Client client;
20
21 @Inject
22 private OverlayManager overlayManager;
23
24 private final int[] questNPCs = {1234, 5678}; // Example NPC IDs
25 private final int[] questObjects = {12345}; // Example object IDs
26
27 private final Overlay overlay = new Overlay() {
28 @Override
29 public Dimension render(Graphics2D graphics) {
30 // Highlight quest NPCs
31 for (NPC npc : client.getNpcs()) {
32 if (npc.getId() != -1) {
33 for (int questNPC : questNPCs) {
34 if (npc.getId() == questNPC) {
35 Point pos = npc.getCanvasLocation();
36 if (pos != null) {
37 graphics.setColor(Color.CYAN);
38 graphics.drawOval(pos.x - 20, pos.y - 20, 40, 40);
39 }
40 }
41 }
42 }
43 }
44
45 return null;
46 }
47 };
48
49 @Override
50 protected void startUp() {
51 overlayManager.add(overlay);
52 }
53
54 @Override
55 protected void shutDown() {
56 overlayManager.remove(overlay);
57 }
58}Code Annotations
Line 22
Array of quest NPC IDs
Line 23
Array of quest object IDs
Line 29
Iterate through all NPCs
Line 35
Highlight matching NPCs
API Classes Used
Key Concepts
- •Array of quest NPC IDs
- •Array of quest object IDs
- •Iterate through all NPCs
- •Highlight matching NPCs
Next Steps
- Learn about quest state API
- Add quest step tracking
- Add quest completion detection