Project X Forums
http://px.worms2d.info/forum/

ZombieMode
http://px.worms2d.info/forum/viewtopic.php?f=12&t=682
Page 1 of 1

Author:  Zed [ Thu Sep 26, 2013 9:26 pm ]
Post subject:  ZombieMode

ZombieMod.
Just a small fun pxscheme that makes dead worms zombies.
Zombies have distinctive green skin and 100 hp.
They can smell you and see you in some distance around them.
They also can jump really high, and can hit you with their claws, dealing 30 damage.
Walljump and Bhopjump from parkour mod with some changes included in this lib. Enter near wall to walljump, backspace near floor to bunny-hop.

You can play any scheme with it (imagine shopper, that would be hardcore!) and on any map.
You can add the lib to any pxscheme.
Updated, so it should work online just fine.

Replay from old non-online version: download/file.php?id=774
Link to pxscheme\lib in attach. rndz is pxscheme similar to used in the replay, ShopperZombie is pxscheme for shopper with zombies.
Update: Updated archive with a lib that is not supposed to crash once every worm is a zombie, test it. HF

Attachments:
File comment: updated, v.0.6
ZombieMode.zip [126.77 KiB]
Downloaded 1170 times

Author:  Zed [ Sat Sep 28, 2013 7:03 pm ]
Post subject:  Re: ZombieMode

It seems that it doesnt work online, but i've made a workaround. I updated 1st post.
Highlander with zombies:
http://www.youtube.com/watch?v=UNpOioBA ... e=youtu.be

Author:  -raffie- [ Mon Feb 08, 2016 10:33 pm ]
Post subject:  Re: ZombieMode

This lib would have great use in the following event:

A few different weapons have the ability to revive worms (Lightning Strike, Health Zone, ...), and this still works even after a team has been killed off.

Wouldn't it be a good idea to use this lib so that when a worm is revived of a team that has been killed off, only a Zombie worm is revived? That way you have an extra fun gameplay element, and you fix a rather silly open door to revive a team that's been killed off.

If someone could make it happen, that would be awesome :lol:

Author:  -raffie- [ Tue Jul 12, 2016 3:21 pm ]
Post subject:  Re: ZombieMode

I've been trying to fix the issue where when a team only consists of zombies, it doesn't get killed off, with the added issue of a never ending loop when only zombies are left in the game. I've had mixed results, with the team consisting of only zombies getting killed some of the time, but not consistently... If anyone could help that would be great ;)

This is the simple logic I used:

x = amount of worms left in team
y = amount of zombies in team

if x == y; set health of all worms in team to 0 (thus killing them off)

(A different approach could be to remove the team tag from a worm, maybe that could fix the issue as well, not sure if that is at all possible...)

Code:
//Kill off team if it consists only of Zombie Worms
//Mod by raffie
void destroyTeam(int teamIndex){
  for (local wormIndex = 1; wormIndex <= 8; wormIndex++){
    GS->Info.SetWormHealth(teamIndex, wormIndex, 0);
  }
}

override void CWorm::Message(CObject* sender,EMType Type,int MSize,CMessageData* MData)
{
super;
if(Type == M_FRAME)
//if(Type == M_TURNEND)
         {
       //local w = GetCurrentWorm();

      //local fullWormCount = 0;
      //local teamCount = 0;
      //local initialWormCount = 0;
      //local wormCount = 0;
      //local zombieWormCount = 0;
     
      int fullWormCount = 0;
      int teamCount = 0;
      int initialWormCount = 0;
      int wormCount = 0;
      int zombieWormCount = 0;
      local wormTeamLoop;
     
      //Get amount of Worms in Team at Start
      for (local worm = 0; worm < GS->Info.Teams[1].NWorms; worm++){
          initialWormCount++;
        }
     
      //Get amount of teams
      for (local team = 0; team < 6; team++) {
      for (local worm0 = 0; worm0 < GS->Info.Teams[team].NWorms; worm0++){
          fullWormCount++;
        }
      }
      teamCount = (fullWormCount/initialWormCount);
     
     
     
     
      for (local team = 0; team < teamCount; team++) {
        wormCount = 0;
        zombieWormCount = 0;
        wormTeamLoop = (team+1);
      //Current Worm count
      for (local worm = 0; worm < GS->Info.Teams[team].NWorms; worm++){
        if (GS->Info.Teams[team].Worms[worm].State != 135){ // if not dead
          wormCount++;
         }
            //if(wormTeamLoop == teamCount){ wormTeamLoop = 0; }
         
         //if (GS->Info.Teams[wormTeamLoop].Worms[worm].State != 135){ // if not dead 
            local w = CWorm(Root->GetObject(2, 16 * wormTeamLoop + worm));
            //if (w->Zombie){ zombieWormCount++; }
            if(w != NullObj){if(w->Zombie == true)zombieWormCount = zombieWormCount + 1;}
         //}
        }
      //GG->WriteToChat(14, StrCon(StrCon("TEAM ", displayInt(team)), ""), false);
      //GG->WriteToChat(14, StrCon(StrCon("LOOP ", displayInt(wormTeamLoop)), ""), false);
      if(w != NullObj){
      //GG->WriteToChat(14, StrCon(StrCon(StrCon(StrCon("TEAM ", IntToC(GetTeamColor(w->WormTeam))), ": "), displayInt(wormTeamLoop)), ""), false);
      //GG->WriteToChat(14, StrCon(StrCon(StrCon(StrCon("TEAM ", displayInt(wormTeamLoop)), ": "), IntToC(GetTeamColor(w->WormTeam))), ""), false);
      }else{
      //GG->WriteToChat(14, StrCon(StrCon("TEAM ", displayInt(wormTeamLoop)), ""), false);
      }
      //GG->WriteToChat(15, StrCon(StrCon("Current worm count: ", displayInt(wormCount)), ""), false);
      //GG->WriteToChat(15, StrCon(StrCon("Zombie worm count: ", displayInt(zombieWormCount)), ""), false);
      //GG->WriteToChat(15, StrCon(StrCon(StrCon(StrCon("Worms: ", displayInt(wormCount)), " // Zombies: "), displayInt(zombieWormCount)), ""), false);
     
      if(zombieWormCount == wormCount)
      {
      //GG->WriteToChat(13, StrCon(StrCon("TEAM DEAD: ", displayInt(wormTeamLoop)), ""), false);
      destroyTeam(wormTeamLoop);
      }
     
     
      }       

         
         }   
 }

Author:  Zed [ Sat Jul 23, 2016 4:26 pm ]
Post subject:  Re: ZombieMode

I thought i've fixed the crash issue when all the worms are zombies:

Code:
override int CTurnGame::GetNextTeam()
{
if(nocrash <= 100)
{
 local nt = super;
 local wormnum = 0;
       for(local t = 1; t<9; t++)
       {
        local w = CWorm(Root->GetObject(2, 16 * nt + t));
        if(w != NullObj){if(w->Zombie == false)wormnum = wormnum + 1;}
       }
 if(wormnum > 0){return nt;}
 else
 {
 CurTeam = nt;
 nocrash = nocrash + 1;
 return GetNextTeam();
 }
}
else
{
super;
}
}


Above means that after 100 loops method [get next team] starts working as if there is no zombies (and you can quit the game). I think I tested it and it worked. I updated the version in the first post some time ago. Var 'nocrash' is also reset to 0 on each [turnbegin].

Author:  -raffie- [ Mon Jul 25, 2016 4:49 pm ]
Post subject:  Re: ZombieMode

Well, what I tried to do is kill a team off when it only consists of Zombies. People find it annoying when they don't see their team removed from the game, even though they are actually dead (only zombie worms). So that's what I tried to accomplish: when a team only has Zombie worms, kill all worms in team so team is removed.

Great lib btw, we really love it in roping games! :D

Author:  Zed [ Mon Jul 25, 2016 7:09 pm ]
Post subject:  Re: ZombieMode

Glad you like it, you should post some replays for me to watch, it helps with motivation to make more libs =)

Here is my version of your script (I tried to understand it, but it required testing via WriteToChat, so I thought it was easier to write it anew).
It checks all objects for worms, counts all nonzombies and all zombies among each team, and if nonzombies = 0 and zombies > 0 it kills them via your method.

Code:
require utils;
 
int nonzombies[7]; //index is team (1-6) 0 is unused
int zombies[7];   //index is team


void script::FirstFrame()     
{
        for(local t = 0;t<7;t++)
        {
        nonzombies[t] = 0;
        zombies[t] = 0;
        }
}

 
override void CTurnGame::Message(CObject* sender,EMType Type,int MSize,CMessageData* MData)
{
          if(Type == M_FRAME)
          {
                  for(local i = 1; i < Env->Objs.Count; i+=1)
                         {
                         local obj = Env->Objs.Objs[i];
                               if(obj == NullObj) continue;
                               if(obj->ClType == OC_Worm)
                               { 
                               CWorm* wyrm;
                               wyrm = obj;
                                 if(zombies[wyrm->WormTeam] != -1)  //this is so it does not kill them repeatedly
                                 {
                                     if(wyrm->Zombie == true)
                                     {
                                     zombies[wyrm->WormTeam] = zombies[wyrm->WormTeam] + 1;
                                     }
                                     else
                                     {
                                     nonzombies[wyrm->WormTeam] = nonzombies[wyrm->WormTeam] + 1;
                                     }
                                 }
                               }
                         }
                         
                         for(local m = 0; m<7; m++)
                         {
                            if(nonzombies[m] == 0 && zombies[m] > 0)
                            {
                            destroyTeam(m);
                            nonzombies[m] = 0;
                            zombies[m] = -1; //this is so it does not kill them repeatedly
                            }
                            else
                            {
                            nonzombies[m] = 0;
                            zombies[m] = 0;
                            }
                         }
          }
super;
}

void destroyTeam(int teamIndex)
{
  for (local wormIndex = 1; wormIndex <= 8; wormIndex++)
  {
    GS->Info.SetWormHealth(teamIndex, wormIndex, 0);
  }
}


I've tested it and it seems to work, dont forget to change FirstFrame name according to the name of the script (mine was called 'script').

Author:  -raffie- [ Tue Jul 26, 2016 8:29 am ]
Post subject:  Re: ZombieMode

Awesome man! I'll test it as soon as I can! I'll look through my replays when I have a bit more time, for now I'll link u this game I streamed on Twitch: https://www.twitch.tv/wormsdotam/v/78304497

We haven't had new libs in ages so can't wait to test the possessed lib aswell :)

Author:  Zed [ Tue Jul 26, 2016 2:18 pm ]
Post subject:  Re: ZombieMode

I will post a new gamemode sometime soon hopefully, I'm making medieval version of TF2 gamemode http://px.worms2d.info/px080wiki/index.php/Gamemodes#TF2 with better gameplay (hopefully), as TF2 had problems with almost all worms lacking any form of vertical mobility.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/