What's new

Discussion [Release] Flamethrower

  • Thread starter OwnedTom
  • Start date
  • Views 1,976
OwnedTom

OwnedTom

Enthusiast
Messages
955
Reaction score
322
Points
145
Sin$
0
So I haven't seen any flamethrower's for mw2 released in the modding section. I did search and noticed there was one that looked good by killingdyl but I could not find the code for it so I decided to make my own.

Features
  • Does not go through walls for added realism.
  • When someone is burnt by the flamthrower they catch on fire and burn for 10 seconds.

Known Issues
  • The game may crash if you have more than 2 people using this at the same time.

Video


Code
Code:
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
#include common_scripts\utility;

init()
{
level thread onPlayerConnect();

level.FlameFX = loadfx("fire/tank_fire_engine");
}

onPlayerConnect()
{
for(;;)
{
level waittill( "connected", player );

player thread onPlayerSpawned();
}
}

onPlayerSpawned()
{
self endon( "disconnect" );

for(;;)
{
self waittill( "spawned_player" );
self thread GiveFlameThrower();
self.Burning = 0;
self.BurningTimer = 10;
}
}

GiveFlameThrower()
{
self endon("disconnect");
self endon("death");

self giveWeapon("striker_mp", 0, false );
wait .1;
self switchToWeapon("striker_mp");

for(;;)
{
if (self AttackButtonPressed() && self getCurrentWeapon() == "striker_mp")
{
self thread Flame();
}
wait .05;
}
}

Flame()
{
self endon("disconnect");
self endon("death");

CurrentPos = self getTagOrigin("j_spine4");
vec = anglestoforward(self getPlayerAngles());

for(i = 0; i < 20; i++)
{
vec2 = vector_scal(vec, (30*i)+60);
FlamePos = CurrentPos + vec2;

if (distance(CurrentPos,FlamePos) < distance(CurrentPos,GetCursorPos()))
{
playfx(level.FlameFX, FlamePos);
RadiusDamage(FlamePos, 10, 2, 2, self);
self BurnPeople(FlamePos,self);
}
}
}

BurnPeople( Pos, PlayerThatIsFlaming )
{
self endon("disconnect");
self endon("death");

foreach(player in level.players)
{
DamageRadius = distance(Pos,player.origin);
if(DamageRadius < 40)
{
if (player.Burning == 0)
player thread OnFire(PlayerThatIsFlaming);
else
player.BurningTimer = 10;
}
}
}

OnFire(Flamer)
{
self endon("disconnect");
self endon("death");

self.Burning = 1;
self.BurningTimer = 10;
while (self.Burning == 1)
{
if (self.BurningTimer > 0)
{
playfx(level.FlameFX, self gettagorigin("j_spine4"));
RadiusDamage(self.origin, 10, 2, 2, Flamer);
self.BurningTimer--;
}
else
{
self.Burning = 0;
}
wait 1;
}
}


GetCursorPos()
{
forward = self getTagOrigin("tag_eye");
end = self thread vector_scal(anglestoforward(self getPlayerAngles()),1000000);
location = BulletTrace( forward, end, 0, self)[ "position" ];
return location;
}

vector_scal(vec, scale)
{
vec = (vec[0] * scale, vec[1] * scale, vec[2] * scale);
return vec;
}
 
ModzillaModz

ModzillaModz

Banned
Messages
1,294
Reaction score
119
Points
165
Sin$
0
Damn! That looks sick as hell I'm starting up my TAG right now. :wink:
 
Tergat

Tergat

Here's looking at you, kid
Services Grammar Nazi Jokester
Messages
2,370
Reaction score
816
Points
310
Sin$
7
Looks goood

But the hitmarker noise would piss me off...
 
S

Seighten

Enthusiast
Seasoned Veteran
Messages
945
Reaction score
97
Points
115
Sin$
7
This would be so dope for zombies, but the hit markers are pissing me off
 
Top Bottom
Login
Register