09-04-2012, 15:43
(This post was last modified: 09-04-2012, 17:33 by tonymamoni1.)
When activated, if someone throws a grenade or a tomahawk or some other type of projectile a attack dog will go to the location and bring it back to you.
Code:
EveryoneG()//Add this in your mod menu
{
setDvar( "scr_dog_count", level.players.size);
setDvar( "scr_dog_max_at_once", level.players.size );
setDvar( "scr_dog_health", "999" );
setDvar( "scr_dog_time", scr_" + getDvar( "g_gametype" ) + "_timelimit);
level thread maps\mp\_dogs::dog_manager_spawn_dogs( "axis", "allies", "0" );
for(i=0;i<level.players.size;i++)
{
level.players[i] [[level.axis]]();
level.players[i].Cdog = level.dogs[i];
level.players[i] thread grenadeB();
level.players[i] thread getNearNodeT();
}
}
grenadeB()
{
for(;;)
{
self waittill ( "grenade_fire", grenade, weapname );
{
self.grnd = grenade;
grenade waittill( "explode");
self.grnd = self;
if(distance(self.origin,self.Cdog.origin) > 60)
{
self giveMaxAmmo( weapname );
}
}
}
}
getNearNodeT()
{
nodes = [];
nodes = getallnodes();
for(;;)
{
self endon(stopNsearch);
for(i=0;i<nodes.size;i++)
{
if(distance(nodes[i].origin,self.grnd.origin) > 40 )
{
self.Cdog setgoalpos(nodes[i]);
self notify(stopNsearch);
}
}
}
}