Files

71 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# npc.js — main() (satır 39)
[← npc.js](index.md) · [← Master](../../wiki.md)
Parça 1/2 · [sonraki](main-2.md)
```javascript
function main(c)
{
var player = c.getSubject();
if (!player) return;
// Mappet Chat trigger mesajı extra value olarak gelir ("getMessage" YOK).
var msg = c.getValue("message");
if (!msg) return;
msg = String(msg).trim();
if (msg === "Asker!")
{
c.cancel();
var n = spawnGuards(c, 1);
mappet.set("hector_mode", "follow");
mappet.set("hector_follow_active", true);
startLoop(c);
player.send(n + " muhafız çağrıldı. Takip AKTİF.");
return;
}
if (msg === "Ordu!")
{
c.cancel();
var n = spawnGuards(c, ORDU_SAYISI);
mappet.set("hector_mode", "follow");
mappet.set("hector_follow_active", true);
startLoop(c);
player.send(n + " muhafızlık ORDU çağrıldı. Takip AKTİF.");
return;
}
if (msg === "Takip!")
{
c.cancel();
mappet.set("hector_mode", "follow");
mappet.set("hector_attack_target", null);
mappet.set("hector_follow_active", true);
player.send("Takip sistemi AKTİF.");
startLoop(c);
return;
}
if (msg === "Dur!")
{
c.cancel();
mappet.set("hector_follow_active", false);
player.send("Takip sistemi DURDURULDU.");
return;
}
// Dağıl! -> muhafızlar serbestçe gezinir (silmez)
if (msg === "Dağıl!" || msg === "Dolaş!")
{
c.cancel();
mappet.set("hector_mode", "wander");
mappet.set("hector_follow_active", true);
startLoop(c);
player.send("Muhafızlar dağılıp serbestçe geziniyor.");
return;
}
```