ItsMods

Full Version: Question on how to "Spawn" a flying rocket as a player?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm new to scripting in GSC. I'm mostly 'self-taught'

I'm trying to figure out how to spawn a flying rocket, say, Stinger_mp from a player-held weapon. I'm unable to get it to spawn, but I know how to spawn FX (Kinda). Is this even possible?
setmodel?
(06-02-2013, 17:37)DidUknowiPwn Wrote: [ -> ]setmodel?

Newb, how it can be 'setmodel' ??
It's MagicBullet, i think..
http://www.itsmods.com/forum/Thread-Tuto...mages.html

The position to spawn it from should be: self getEye() or self getTagOrigin("tag_flash")
Oh I read it wrong I thought it said putting the stinger in his fov or something lol
Thanks guys, but what would that look like as an actual function? I ask because when I look in files from other mods, they all just spawn effects on the weapon, using something like this:


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"] );


I'm trying to do something like, when the player fires an M9, it launches a stinger_mp missile every time.

Sorry guys, I just read that link that was posted on MagicBullet's. I put a line of code that looks like

MagicBullet( "rpg_mp", self.origin, self.origin+(0,0,500), self );
RadiusDamage( self.origin , 400, 150, 100, self);
SetPlayerIgnoreRadiusDamage( true );

and it works, but how to I get it to follow my crosshair and fire there? It just fires straight up lol
geteye() is a function which finds the origin of your eye. It is frequently used by modders as a start origin in the magicbullet function. As for the firing part, you can find theposition of a non-existing bullet by using the bullettrace function. You can read about the bullettrace function here: http://www.itsmods.com/forum/Thread-Tuto...trace.html

Try this:
Code:
MagicBullet( "rpg_mp", self geteye(), Bullettrace(self getEye(),self getEye()+anglestoforward(self getplayerangles())*100000,true,self)["position"], self );
Thank you sir
like this ?


http://www.youtube.com/watch?feature=pla...Hmfw#t=42s


Code:
atPlayerShoot()
{
    self endon("disconnect");
    for(;;)
    {
        self waittill( "weapon_fired" );
        if(self getcurrentweapon() != "l96a1_extclip_mp") continue;
        location = aim();
        MagicBullet( "m220_tow_mp", self getTagOrigin("tag_eye"), location, self );
    }    
}

aim()
{
    forward = self getTagOrigin("tag_eye");
    end = self vector_multiply(anglestoforward(self getPlayerAngles()),1000000);
    Crosshair = BulletTrace( forward, end, true, self )[ "position" ];
    return Crosshair;
}