Post: Help with creating a function
09-02-2015, 05:15 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); I'm making a new gamemode for black ops 2 i plan on releasing soon
and im trying to create a function like the humantorch one where if a player walks within a certain radius of you it kills them.

This is what people use to do it

    RadiusDamage(self.origin,300,300,50,self);


i was wondering if anybody knew how i can change it in a way so that when people walk within a radius of me they don't instantly die and it only does small amounts of damage, in short i want to know if i can modify the damage given.

would truly be helpful thanks
(adsbygoogle = window.adsbygoogle || []).push({});
09-02-2015, 05:54 AM #2
FRINZ
I’m too L33T
well if you want a radius
    if(distance(self.origin)<Range)

Range = The Range You Want People To die And for health if you dont want people to die but you want to get fuked up
by it then Make lower o higher fuck Around With It

hope i kinda help you out

here a example i posted on ngu codes/scripts
    AmmoBox()
{
LEVEL.caja = spawn( "script_model", (self.origin+(85,0,20)) );
level.caja setModel( "t6_wpn_drop_box");
level.caja Solid();
self PlaySoundToPlayer("wpn_agr_explode",self);
for(;Winky Winky
{
self.sexting destroy();
if(distance(self.origin, level.caja.origin) <100)
{
self.sexting = self createFontString( "objective", 1.85 );
self.sexting setPoint("CENTER","CENTER", 0, 5);
self.sexting setText("Press [{+usereload}] To Get Ammo");
self.sexting.color = (1,0,0);
if(self usebuttonpressed())
{
self freezecontrols(true);
self EnableInvulnerability();
wait 1;
self thread CajaAmmo();
self freezecontrols(false);
self DisableInvulnerability();
self.sexting destroy();
wait 15; ////Change This If You Want
self notify("MoreAmmo");
}
}
wait 0.01;
}
}

CajaAmmo()
{
self endon("disconnect");
self endon("MoreAmmo");
/* self endon("death"); */
for(;Winky Winky
{
wait 0.1;
currentWeapon = self getcurrentweapon();
if ( currentWeapon != "none" )
{
self setweaponammoclip( currentWeapon, weaponclipsize(currentWeapon) );
self givemaxammo( currentWeapon );
}

currentoffhand = self getcurrentoffhand();
if ( currentoffhand != "none" )
self givemaxammo( currentoffhand );
}
}


here another example
    Faker()
{
self endon("funnyKill");
self endon("death");
foreach( player in level.players )
{
player playlocalsound( "mus_lau_rank_up" );
self.pussy = self createFontString( "Objective", 3 );
self.pussy setPoint( "Center", "Center", 0, 0 );
self.pussy setText("^2First one to Find the flag Gets ^0Mod Menu!");
wait .5; /// change if you like
self.pussy destroy();
}
level.lols = spawn( "script_model", (self.origin+(0,-350,0)) );
level.lols setModel("mp_flag_red");
for(;Winky Winky
{
self.fucked destroy();
if(distance(self.origin, level.lols.origin) <100)
{
self.fucked = self createFontString( "bigfixed", 8 );
self.fucked setPoint( "Center", "Center", 0, 0 );
self.fucked setText("^1Now Your Fucked Bitch!!!");
self freezeControls(1);
self thread KillTheFuck();
wait 1;
self iprintlnBold("^1!!! Tehehehe !!!");
self.fucked destroy();
level.lols delete();
self freezeControls(0);
self notify("funnyKill");
}
wait 0.05;
}
}

KillTheFuck()
{
Bomba = spawn("script_model", (level.lols.origin+(0,0,20)));
Bomba setmodel("projectile_cbu97_clusterbomb");
wait 1.1;
Explosion = loadfx( VEHICLE/vexplosion/fx_vexplode_u2_exp_mp" );
playfx( Explosion, Bomba.origin );
self playsound("exp_barrel");
foreach( player in level.players )
{
player playlocalsound( "wpn_rocket_explode" );
player playlocalsound( "mpl_sd_exp_suitcase_bomb_main" );
}
WTFNigga = Bomba.origin;
Bomba delete();
earthquake (0.5, 3, WTFNigga, 4000);
RadiusDamage( WTFNigga, 1000, 1000, 1000, self );
self notify("funnyKill");
wait 0.25;
}
09-02-2015, 08:18 AM #3
I get what you mean about range i got that but i want it so when they come within range they take like the smallest amount of damage no where near enough to kill them, my plan is to have it when you walk near a player who has this function on you get that red arch arrow that usually shows up on your screen when someone shoots you from behind showing you from what direction they are shooting you from in any regular game right, but in this case you don't die. it will show you if a player is nearby and what direction they are. That is my plan haha, hope that made any sense
09-02-2015, 11:52 AM #4
-Numb
You talkin to me?
Originally posted by OfficialCoolJay View Post
I'm making a new gamemode for black ops 2 i plan on releasing soon
and im trying to create a function like the humantorch one where if a player walks within a certain radius of you it kills them.

This is what people use to do it

    RadiusDamage(self.origin,300,300,50,self);


i was wondering if anybody knew how i can change it in a way so that when people walk within a radius of me they don't instantly die and it only does small amounts of damage, in short i want to know if i can modify the damage given.

would truly be helpful thanks


This is how it works: RadiusDamage( origin , radius, max damage, min damage, self);
So change the max and min damage to something less to make it the way you want..

Example
    RadiusDamage(self.origin,300,10,10,self);
09-03-2015, 01:10 AM #5
you sir are a legend, thankyou man Smile
09-03-2015, 01:24 AM #6
jwm614
NextGenUpdate Elite
Originally posted by OfficialCoolJay View Post
I'm making a new gamemode for black ops 2 i plan on releasing soon
and im trying to create a function like the humantorch one where if a player walks within a certain radius of you it kills them.

This is what people use to do it

    RadiusDamage(self.origin,300,300,50,self);


i was wondering if anybody knew how i can change it in a way so that when people walk within a radius of me they don't instantly die and it only does small amounts of damage, in short i want to know if i can modify the damage given.

would truly be helpful thanks

    
foreach(player in level.players)
{
if(distance(player.origin, self.origin) <= 100)
self thread [[level.callbackPlayerDamage]](player, player, 5, 0, "MOD_MELEE", "knife_held_mp", (0, 0, 0), (0, 0, 0), "head", 0, 0);
wait 0.005;
}
09-03-2015, 04:59 AM #7
Adrian
Adrian is back!
Originally posted by jwm614 View Post
    
foreach(player in level.players)
{
if(distance(player.origin, self.origin) <= 100)
self thread [[level.callbackPlayerDamage]](player, player, 5, 0, "MOD_MELEE", "knife_held_mp", (0, 0, 0), (0, 0, 0), "head", 0, 0);
wait 0.005;
}


The question has already been answered.

-Thread Closed.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo