Request Need Help for fix my protector function on zombies

NextMcDo

Insane-Known Member
Messages
5
Reaction score
0
Points
351
Hello, i recoding some source function on web but for this, my protector don't follow me if is kill zombies.
Protector()
{
self endon( "death" );
self endon( "disconnect" );
self endon( "Stop_Protector" );
self.Guard = booleanOpposite(self.Guard);
self iprintln(booleanReturnVal(self.Guard, "Protecteur: ^1OFF", "Protecteur: ^2ON"));
if(self.Guard)
{
self.protector = spawn("script_model", self.origin);
self.protectorfx = spawn("script_model", self.origin);
if(level.script == "zm_prison") self.protector setmodel("p6_anim_zm_al_magic_box_lock_red");
else self.protector setmodel("zombie_teddybear");
self.protectorfx setmodel("tag_origin");
playfxontag( level._effect[ "powerup_on" ], self.protector, "tag_origin" );
playfxontag( level._effect[ "powerup_on" ], self.protectorfx, "tag_origin" );
for(;:wink:
{
self.protector.origin = self.origin + (0,0,90);
self.protector.angles = self.angles;
self.protectorfx.origin = self.origin + (0,0,90);
enemy = getaiarray( level.zombie_team );
for( i=0; i<enemy.size; i++ )
{
if(distance(enemy.origin, self.origin) < 300)
{
self.protectorfx moveto(enemy gettagorigin("j_head"), 0.8);
wait 0.8;
enemy maps\mp\zombies\_zm_spawner::zombie_head_gib();
enemy dodamage(enemy.health * 2, enemy.origin, self);
}
}
wait .01;
}
}
else
{
self.protector delete();
self.protectorfx delete();
self notify( "Stop_Protector" );
}
}
 

CF4_99

Veteran
Messages
130
Reaction score
47
Points
663
Hello, i recoding some source function on web but for this, my protector don't follow me if is kill zombies.
Protector()
{
self endon( "death" );
self endon( "disconnect" );
self endon( "Stop_Protector" );
self.Guard = booleanOpposite(self.Guard);
self iprintln(booleanReturnVal(self.Guard, "Protecteur: ^1OFF", "Protecteur: ^2ON"));
if(self.Guard)
{
self.protector = spawn("script_model", self.origin);
self.protectorfx = spawn("script_model", self.origin);
if(level.script == "zm_prison") self.protector setmodel("p6_anim_zm_al_magic_box_lock_red");
else self.protector setmodel("zombie_teddybear");
self.protectorfx setmodel("tag_origin");
playfxontag( level._effect[ "powerup_on" ], self.protector, "tag_origin" );
playfxontag( level._effect[ "powerup_on" ], self.protectorfx, "tag_origin" );
for(;:wink:
{
self.protector.origin = self.origin + (0,0,90);
self.protector.angles = self.angles;
self.protectorfx.origin = self.origin + (0,0,90);
enemy = getaiarray( level.zombie_team );
for( i=0; i<enemy.size; i++ )
{
if(distance(enemy.origin, self.origin) < 300)
{
self.protectorfx moveto(enemy gettagorigin("j_head"), 0.8);
wait 0.8;
enemy maps\mp\zombies\_zm_spawner::zombie_head_gib();
enemy dodamage(enemy.health * 2, enemy.origin, self);
}
}
wait .01;
}
}
else
{
self.protector delete();
self.protectorfx delete();
self notify( "Stop_Protector" );
}
}



C++:
Protector()
{
    self endon( "death" );
    self endon( "disconnect" );
    self endon( "Stop_Protector" );
    
    if(!isDefined(self.Guard))
    {
        self.Guard = true;
        self iPrintln("Protecteur: ^2ON");
        
        self.protector   = Spawn("script_model",self.origin);
        self.protectorfx = Spawn("script_model",self.origin);
        if(level.script == "zm_prison")self.protector SetModel("p6_anim_zm_al_magic_box_lock_red");
        else self.protector SetModel("zombie_teddybear");
        self.protectorfx SetModel("tag_origin");
        PlayFXOnTag(level._effect["powerup_on"],self.protectorfx,"tag_origin");
        
        while(isDefined(self.Guard))
        {
            self.protector MoveTo(self.origin+(0,0,90),.1);
            self.protector RotateTo(self.angles,.1);
            self.protectorfx MoveTo(self.origin+(0,0,90),.1);
            
            AI = GetAISpeciesArray("axis","all");
            foreach(enemy in AI)
            {
                if(Distance(enemy.origin,self.origin) < 300)
                {
                    self.protectorfx MoveTo(enemy GetTagOrigin("j_head"),.8);
                    wait .7;
                    enemy maps\mp\zombies\_zm_spawner::zombie_head_gib();
                    enemy DoDamage(enemy.health*2,enemy.origin,self);
                }
            }
            wait .05;
        }
    }
    else
    {
        self.Guard = undefined;
        self iPrintln("Protecteur: ^1OFF");
        self.protector delete();
        self.protectorfx delete();
    }
}
 

NextMcDo

Insane-Known Member
Messages
5
Reaction score
0
Points
351
C++:
Protector()
{
    self endon( "death" );
    self endon( "disconnect" );
    self endon( "Stop_Protector" );
   
    if(!isDefined(self.Guard))
    {
        self.Guard = true;
        self iPrintln("Protecteur: ^2ON");
       
        self.protector   = Spawn("script_model",self.origin);
        self.protectorfx = Spawn("script_model",self.origin);
        if(level.script == "zm_prison")self.protector SetModel("p6_anim_zm_al_magic_box_lock_red");
        else self.protector SetModel("zombie_teddybear");
        self.protectorfx SetModel("tag_origin");
        PlayFXOnTag(level._effect["powerup_on"],self.protectorfx,"tag_origin");
       
        while(isDefined(self.Guard))
        {
            self.protector MoveTo(self.origin+(0,0,90),.1);
            self.protector RotateTo(self.angles,.1);
            self.protectorfx MoveTo(self.origin+(0,0,90),.1);
           
            AI = GetAISpeciesArray("axis","all");
            foreach(enemy in AI)
            {
                if(Distance(enemy.origin,self.origin) < 300)
                {
                    self.protectorfx MoveTo(enemy GetTagOrigin("j_head"),.8);
                    wait .7;
                    enemy maps\mp\zombies\_zm_spawner::zombie_head_gib();
                    enemy DoDamage(enemy.health*2,enemy.origin,self);
                }
            }
            wait .05;
        }
    }
    else
    {
        self.Guard = undefined;
        self iPrintln("Protecteur: ^1OFF");
        self.protector delete();
        self.protectorfx delete();
    }
}
Protector don't detect/kill any zombies.
 
Top