Post: Ray Gun Code Problem
04-03-2011, 07:31 PM #1
.Pluto
Splicer
(adsbygoogle = window.adsbygoogle || []).push({}); i added this code to my patch and when i click it nothing happens (its 247yamatos code):
    
main()
{
level.raygunWeapon = "pp2000_eotech_mp";

level.raygunFX["laser"] = loadFX( "misc/aircraft_light_wingtip_green" );
level.raygunFX["impact"] = loadFX( "misc/flare_ambient_green" );

level.FX_count = 0;

level thread onPlayerConnected();
}

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

player thread doRaygun();
}
}

doRaygun()
{
for( ;; )
{
self waittill( "weapon_fired", weaponName );

if( self getCurrentWeapon() != level.raygunWeapon )
continue;

start = self getTagOrigin( "tag_eye" );
end = self getTagOrigin( "tag_eye" ) + vecscale( anglestoforward( self getPlayerAngles() ), 100000 );
trace = bulletTrace( start, end, true, self );

thread doLaserFX( self getTagOrigin( "tag_eye" ), anglestoforward( self getPlayerAngles() ), trace["position"] );
}
}

doLaserFX( startPos, direction, endPos )
{
doDamage = 1;

for( i = 1; ; i ++ ) //start from 1 because 0 is the player origin
{
pos = startPos + vecscale( direction, i * 150 ); //how far the bullet goes every "refresh"

if( distance( startPos, pos ) > 9000 ) //it's over 9000!. If the bullet goes too far it vanishes. No FX and no explosion, so no damage.
{
doDamage = 0;
break;
}

trace = bulletTrace( startPos, pos, true, self );

if( !bulletTracePassed( startPos, pos, true, self ) )
{
impactFX = spawnFX( level.raygunFX["impact"], bulletTrace( startPos, pos, true, self )["position"] );
level.FX_count ++;
triggerFX( impactFX );

wait( 0.2 );

impactFX delete();
level.FX_count --;

break;
}

laserFX = spawnFX( level.raygunFX["laser"], pos ); //this is the "main" laser effect, the central one, this isn't affected by the FX limit
level.FX_count ++;
triggerFX( laserFX );

laserFX thread deleteAfterTime( 0.1 );

if( level.FX_count < 200 ) //if there are too many FX's, the following ones don't spawn.
{
//FX's spawned around the "main" FX with a randomly distance, to make it look cooler Winky Winky
for( j = 0; j < 3; j ++ )
{
laserFX = spawnFX( level.raygunFX["laser"], pos + (randomInt( 50 ) / 10, randomInt( 50 ) / 10, randomInt( 50 ) / 10) - vecscale( direction, i * randomInt( 10 ) * 3 ) );
level.FX_count ++;
triggerFX( laserFX );

laserFX thread deleteAfterTime( 0.05 + randomInt( 3 ) * 0.05 );
}
}

wait( 0.05 );
}

if( doDamage )
self radiusDamage( endPos, 300, 150, 20, self );
}

deleteAfterTime( time )
{
wait( time );

self delete();
level.FX_count --;
}

vecscale( vec, scalar )
{
return ( vec[0] * scalar, vec[1] * scalar, vec[2] * scalar );
}
(adsbygoogle = window.adsbygoogle || []).push({});
04-03-2011, 09:00 PM #2
havoc undead
Do a barrel roll!
because you have to give the weapon
04-03-2011, 10:00 PM #3
daswiftguy
Since 2008
lol

The message you have entered is too short lolz
04-03-2011, 10:33 PM #4
.Pluto
Splicer
Originally posted by havoc
because you have to give the weapon


um how? Dancing
04-03-2011, 10:40 PM #5
with this code

self giveWeapon("pp2000_eotech_mp",0,false);

Or,

self giveWeapon("level.raygunWeapon",0,false);
04-03-2011, 10:44 PM #6
.Pluto
Splicer
Originally posted by Killer1478 View Post
with this code

self giveWeapon("pp2000_eotech_mp",0,false);

Or,

self giveWeapon("level.raygunWeapon",0,false);


what part of the code? lol not good.
04-03-2011, 11:14 PM #7
havoc undead
Do a barrel roll!
Originally posted by .Pluto View Post
what part of the code? lol not good.


just do

    giveRayGun()
{
self giveWeapon("pp2000_eotech_mp",0,false);
}


thread that in the menu so once you get the pp2000 it will be the ray gun
04-03-2011, 11:55 PM #8
.Pluto
Splicer
Originally posted by havoc
just do

    giveRayGun()
{
self giveWeapon("pp2000_eotech_mp",0,false);
}


thread that in the menu so once you get the pp2000 it will be the ray gun

dude lol im not good with this will you put it in and give me the code? lol, talked to you on sins Winky Winky

---------- Post added at 07:55 PM ---------- Previous post was at 07:24 PM ----------

Originally posted by havoc
just do

    giveRayGun()
{
self giveWeapon("pp2000_eotech_mp",0,false);
}


thread that in the menu so once you get the pp2000 it will be the ray gun

i did that it gave me the pp2000 but when i shot it was normal Winky Winky
04-04-2011, 12:09 AM #9
havoc undead
Do a barrel roll!
Originally posted by .Pluto View Post
dude lol im not good with this will you put it in and give me the code? lol, talked to you on sins Winky Winky

---------- Post added at 07:55 PM ---------- Previous post was at 07:24 PM ----------


i did that it gave me the pp2000 but when i shot it was normal Winky Winky


did you thread the ray gun functions to?
04-04-2011, 11:06 AM #10
.Pluto
Splicer
Originally posted by havoc
did you thread the ray gun functions to?

yes just give me the one thats in your patch Winky Winky

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo