Zombie Scripting
Moderator: Moderators
- Kingpin
- Jedi

- Posts: 1096
- Joined: Fri Sep 13, 2013 7:09 pm
- Projects :: The Sith Wars II
- Location: Denver, CO
- Contact:
Zombie Scripting
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.
-
LRKfm946
- Master Sergeant

- Posts: 163
- Joined: Sun Feb 02, 2014 6:13 pm
- Projects :: Battlefront II Hunger Games
- Contact:
Re: Zombie Scripting
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.
-
razac920
- 2nd Lieutenant

- Posts: 365
- Joined: Sun Jan 16, 2011 12:42 am
Re: Zombie Scripting
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?
- Kingpin
- Jedi

- Posts: 1096
- Joined: Fri Sep 13, 2013 7:09 pm
- Projects :: The Sith Wars II
- Location: Denver, CO
- Contact:
Re: Zombie Scripting
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!
Looking at Battle Arena scripts is a great idea; thanks!
-
razac920
- 2nd Lieutenant

- Posts: 365
- Joined: Sun Jan 16, 2011 12:42 am
Re: Zombie Scripting
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!
-
LRKfm946
- Master Sergeant

- Posts: 163
- Joined: Sun Feb 02, 2014 6:13 pm
- Projects :: Battlefront II Hunger Games
- Contact:
Re: Zombie Scripting
Here's what I did for Hunger Games: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.
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
)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
)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).
- Kingpin
- Jedi

- Posts: 1096
- Joined: Fri Sep 13, 2013 7:09 pm
- Projects :: The Sith Wars II
- Location: Denver, CO
- Contact:
Re: Zombie Scripting
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.
