Molotov

Name: Molotov
Type: Weapon
Author: John Doe
Description: Throws a grenade that explodes a few feet in front of them.
Notes: Required images and scripts are attached.

if (playertouchsme) { toweapons Molotov; hide; } if (weaponfired&&playerbombs>1) { if (playerdir=0) { hidesword 0.4; freezeplayer 0.4; play axe.wav; playersprite = 9; sleep 0.05; playersprite = 10; sleep 0.05; playersprite = 11; sleep 0.05; playersprite = 12; sleep 0.05; playersprite = 13; putnpc grenspin.gif,grenup.txt,playerx+0.5,playery-1; sleep 0.1; playersprite = 0;} if (playerdir=1) { hidesword 0.4; freezeplayer 0.4; play axe.wav; playersprite = 9; sleep 0.05; playersprite = 10; sleep 0.05; playersprite = 11; sleep 0.05; playersprite = 12; sleep 0.05; playersprite = 13; putnpc grenspin.gif,grenleft.txt,playerx-1.5,playery+1; sleep 0.1; playersprite = 0;} if (playerdir=2) { hidesword 0.4; freezeplayer 0.4; play axe.wav; playersprite = 9; sleep 0.05; playersprite = 10; sleep 0.05; playersprite = 11; sleep 0.05; playersprite = 12; sleep 0.05; playersprite = 13; putnpc grenspin.gif,grendown.txt,playerx+0.5,playery+2.5; sleep 0.1; playersprite = 0;} if (playerdir=3) { hidesword 0.4; freezeplayer 0.4; play axe.wav; playersprite = 9; sleep 0.05; playersprite = 10; sleep 0.05; playersprite = 11; sleep 0.05; playersprite = 12; sleep 0.05; playersprite = 13; putnpc grenspin.gif,grenright.txt,playerx+2.5,playery+1; sleep 0.1; playersprite = 0;}}

[attachment deleted by admin]

Re: Molotov

I advise against using this script, it's bad ]:

Re: Molotov

What, specifically? ???

Re: Molotov

The way it needs code for the seperate directions rather than using some math function and the way it uses putnpc, such an outdated command o:

Re: Molotov

Meh. I didn't script it, but it works. Would be written in such a simplistic form have any conflict with known bugs in Gserver?

it only showed the throw gani for the molotov or whatever and it didnt even explode-_-http://i8.photobucket.com/albums/a13/stonependant/unixico.png

holy shit are you blind! this thread is so dead its deader then dead. How the hell did you find this. Actually nm… I severly underestimate the powers of necroposters

You need the actual image, or you can make one yourself gasp.

Oooh, scarryyy! The script looks pointless, I’m sure of that.

For some reason an admin removed all of the attachments from Koroshiya’s NPC threads.

Making a molotov that you throw with a mouseclick between a minimum and maximum distance from the player could actually not be so hard to do.

Tricxta is gonna be mad :P[COLOR=“Silver”]

---------- Post added at 01:26 AM ---------- Previous post was at 12:21 AM ----------

[/COLOR]Done!

(What’s the tag for adding code??)


// NPC made by Fredi
if (playertouchsme){
toweapons Molotov
}

if (mousedown && isweapon) {
if (leftmousebutton && playerdarts>1 && playerbombs>2){
if (
((mousex < playerx+20 && mousex > playerx+7) ||
(mousex > playerx-20 && mousex < playerx-5)) ||
((mousey < playery+20 && mousey > playery+7) ||
(mousey < playery-5 && mousey > playery-20) ||
)
)
{
playersprite=2;
freezeplayer 1;
putexplosion 3,mousex,mousey;
playerbombs-=2;
playerdarts -=1;}
}
}

You tried, that’s what matters. Might I suggest you use a proper distance equation instead of your gross conditional.

this.distance = ((playerx+1.5-mousey)^2+(playery+2-mousey)^2)^0.5;

Implement that in your script and you’re off to a good start, I’d then suggest you acquaint yourself with ‘shoot’ projectiles, work out some trajectory angle and delay the explosion until the projectile lands at the valid point. I say all this, because at the moment your script is rather simple and boring(sorry) but with a few tweaks here and there, it could be something quite cool.

Also in reference to the original script, let it be known that using putnpc to place npcs in this senario is a bad idea as it can easily be avoided, putnpc should really only ever be used when there’s absolutely no alternative. I say this because it’s been known to crash servers with ease if a player chooses to team up with another and spam ‘putnpc’.

Haha don’t worry I know it’s fairly simple, it took me about 20 mins and I’ve almost never worked with mouseclicks and advanced scripting, it was more of a proof of concept that some simple and effective molotov could be done using mouseclick.

people have been doing point->click->explosion for ages, it’s called staff abuse.

But reborn has no server staff

Even worse, each server is independently staffed.

Click somewhere on screen, check if where you’ve clicked is within range, animation, explosions. Not hard at all.

holy fuck, this thread has been necro’d TWICE.

Who knows what other random potentially useful threads will rise from the dead next.

if (mousedown){
  this.ds = {mousex-playerx,playery-mousey};
  this.dist = (this.ds[0]^2+this.ds[1]^2)^0.5;
  this.ang = getangle(this.ds[0],-this.ds[1]);
  this.zang = pi/2 - (this.dist/64)*(pi/2);
  shoot playerx+0.5+cos(this.ang)*2,playery-sin(this.ang)*2,playerz,this.ang,this.zang,this.dist/16,testProj,;
}

Did some playing, as you shoot further away from your player the projectiles get less accurate. If anyone knows how you could trigger an event once the projectile has landed that’d be cool, you could then place an explosion, hence making a more realistic molotov. Also this gives me some pretty great inspiration for a quick artillery like server.