Always snap to grid

Legacy:EricBlade/ZombieZilla

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

ZombieZilla[edit]

Someone asked me to see about making the enemies in Land of the Dead larger, and someone asked me about making them smaller, so I wrote a mutator that does both :) This is a lot more fun than I originally thought it would be, and thought I'd give it out here. I'd love to hear of anyone implementing it for other games, and would love to see some shots, if anyone bothers :)

class ZombieZilla extends Mutator;
 
var config float ZombieScale;
var config bool bRandomScale;
 
function PostBeginPlay() {
	local int Waves;
	if(ZombieScale == 0 && bRandomScale == false) ZombieScale = 2.0;
	if(ZombieScale > 1.0 && bRandomScale == false) Waves = 1;
	else Waves = 10;
	if(Level.Game.Class == class'DOTZGame.DOTZInvasion') {
		log("ZombieZilla playing on top of regular Invasion Game");
		DOTZInvasion(Level.Game).InitialWaveSize = Waves;
		DOTZInvasion(Level.Game).WaveSizeIncrement = Waves;
	}
	if(Level.Game.Class == class'BladeIN.BladeIN') {
		log("ZombieZilla playing on Blade's Invasion Game.. hope this doesn't fuck up your settings!");
		BladeIN(Level.Game).InitialWaveSize = Waves;
		BladeIN(Level.Game).WaveSizeIncrement = Waves;
		//BladeIN(Level.Game).MaxInPlay = 1;
	}
	// TODO: This causes a failure if the BladeIN package isn't installed.. so,
	// need to find a way to gracefully fail
	SaveConfig();
}
function bool CheckReplacement(Actor what, out byte bSuperRelevant) {
	local ZombiePawnBase x;
	local float zs;
	x = ZombiePawnBase(what);
	if(x != None) {
		if(bRandomScale == true) zs = RandRange(0.75, 1.5);
		else zs = ZombieScale;
	    log("ZombieZilla: scale="$zs);
 
		x.SetCollisionSize(x.default.CollisionRadius * zs, x.default.collisionheight * zs);
		x.SetDrawScale(zs);
		x.SetLocation(x.Location);
		if(zs > 1) x.DiffDamageMultiplier = 0.5;
		else x.DiffDamageMultiplier = 2;
		x.DiffDamageMultiplier = 5;
	}
	return true;
}