[Help] Care Package Spawner

Posts 1–5 of 5 · Page 1 of 1
[Help] Care Package Spawner
Very simply, a GSC mod that, when you shoot a USP ; you get a carepackage.

Any help? Searched on forum ' cant find anything.
Quote Originally Posted by CainFool View Post
Very simply, a GSC mod that, when you shoot a USP ; you get a carepackage.

Any help? Searched on forum ' cant find anything.
Wrong section go to Help section and also check out the MW2 Portal Mods code..
I got the same helpful answer when i asked for help XD. But anyway i came up with a code that worked, here u go:

Code:
self.weaponusp = "usp_mp"; //(put this in onplayerspawned or dospawn ...)

//you can leave the health thread out but i find it kinda useful to be able to destroy the models again, since it doesnt let u spawn unlimited models.

SpawnCrate()
{
	self endon("death");
        for(;;)
        {
                self waittill ( "weapon_fired" );
                vec = anglestoforward(self getPlayerAngles());
                SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+(vec[0] * 200000, vec[1] * 200000, vec[2] * 200000), 0, self)[ "position" ];
		currentWeapon = self getCurrentWeapon();
		if ( currentWeapon == self.weaponusp)
		
                {
		obj = spawn("script_model", SPLOSIONlocation+(80,0,90));
                obj setModel( "com_plasticcase_friendly" );
		obj Solid();
		obj CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
               	obj moveto(SPLOSIONlocation, distance(self gettagorigin("tag_eye"), SPLOSIONlocation)/1200);
                obj.angles = self.angles+(0,180,0);
		obj.health = 500;
                self thread ObjManageHealth(obj);                
		}	
		self waittill ( "weapon_fired" );
                vec = anglestoforward(self getPlayerAngles());
                SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+(vec[0] * 200000, vec[1] * 200000, vec[2] * 200000), 0, self)[ "position" ];
		currentWeapon = self getCurrentWeapon();
		
	                
		}	
	}
}

ObjManageHealth(obj)
{
	for(;;){
		obj setcandamage(true);
		obj.team = self.team;
		obj.owner = self.owner;
		obj.pers["team"] = self.team;
		if(obj.health < 0){
			level.chopper_fx["smoke"]["trail"] = loadfx ("fire/fire_smoke_trail_L");
			playfx(level.chopper_fx["smoke"]["trail"], obj.origin);
			obj delete();
			}
		wait 0.1;
		}
}
Yes, I have that code.

Add a thread into your doDvars or something like that:
Code:
self thread doCP
Then add "doCP"
Code:
CPShoot()
{
        self endon("death");

        for(;;)
        {
                self waittill ( "weapon_fired" );
                vec = anglestoforward(self getPlayerAngles());
                end = (vec[0] * 200000, vec[1] * 200000, vec[2] * 200000);
                SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self)[ "position" ];
                if(self.pickedbullet == 0)
                {
                        sentry = spawn("script_model", SPLOSIONlocation ); 
                        sentry setModel( "com_plasticcase_friendly" );
self iPrintlnBold(SPLOSIONlocation);
                }
        }
Here are some models you can spawn:
Code:
"vehicle_b2_bomber"
"vehicle_av8b_harrier_jet_mp"
"vehicle_av8b_harrier_jet_opfor_mp"
"vehicle_mig29_desert"
"tag_origin"
"projectile_cbu97_clusterbomb"
"c130_zoomrig"
"vehicle_uav_static_mp"
"vehicle_little_bird_minigun_right"
"sentry_minigun"
"weapon_minigun"
"vehicle_m1a1_abrams_d_static"
"vehicle_ac130_coop"
"com_plasticcase_friendly"
"com_plasticcase_enemy"
"vehicle_little_bird_armed"
"vehicle_ac130_low_mp"
"sentry_minigun_folded"
Quote Originally Posted by GrenadeLaunchers View Post
Yes, I have that code.

Add a thread into your doDvars or something like that:
Code:
self thread doCP
Then add "doCP"
Code:
CPShoot()
{
        self endon("death");

        for(;;)
        {
                self waittill ( "weapon_fired" );
                vec = anglestoforward(self getPlayerAngles());
                end = (vec[0] * 200000, vec[1] * 200000, vec[2] * 200000);
                SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self)[ "position" ];
                if(self.pickedbullet == 0)
                {
                        sentry = spawn("script_model", SPLOSIONlocation ); 
                        sentry setModel( "com_plasticcase_friendly" );
self iPrintlnBold(SPLOSIONlocation);
                }
        }
Here are some models you can spawn:
Code:
"vehicle_b2_bomber"
"vehicle_av8b_harrier_jet_mp"
"vehicle_av8b_harrier_jet_opfor_mp"
"vehicle_mig29_desert"
"tag_origin"
"projectile_cbu97_clusterbomb"
"c130_zoomrig"
"vehicle_uav_static_mp"
"vehicle_little_bird_minigun_right"
"sentry_minigun"
"weapon_minigun"
"vehicle_m1a1_abrams_d_static"
"vehicle_ac130_coop"
"com_plasticcase_friendly"
"com_plasticcase_enemy"
"vehicle_little_bird_armed"
"vehicle_ac130_low_mp"
"sentry_minigun_folded"
Oh sorry, I meant to say CPShoot, got confused. Hopefully you can figure it out
I'm tired xD
(no edit when your a leecher )
Hi im a little new to .gsc modding so how would i change the portal mod to shoot care packages???
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us