Page 1 of 1
Zombie Scripting
Posted: Tue Jun 17, 2014 6:09 pm
by Kingpin
I have been trying to set up the scripts for a Zombie-mod that someone else is making. I looked at Mav's wave mode scripts and some other examples, and just wondering where I should start.
Re: Zombie Scripting
Posted: Wed Jun 18, 2014 1:28 am
by LRKfm946
It would also be a good idea to look at the wave mode scripts for RepSharpshooter's Battle Arena 2.0 (in the released assets forum). Those were a huge help in making the hunger games script.
Re: Zombie Scripting
Posted: Wed Jun 18, 2014 7:17 am
by razac920
Well, I guess I'd wonder what kind of Zombie mod this is? Is it a single player facing waves of zombies, and game over when the player dies, or is it a team of players against a team of zombies, and zombies turn the players into more zombies, or... something else? I think wave mode scripts are probably good for the first case. I plan to release my gun game scripts with my mod, which though somewhat different, does show how to handle large numbers of players killing each other, and change their classes on the spot smoothly. After that I will continue working on my zombie infection mod, so perhaps I could help then?
Re: Zombie Scripting
Posted: Wed Jun 18, 2014 1:56 pm
by Kingpin
I am planning on setting up a multiplayer-friendly set of about 10 waves, when players play as the "survivors" against waves of zombies that become increasingly difficult. When a survivor is "infected", they join the Zombie team and fight with them. Very similar to HvB3, if you have played it.
Looking at Battle Arena scripts is a great idea; thanks!
Re: Zombie Scripting
Posted: Wed Jun 18, 2014 9:36 pm
by razac920
Okay, yeah for that I can't suggest anything more than what has been said, to look at existing wave mode scripts. That will be the bulk of your code, Switching a player's team upon dying is trivial in comparison. Good luck!
Re: Zombie Scripting
Posted: Thu Jun 19, 2014 3:11 pm
by LRKfm946
Kingpin wrote:when players play as the "survivors" against waves of zombies that become increasingly difficult. When a survivor is "infected", they join the Zombie team and fight with them.
Here's what I did for Hunger Games:
Code: Select all
charSpawn = OnCharacterSpawn(
function(character)
print("Someone spawned.")
local charUnit = GetCharacterUnit(character)
--ShowObjectiveTextPopup("level.HGS.intro_popup")
if check_map then
SetEntityMatrix(charUnit, destLoc)
KillObject("com_inv_col_16_con1")
KillObject("com_inv_col_64_con2")
KillObject("com_inv_col_16_con3")
KillObject("com_inv_col_16_con4")
KillObject("com_inv_col_16_con")
end
print("\tTaking away their sheilds")
antipower(character)
if not (players_alive[character] == nil) then return
else players_alive[character] = {
playerChar = character,
playerUnit = charUnit,
playerTeam = GetCharacterTeam(character),
registered = false,
spamCount = 0,
isCamping = false,
intervalCount = 0,
hurtCount = 0
}
end
print("\tAdded to players_alive.")
number = RefreshListSize(players_alive)
--ShowMessageText("level.HGS.debug.npa."..number)
end
)
*check_map was a boolean (true/false) value I had at the top of the .lua that I set to true when I needed to check the world so I wouldn't have to deal with registration, etc. This is
very useful. You should definitely have something like this that keeps the zombie waves from starting so you can check out the map. I also had the variable debug_on to toggle certain features and debug messages.
Code: Select all
OnCharacterDeath( --THIS could happen anywhere, in or oustide the arena
function(character, killer)
print("Ruh roh, someone died.")
numPlayersAlive = GetPlayersAlive()
if not character then print("What happened... nobody died...?") return end
--even if a guy dies, we still need to de-register him and stuff.
--1. If the games haven't started, simply remove him from players_alive
if playerReg == true then
print("\tPlayer registration is open, so we'll just remove him from players_alive.")
print("\tFound the player, is he registered?", players_alive[character].registered)
print("\tRemoving the player from players_alive")
RemoveFromList(character)
numRegisteredPlayers = GetNumRegisteredPlayers(players_alive)
print("\tThere are now this many registered players: ", numRegisteredPlayers)
print(" ")
--2. If the games have started, then this player must be assigned a rank
else
print("\tThe games have started, so we need to add him to the dead people list.")
print("\tCreating his info table and adding him to players_eliminated")
players_eliminated[character] = {playerChar = character,
playerRank = GetSize(players_eliminated)+1
}
print("\tRemoving him from players alive")
--players_alive[character] = nil
RemoveFromList(character)
numPlayersAlive = RefreshListSize(players_alive)
addPointsToChar(character, players_eliminated[character].playerRank)
print("\tThere are now this many players alive: ", numPlayersAlive)
SafetyCheck()
end
end
)
*SafetyCheck() is the function that makes 100% sure that the players_alive list is up to date and correct. This is largely meant to deal with people leaving the server mid-round while they're still alive, or if an admin swaps their team. Those are the only 2 ways a player can be removed from play without dying. OnCharacterDeath() will catch every other situation. SafetyCheck() also makes sure that if there are 1 or fewer people that have not been eliminated after the games begin, the round must end, period.
The main purpose of the lists is to handle properties that you want to assign to players that the game doesn't already have (e.g. in HGS, player is registered, player is camping, etc.). You might need to track who's still alive on the "survivors" team, so you know when to end the round. You could just do it by team number and do away with the lists IF you make team 1 survivors and team 2 zombies. If you want to do something like what I did in hunger games and provide every stock special unit along with the standard units, you'd need these lists because you can't fit all the unit classes on one team. If that were the case, you'd make zombies locals (team 3). You could use this code as is (but take out HGS things like registered/player rank/adding points) if you plan on making it a 1 life survival match. You'll need to handle whether the player is killed by a zombie or something else (or leaves the server). If you want to make it possible to "cure" people that have been infected, you'd have to handle switching them back over from the players eliminated list to players alive (and you can use your own names for lists and what not).
Re: Zombie Scripting
Posted: Thu Jun 19, 2014 4:20 pm
by Kingpin
I was thinking about setting up the zombies has Team 3. When started, players were forced to team 1 (survivors). On death, they were forced to team 2 (infected). Teams 2 and 3 were allied.