Bullet Fire Effect
Running scripts on projectile impact
- In projectiles.json add a projectile type with impact scriptclasses, such as:
{
"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"]
}
}
- Create the file
effect_fire.js
inscriptclasses/
for the Script-Repository, search for nearby players and call seteffect for each player:
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: