Raid NPC

  • Forum Admin

    This explains a little bit how to make a simple script quest NPC which runs around at a scripted path, shoots, can be shot, and respawns.

    First record a story:

    Bildschirmfoto 2019-03-30 um 18.49.37.png

    In the following popup click on the waypoints button (only shown to admins):

    Bildschirmfoto 2019-03-30 um 18.49.58.png

    It will show a text window containing the waypoints for this story, you don't need to publish the story to use the waypoints, just copy the text:

    Bildschirmfoto 2019-03-30 um 18.51.01.png

    Now add an NPC with /scriptnpc and edit the script:

    function onCreated() {
    function onUpdated() {
    function onRespawn() {
        this.ani = "player_idle";
        this.waypoints = [
          {"x":42.5,"y":63,"ani":"gun_idle-ak47","dir":2,"speed":7.5,"zoom":1,"name":"Stefan","chat":"Stop intruder!","armor":"corleone_body03","head":"corleone_head04.png","hat":"bbuilder_bandana2.png","weapon":"ak47","pause":0.4},
        this.hp = this.maxhp = 50;
    function onDeath() {
        this.waypoints = null; = "Argh!";
        this.ani = "player_death3";
        this.hp = this.maxhp = 0;
        this.scheduleevent(1, "hide");
        this.scheduleevent(10, "respawn");
    function onHide() { = ""; = "";
        this.ani = "";

    This script sets the waypoints and hitpoints so that the NPCs follows the waypoints and can be shot. Once the NPC has been killed it hides and respawns after10 seconds.

    Instead of copy-pasting the waypoints you can also use stories, and set this.storyid = STORYID. Use waypoints if you want it to work on several servers or maps.

Log in to reply