1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

[Collaboration] Zombie Fortress Versus variant

Discussion in 'Requests' started by Frikman, Jul 31, 2016.

  1. Frikman

    Frikman Bison Rider

    Messages:
    162
    After tweaking and working a lot on ZFM+ I've come to the point where I'm happy with it's current state, but there's something my friends and some players have asked me about: becoming a zombie player when you die. I'd like to ask for help modifying the following things:

    Rules
    • Make all players spawn on the blue team (team 0).
    • Automatically switching players to the purple team (team 1) when they die, and make them respawn always on said team.
    • Making purple team players spawn at night with the rest of the zombies.
    • Making purple team players spawn as a random undead class (undead classes won't be able to build anything, so it's really important making them random).
    Classes
    • I need to know how to make classes be able to break different kinds of blocks, climb walls and be able to fly.
    • I also need to know how to make a ranged class not waste any ammo (for making goo/acid spitting classes).

    And that's pretty much it. I know BunnyFection works on a similar dynamic but I don't believe I'm currently capable of re-writing rules yet, so if anyone's interested on having a look and helping here's a link to the mod as of today (for some reason I can't upload it to the forum).
    (P.S.: There's a lot of reworked stuff from other mods here so don't be surprised if things are similar).

    http://puu.sh/qkdqJ/d7bbc3ea90.7z
     
  2. makmoud98

    makmoud98 You are already DEAD Forum Moderator Staff Alumni Tester

    Messages:
    586
    what to do after they respawn as zombie, then die? do they become another zombie or do they just keep respawning as zombies until it is day
     
  3. Frikman

    Frikman Bison Rider

    Messages:
    162
    They should wait until next night, just like players wait until next day now.

    Something I'm not so sure yet is if the human team should start with tickets (lives) and when they reach 0 they start switching to the undead team upon death (maybe tickets could be bought at a workshop, I don't know). Sounds complicated to code tho
     
  4. jimmyzoudcba

    jimmyzoudcba Haxor Tester

    Messages:
    274
    lol when I came in I was expecting a giant map with two sides with tickets trying to kill each other while there were endless hordes of zombies. Guess I was wrong.
     
  5. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    It's not really, you just want to be starting from a clean slate. All you need is a counter per-player and when it hits zero, swap their team.

    Sidenote: Ignore all team change requests other than to spectator from players (there's a script for this iirc, i think it's used in TDM)

    @kaizokuroof has a fairly clean (not 100% but hey) zombies rules code out there for his KOD mod, which I helped him with. It's 100x cleaner than anything based on rulescore and I'd suggest checking it out.

    It even has respawning in the morning (and -> framework code for spawning at night as a zombie)
     
    Frikman and kaizokuroof like this.
  6. kaizokuroof

    kaizokuroof Agkubuk|'Kaizokuroof' Cilobakil, Roofpointy Global Moderator Forum Moderator Donator Tester
    1. PumpkinStars - [Pk#] - Inactive

    Messages:
    909
    Yeah, I made some slight tweaks and should work "Out of the box" but I think there is some issues with player spawn and transparency. There are even some updated zombies AI from some of the other community members that I can throw in. I don't have it all on my now, as I'm at work. But feel free to PM me if I forget to reply here and I'll get it to you.

    FYI, when Geti says "Helped me" he means, he pretty much made it all :D I'll do my best to help you where I can though.
     
    Frikman and Geti like this.
  7. Frikman

    Frikman Bison Rider

    Messages:
    162
    So, while I'm trying to understand kaizo zombiesframework, I've been testing with the default rules based on RulesCore. This is what I've come up with so far
    Code:
        void onPlayerDie(CRules@ this, CPlayer@ victim, CPlayer@ player, CPlayer@ killer, u8 customData)
        {
            if (!rules.isMatchRunning()) { return; }
    
            if (victim !is null )
            {
                PlayerInfo@ p = getInfoFromName( victim.getUsername() );
                CBlob@ blob = victim.getBlob();
                if (p.team == 0) //there has to be a better way to check the team.
                {
                    Zombify( victim ); //for some reason I can't put "ChangePlayerTeam" here or else it won't run, so I'm calling a function.
                }         
             
                else if (killer !is null && killer.getTeamNum() != victim.getTeamNum())
                {
                    addKill(killer.getTeamNum());
                }
            }
        }
     
        void Zombify( CPlayer@ this)
        {
            PlayerInfo@ pInfo = getInfoFromName( this.getUsername() );
            print( ":::ZOMBIFYING: " + pInfo.username );
            ChangePlayerTeam( this, 1 );
            pInfo.blob_name = "builder"; //will be changed later to a special zombie class
        }
    I figured out I'd start with something simple, just forcing dying players on the 2nd team, and I believe the "OnPlayerDie" function manages that. The problem is, it won't work and I have no idea why. Even though it compiles, players are never changed from a team to another upon death. Any clues on how to make it actually work?

    EDIT: Even if I try to swap a player via console they still respawn on the blue team, so I guess the issue has to do with the rules not recognizing the 2nd team.

    EDIT 2 (EDIT HARDER): So, by looking at the CTF rules I noticed that the AddPlayer function looks different than the one I have right now, which looked like this
    Code:
        void AddPlayer(CPlayer@ player, u8 team = 0, string default_config = "")
        {
            CTFPlayerInfo p(player.getUsername(), 0, "builder" );
            players.push_back(p);
            ChangeTeamPlayerCount(p.team, 1);
            warn("sync");
            getRules().Sync("gold_structures",true);
        }
    My guess is that the red 0 is forcing all respawning players on the blue team, so I changed it a bit
    Code:
        void AddPlayer(CPlayer@ player, u8 team = 0, string default_config = "")
        {
            team = player.getTeamNum();
            CTFPlayerInfo p(player.getUsername(), team, "builder" );
            players.push_back(p);
            ChangeTeamPlayerCount(p.team, 1);
            warn("sync");
            getRules().Sync("gold_structures",true);
        }
    The problem with this is, now I get an error saying "PLAYER TEAM NOT SET CORRECTLY" and I can't spawn at all. If I change the number to 1 it'll spawn me on the red team, but I can't get both teams to work at the same time.
     

    Attached Files:

    Last edited: Aug 28, 2016