PDA

View Full Version : GS2 Equiv of exploded?


scriptless
10-11-2014, 02:22 AM
Okay so in GS1 there was a event for when an object is exploded by a classic bomb.

if (exploded)
{
}

I don't see one in GS2 tho... is there any way to still detect if it was hit by a bomb's explosion?

Crow
10-11-2014, 08:25 AM
Are default bombs even still working/supported? I suggest making your own, to be honest.

scriptless
10-11-2014, 09:40 AM
Are default bombs even still working/supported? I suggest making your own, to be honest.

They do still work and are supported. I agree should make your own and I do have my own. But my own still makes an explosion and that explosion is still not detectable. On top of that you cannot name your npc's Bomb, or Bow. Because doing so wont work as the default systems will override them and cause some pretty epic failures in some cases. =/

Edit: thanks deas.. aparently onExploded() works.. but it's clientside only.. and it doesnt show up in /scripthelp in rc.. o.O

xAndrewx
10-11-2014, 01:42 PM
Makes sense, all bombs are client based.

Jakov_the_Jakovasaur
10-11-2014, 02:21 PM
if you have scripted your own bomb, why not script your own explosion as well?

MysticalDragon
10-12-2014, 01:01 AM
Would be really easy to do then you can control the radius of your bomb detection.


this.radius = 3;
function onExplode2() {
attackObjects(this.x+1.5 ,this.y+1.5, this.radius);
putNPC2(this.x - 0.8, this.y - 0.6, "join explosion;"); //Animation of your explosion
}

function attackObjects(tx,ty,radius) {
for (temp.obj: findareanpcs(tx-radius,y-radius,radius*2,radius*2)) {
temp.npcdist = ((this.x+1.5-tx)^2 + (this.y+2-ty)^2) ^ 0.5;
temp.obj.trigger("attack", "explosion" , this.owner , this.damage - int(temp.dist)); //Trigger NPCs hit by explosion
}


for (temp.pl: findnearestplayers(tx,ty)) {
temp.dist = ((temp.pl.x+1.5-tx)^2 + (temp.pl.y+2-ty)^2) ^ 0.5;
if (temp.dist >= radius)
break;
if (temp.pl != this.owner || level.isnopkzone != true){
temp.pl.onHit(this.owner.account , this.damage - int(temp.dist), "explosion"); //Hit Players (Damage Depending on how close to center of the blast)
}
}
}