Release [GSC/Source] Martyrdom + Force Prone [Players Functions]

Harry

Software Engineer
Premium Member
Messages
1,267
Points
748
Here's some BO2 GSC Functions I re-made in a couple of minutes from other games.
Not hard, and I haven't seen them posted before, so Merry Early Christmas.

Martyrdom
- Makes an explosion when you die.
Call like:
::Martyrdom, player); //on a player
::Martyrdom, self); //on yourself

Code:
Martyrdom(player)
{
    if(!player.Martyrdom)
    {
        player endon("disconnect");
        level endon("disconnect");
        player endon("End_Martyrdom");
        player iPrintln("Martyrdom ^2On");
        player.Martyrdom = true;
        for(;;)
        {
            if(!player.MartyrdomSpawn)
            {
            player waittill("death");
            player ExplodeClient();
            player.MartyrdomSpawn = true;
            player waittill("spawned_player");
            player.MartyrdomSpawn = false;
            }
        }
        wait 0.1;
    }
    else
    {
        player notify("End_Martyrdom");
        player iPrintln("Martyrdom ^1Off");
        player.Martyrdom = false;
    }
}

ExplodeClient()
{
    self.exp = spawn("script_model",self.origin);
    self.exp playSound("exp_barrel");
    Playfx(level.chopper_fx["explode"]["small"], self.origin);
    Playfx(level.chopper_fx["explode"]["small"], self.origin+(0,0,30));
    RadiusDamage(self.origin,500,500,500);
    wait 0.1;
    self.exp delete();
}

Force Prone - Forces a Player into Prone and wont let them out
Call like:
::initForceProne, player); //on a player
::initForceProne, self); //on yourself
::FPAll); //All Players

Code:
initForceProne(player) //The initial function
{
    if(player.Prone == 0 && !player isHost())
    {
    self iprintln(player.name+ " is ^2being^7 Force Proned :D");
    player.Prone = 1;
    player ForceProne();
    }
    else
    {
    player.Prone = 0;
    player notify("StopPronePlayer");
    self iprintln(player.name+ " is ^1not^7 being Force Proned");
    }
}
    
FPAll() //All Players
{
foreach(player in level.players)
    {
    if(player.Prone == false && !player isHost())
    {
        player thread ForceProne();
        player.Prone = true;
        player iPrintln("All Players are ^2being^7 Force Proned :D");
    }
    else
    {
        player notify("StopPronePlayer");
        player.Prone = false;
        player iPrintln("All Players are ^1not^7 being Force Proned");
    }
    }
}

ForceProne() //The function
{
    self endon("StopPronePlayer");
    for(;;)
    {
        if(!self.CurrStance)
            {
            self setstance("prone");
            self.CurrStance = true;
            wait .04;
        }
    self.CurrStance = false;
    }
    wait 0.1;
}
 

DF_AUS

Head Moderator
Staff member
Head Staff Team
Donator
Messages
571
Points
453
Here's some BO2 GSC Functions I re-made in a couple of minutes from other games.
Not hard, and I haven't seen them posted before, so Merry Early Christmas.

Martyrdom
- Makes an explosion when you die.
Call like:
::Martyrdom, player); //on a player
::Martyrdom, self); //on yourself

Code:
Martyrdom(player)
{
    if(!player.Martyrdom)
    {
        player endon("disconnect");
        level endon("disconnect");
        player endon("End_Martyrdom");
        player iPrintln("Martyrdom ^2On");
        player.Martyrdom = true;
        for(;;)
        {
            if(!player.MartyrdomSpawn)
            {
            player waittill("death");
            player ExplodeClient();
            player.MartyrdomSpawn = true;
            player waittill("spawned_player");
            player.MartyrdomSpawn = false;
            }
        }
        wait 0.1;
    }
    else
    {
        player notify("End_Martyrdom");
        player iPrintln("Martyrdom ^1Off");
        player.Martyrdom = false;
    }
}

ExplodeClient()
{
    self.exp = spawn("script_model",self.origin);
    self.exp playSound("exp_barrel");
    Playfx(level.chopper_fx["explode"]["small"], self.origin);
    Playfx(level.chopper_fx["explode"]["small"], self.origin+(0,0,30));
    RadiusDamage(self.origin,500,500,500);
    wait 0.1;
    self.exp delete();
}

Force Prone - Forces a Player into Prone and wont let them out
Call like:
::initForceProne, player); //on a player
::initForceProne, self); //on yourself
::FPAll); //All Players

Code:
initForceProne(player) //The initial function
{
    if(player.Prone == 0 && !player isHost())
    {
    self iprintln(player.name+ " is ^2being^7 Force Proned :D");
    player.Prone = 1;
    player ForceProne();
    }
    else
    {
    player.Prone = 0;
    player notify("StopPronePlayer");
    self iprintln(player.name+ " is ^1not^7 being Force Proned");
    }
}
  
FPAll() //All Players
{
foreach(player in level.players)
    {
    if(player.Prone == false && !player isHost())
    {
        player thread ForceProne();
        player.Prone = true;
        player iPrintln("All Players are ^2being^7 Force Proned :D");
    }
    else
    {
        player notify("StopPronePlayer");
        player.Prone = false;
        player iPrintln("All Players are ^1not^7 being Force Proned");
    }
    }
}

ForceProne() //The function
{
    self endon("StopPronePlayer");
    for(;;)
    {
        if(!self.CurrStance)
            {
            self setstance("prone");
            self.CurrStance = true;
            wait .04;
        }
    self.CurrStance = false;
    }
    wait 0.1;
}
I like your codes Harry :grinning: so i decided to clean them up a little :grinning: thank me later sunshine :wink:

Prones:
Code:
initForceProne(player) //The initial function
{
   if(!player isHost())
   {
       if(!isDefined(player.Prone))
        {
            self iprintln(player.name+ " is ^2being^7 Force Proned :D");
            player.Prone = true;
            player thread ForceProne();
        }
        else
        {
            player.Prone = undefined;
            player notify("StopPronePlayer");
           player setstance("stand");
            self iprintln(player.name+ " is ^1not^7 being Force Proned");
       }
    }
   else
       self iprintln("^1Cannot Use On Host Player");
}

FPAll() //All Players
{
   foreach(player in level.players)
    {
       if(!isDefined(player.drop) && !player isHost())
        {
           player thread ForceProne();
            player.drop = true;
        }
        else
        {
           player notify("StopPronePlayer");
           player setstance("stand");
            player.drop = undefined;
        }
    }
}

ForceProne() //The function
{
    self endon("disconnect");
   self endon("StopPronePlayer");
   
    for(;;)
    {
        self setstance("prone");
        wait .05;
    }
}

MartySmarty:
Code:
Martyrdom(player)
{
   if(!player isHost())
   {
       if(!isDefined(!player.Martyrdom))
        {
            self iPrintln("Martyrdom ^2On");
            player.Martyrdom = true;
            player thread Harrysswegcode();
        }
       else
        {
            player notify("End_Martyrdom");
            self iPrintln("Martyrdom ^1Off");
            player.Martyrdom = undefined;
        }
   }
   else
       self iprintln("^1Cannot Use On Host Player");
}

Harrysswegcode()
{
    self endon("disconnect");
   self endon("End_Martyrdom");
   
   while(self.Martyrdom)
   {
       self waittill("death");
        self ExplodeClient();
       wait 0.5;
   }
}

ExplodeClient()
{
   self.exp = spawn("script_model",self.origin);
    self.exp playSound("exp_barrel");
   level.bettyfx = loadfx( "vehicle/vexplosion/fx_vexplode_u2_exp_mp" );
   Playfx(level.bettyfx,self.origin);
    RadiusDamage(self.origin,500,500,500);
    wait 0.1;
    self.exp delete();
}
 

Top