Running scripts on projectile impact

  1. In projectiles.json add a projectile type with impact.scriptclasses
"type":"ak47",
"image":"ak47_idle.bani",
"arrow":"corleone_bullet1.png",
"zangle":0,
"speed":11,
"gravity":0,
"hittype":"bullet",
"damage":7,
"collidetiles":true,
"impact": {
    "scriptclasses": ["effect_fire"]
}
  1. In scriptclasses/effect_fire.js search for near players and call seteffect
function onCreated() {
    let players = Server.searchplayers({map:this.map, area:{x:this.x-2, y:this.y-2, w:4,h:4}});
    players.forEach(function(player) {
        player.seteffect(10, "hurt", {hp:1});
        player.aniarg1 = "effect_fire.bani";
    });
    this.destroy();
}

See the projectile impact effect in action: ProjectileFire.mp4