UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Killing and respawning a zombie when touching a trig

broken avatar :(
Created 10 years ago
by vinnyz500
0 Members and 1 Guest are viewing this topic.
2,252 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 1 January 2014
Last active: 4 years ago
Posts
397
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Signature
×
vinnyz500's Groups
vinnyz500's Contact & Social LinksXxMrPotatoxXpsn_hackedlobbies4uvinnyz500
Hey, i need a small script to kill a zombie when they touch a certain trig and respawn the zombie, the trig does not need to be deleted, i need it as a failsafe for another script i have. It barley bugs out but there is that once in 10 rounds it does happen, and the zombies just get stuck in a loop lol. Thanks
Marked as best answer by vinnyz500 10 years ago
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 5 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
Signature
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
I made a code that should work well if it's only one trigger:
  • Create a trigger multiple where zombies will die with the following KVPs:
    targetname    killer_trigger
    spawnflags     9
  • Create an ordinary spawn where you want zombies to respawn, but give it
    targetname    special_spawners
  • Now open your MAPNAME.gsc and just bellow this line:
Code Snippet
Plaintext
maps\_zombiemode::main();
Add this:
Code Snippet
Plaintext
thread kill_zombie_on_touch();
And anywhere at bottom of the file add this:
Code Snippet
Plaintext
kill_zombie_on_touch()
{
    trig = getent( "killer_trigger","targetname" );
    zombies = getAIArray( "axis" );

    for(i = 0; i < zombies.size; i++)
    {

        if( isDefined( zombies[i] ) &&
            zombies[i] isTouching( trig ) &&
            !( zombies[i] enemy_is_dog() ) )
        {
            level.zombie_total ++;
            spawner = getEnt( "special_spawners","targetname" );

            //USE ONLY ONE OF THIS OR ANY OTHER ANIMATION.------------------------
            //zombies[i] maps\_zombiemode_spawner::zombie_head_gib();    //HEAD EXPLODES
            zombies[i] thread animscripts\death::flame_death_fx();    //BURNS THEM
            //---------------------------------------------------------------------

            zombies[i] dodamage( zombies[i].health + 666, zombies[i].origin );
            spawn_zombie( spawner );
        }
    }

    wait(0.1);
    thread kill_zombie_on_touch();
}

    I'm sure there are better ways to do it but this seems to work fine. But one bad point is that zombies leave powerups and I don't know how to fix it.

    Well, hope it helps you.
    broken avatar :(
    ×
    broken avatar :(
    Location: us
    Date Registered: 14 September 2013
    Last active: 5 years ago
    Posts
    1,895
    Respect
    Forum Rank
    Zombie Destroyer
    Primary Group
    Community Scripter
    My Groups
    More
    My Contact & Social Links
    More
    Personal Quote
    BE ORIGINAL
    Signature
    ×
    MakeCents's Groups
    Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
    Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
    BO3 Modtools Alpha
    BO3 Modtools Alpha
    This user has access to the Black Ops 3 Modtools Alpha
    I made a code that should work well if it's only one trigger:


    It's a pretty good try.  :) +1 I like the flame death. You don't need to thread it recursively and exponentially though. You could end up with that too many vars error. You have a trigger so go ahead and use it. With a slight modification it should continue to work but not run the code over and over for the same zombies:

    Code Snippet
    Plaintext
    kill_zombie_on_touch()
    {
        trig = getent( "killer_trigger","targetname" );
        // zombies = getAIArray( "axis" );

        // for(i = 0; i < zombies.size; i++)
        while(1)
        {
            trig waittill("trigger", zombie);
            if( isAlive( zombie ) && 
                !( zombie enemy_is_dog() ) )
            {
                level.zombie_total ++;
                spawner = getEnt( "special_spawners","targetname" );

                //USE ONLY ONE OF THIS OR ANY OTHER ANIMATION.------------------------
                //zombies[i] maps\_zombiemode_spawner::zombie_head_gib();    //HEAD EXPLODES
                zombie thread animscripts\death::flame_death_fx();    //BURNS THEM
                //---------------------------------------------------------------------

                zombie dodamage( zombie.health + 666, zombie.origin );
                spawn_zombie( spawner );
            }
        }

        wait(0.1);
        // thread kill_zombie_on_touch();
    }


    With a little more modification we can have multiple triggers and randomize spawns:

    Code Snippet
    Plaintext
    kill_zombie_on_touch(){
        trigs = getentarray( "killer_trigger","targetname" );
        array_thread(trigs,::KillZombieOnTouch);
    }
    KillZombieOnTouch()
    {
        while(1)
        {
            trig waittill("trigger", zombie);
            if( isAlive( zombie ) && 
                !( zombie enemy_is_dog() ) )
            {
                level.zombie_total ++;
                spawner = array_randomize(getEntArray( "special_spawners","targetname" ))[0];

                //USE ONLY ONE OF THIS OR ANY OTHER ANIMATION.------------------------
                //zombies[i] maps\_zombiemode_spawner::zombie_head_gib();    //HEAD EXPLODES
                zombie thread animscripts\death::flame_death_fx();    //BURNS THEM
                //---------------------------------------------------------------------

                zombie dodamage( zombie.health + 666, zombie.origin );
                if(isDefined(spawner)) spawn_zombie( spawner );
            }
        }

        wait(0.1);
    }

    Not tested, sorry for any errors. The theory is my point.

    Also, for no powerups, simply don't put the playable area trigger there.
    Last Edit: September 03, 2015, 11:57:06 pm by MakeCents
    broken avatar :(
    ×
    broken avatar :(
    Location: us
    Date Registered: 1 January 2014
    Last active: 4 years ago
    Posts
    397
    Respect
    Forum Rank
    Perk Hacker
    Primary Group
    Member
    My Contact & Social Links
    More
    ×
    vinnyz500's Groups
    vinnyz500's Contact & Social LinksXxMrPotatoxXpsn_hackedlobbies4uvinnyz500
    Thanks to both of you, will be very useful  ;)

     
    Loading ...