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-04-2011, 12:53 PM #11
247Yamato
< ^ > < ^ >
:\ And why dont you ask me???

In _missions.gsc, in Init(), thread function: main(), and then do what they said there(give weapon). Is not so complex, O.o¡

The one of Havoc undead patch was made by 4FunPlayin.
04-04-2011, 08:39 PM #12
havoc undead
Do a barrel roll!
Originally posted by 247Yamato View Post
:\ And why dont you ask me???

In _missions.gsc, in Init(), thread function: main(), and then do what they said there(give weapon). Is not so complex, O.o¡

The one of Havoc undead patch was made by 4FunPlayin.

actually it was re written but the base yes was from 4FunPlayin
04-04-2011, 10:13 PM #13
put the code i told you

level waittill( "connected", player );
<HERE>
player thread doRaygun();

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo