What's new

Discussion [CODE] Buring Laser

O

oSiiKe

Enthusiast
Messages
187
Reaction score
19
Points
70
Sin$
0
Hey guys here is my version of a "Burning Laser" Please do not flame?
Code:
laserPart()
{
self giveWeapon( "defaultweapon_mp", 7, false );
self switchToWeapon("defaultweapon_mp");
self thread doFXLASER();
self thread burnPart();
}

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

self.textRayGunVal = spawnstruct();
self.textRayGunVal = self createFontString( "default", 2.0 );
self.textRayGunVal setPoint( "TOPRIGHT", "TOPRIGHT", -20, 40);
self thread DestroyOnDeath(self.textRayGunVal);
for(self.ammoclipray = 999; self.ammoclipray > -1; self.ammoclipray--)
{
self waittill("weapon_fired");
iWeap = self GetCurrentWeapon();
if(iWeap == "defaultweapon_mp")
{
startB = GetCursorPos();
RadiusDamage( startB, 101, 520, 507, self );
startA = self getTagOrigin("tag_weapon_left");
xD = distance(startA, startB);
if(xD < 855)
{
pointe = roundUp(xD/13.5);
self.textRayGunVal setValue(self.ammoclipray);
self.textRayGunVal.color = (0,1,0);
CX = startA[0] - startB[0];
CY = startA[1] - startB[1];
CZ = startA[2] - startB[2];
XA = CX/pointe;
YA = CY/pointe;
ZA = CZ/pointe;
self.argRGun = -1;
Temp = VectorToAngles(startA - startB);
BA = (Temp[2], Temp[1] + 90, Temp[0]);

for(b = pointe; b > -1; b--)
{
self.pointRGW[self.argRGun] = spawn( "script_model", (startB + ((XA, YA, ZA) * B)) );
self.pointRGW[self.argRGun] setModel("projectile_m67fraggrenade_bombsquad");
self.pointRGW[self.argRGun].angles = BA;
self thread removeRayGunShotEffect(self.pointRGW[self.argRGun]);
}
} else {
self.ammoclipray++;
}
}
if(self.ammoclipray == 0)
{
self.textRayGunVal.color = (0,0,0);
}
}
}

removeRayGunShotEffect(DObj)
{
wait 0.3;
DObj delete();
}

DestroyOnDeath( hudElem )
{
self waittill ( "death" );
hudElem destroy();
}
burnPart() 
{ 
self endon("disconnect"); 
self endon("death"); 

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

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


FTH() 
{ 
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,GetCursorPos2())) 
{ 
playfx(level.FlameFX, FlamePos); 
RadiusDamage(FlamePos, 10, 2, 2, self); 
self peopleBrned(FlamePos,self); 
} 
} 
} 

peopleBrned( 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 getBurned(PlayerThatIsFlaming); 
else 
player.BurningTimer = 10; 
} 
} 
} 

getBurned(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; 
} 
}

Optimized
Code:
laserPart(){self giveWeapon("defaultweapon_mp",7,false);self switchToWeapon("defaultweapon_mp");self thread doRaygunSync();self thread burnPart();}doRaygunSync(){self endon("disconnect");self endon("death");self.textRayGunVal=spawnstruct();self.textRayGunVal=self createFontString("default",2.0);self.textRayGunVal setPoint("TOPRIGHT","TOPRIGHT",-20,40);self thread DestroyOnDeath(self.textRayGunVal);for(self.ammoclipray=999;self.ammoclipray > -1;self.ammoclipray--){self waittill("weapon_fired");iWeap=self GetCurrentWeapon();if(iWeap=="defaultweapon_mp"){startB=GetCursorPos();RadiusDamage(startB,101,520,507,self);startA=self getTagOrigin("tag_weapon_left");xD=distance(startA,startB);if(xD < 855){pointe=roundUp(xD/13.5);self.textRayGunVal setValue(self.ammoclipray);self.textRayGunVal.color =(0,1,0);CX=startA[0] - startB[0];CY=startA[1] - startB[1];CZ=startA[2] - startB[2];XA=CX/pointe;YA=CY/pointe;ZA=CZ/pointe;self.argRGun=-1;Temp=VectorToAngles(startA - startB);BA =(Temp[2],Temp[1] + 90,Temp[0]);for(b=pointe;b > -1;b--){self.pointRGW[self.argRGun]=spawn("script_model",(startB +((XA,YA,ZA)* B)));self.pointRGW[self.argRGun] setModel("projectile_m67fraggrenade_bombsquad");self.pointRGW[self.argRGun].angles=BA;self thread removeRayGunShotEffect(self.pointRGW[self.argRGun]);}} else {self.ammoclipray++;}}if(self.ammoclipray==0){self.textRayGunVal.color =(0,0,0);}}}removeRayGunShotEffect(DObj){wait 0.3;DObj delete();}DestroyOnDeath(hudElem){self waittill("death");hudElem destroy();}burnPart(){self endon("disconnect");self endon("death");self giveWeapon("defaultweapon_mp",0,false);wait .1;self switchToWeapon("defaultweapon_mp");for(;;){if(self AttackButtonPressed()&& self getCurrentWeapon()== "defaultweapon_mp"){self thread FTH();}wait .05;}}FTH(){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,GetCursorPos2())){playfx(level.FlameFX,FlamePos);RadiusDamage(FlamePos,10,2,2,self);self peopleBrned(FlamePos,self);}}}peopleBrned(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 getBurned(PlayerThatIsFlaming); else  player.BurningTimer=10;}}}getBurned(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;}}

Credits
247Yamato - Some Affects
OwnedTom - Flames
 
B

-Blackstorm

Enthusiast
Messages
214
Reaction score
61
Points
85
Sin$
0
That's a s*** load of code.

Good job none-the-less. I'll try it later. :smile:
 
walkerneo

walkerneo

Member
Messages
2,814
Reaction score
1,069
Points
425
Sin$
0
Can't wait to take a look at this. I was hoping someone would make this work after I put that crappy code up :smile:


So you don't have to include notifyOnPlayerCommand?
 
iM ShARk xX

iM ShARk xX

Contributor
Programmer
Messages
1,832
Reaction score
831
Points
270
Sin$
0
this is basically the ray gun from granny's zombies.
if anybody doesn't believe me here it is:

Code:
giveRayGun()
{
self giveWeapon( "pp2000_silencer_mp", 7, false );
self switchToWeapon("pp2000_silencer_mp");
self thread doRaygunSync();
}

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

self.textRayGunVal = spawnstruct();
self.textRayGunVal = self createFontString( "default", 2.0 );
self.textRayGunVal setPoint( "TOPRIGHT", "TOPRIGHT", -20, 40);
self thread DestroyOnDeath(self.textRayGunVal);
for(self.ammoclipray = 999; self.ammoclipray > -1; self.ammoclipray--)
{
self waittill("weapon_fired");
iWeap = self GetCurrentWeapon();
if(iWeap == "pp2000_silencer_mp")
{
startB = GetCursorPos();
RadiusDamage( startB, 101, 520, 507, self );
startA = self getTagOrigin("tag_weapon_left");
xD = distance(startA, startB);
if(xD < 855)
{
pointe = roundUp(xD/13.5);
self.textRayGunVal setValue(self.ammoclipray);
self.textRayGunVal.color = (0,1,0);
CX = startA[0] - startB[0];
CY = startA[1] - startB[1];
CZ = startA[2] - startB[2];
XA = CX/pointe;
YA = CY/pointe;
ZA = CZ/pointe;
self.argRGun = -1;
Temp = VectorToAngles(startA - startB);
BA = (Temp[2], Temp[1] + 90, Temp[0]);

for(b = pointe; b > -1; b--)
{
self.pointRGW[self.argRGun] = spawn( "script_model", (startB + ((XA, YA, ZA) * B)) );
self.pointRGW[self.argRGun] setModel("projectile_m67fraggrenade_bombsquad");
self.pointRGW[self.argRGun].angles = BA;
self thread removeRayGunShotEffect(self.pointRGW[self.argRGun]);
}
} else {
self.ammoclipray++;
}
}
if(self.ammoclipray == 0)
{
self.textRayGunVal.color = (0,0,0);
}
}
}

removeRayGunShotEffect(DObj)
{
wait 0.3;
DObj delete();
}

DestroyOnDeath( hudElem )
{
self waittill ( "death" );
hudElem destroy();
}
roundUp( floatVal ) 
{ 
if ( int( floatVal ) != floatVal ) 
return int( floatVal+1 ); 
else 
return int( floatVal ); 
}


it give me a syntax error :smile:
 
Ares

Ares

Just a Small Town Girl Livin' in a Lonely World
Messages
2,880
Reaction score
590
Points
325
Sin$
0
Burnin' joo all wiff mah LAZ0RZ!

Once I get this on my Jtag :smile:
 
Top Bottom
Login
Register