More Fixes & Changes

Undid the movement time changes due to too many issues. Fixed an issue
in the collision that should hopefully fix the deadlocking.
This commit is contained in:
Robert Fritzen 2017-12-23 14:15:41 -06:00
parent 8f2a904135
commit e5792ecc9a
11 changed files with 40 additions and 34 deletions

View file

@ -69,10 +69,6 @@ PLEASE NOTE: I've moved all old changelogs into the version_history folder. This
* Zombie Changes
* Global
* Massive "spring cleaning" of the zombie code files, fixing a bunch of bad coding practices and a few logic errors.
* Redid the zombie targeting and movement methods to make them much "smoother"
* Scaled down zombie movement times on some types to smooth movement
* To compensate for speed, these zombies saw a reduction of total speed to match the factor
* This should result in smoother looking movement at the same speed
* Moved all functioning into a core control script, added additional modifiers and flags to grant more customizability to zombies
* **WARNING: Only specific zombies are functional at this moment in time**
* Ravager

View file

@ -182,7 +182,7 @@ function TWM2Lib_Zombie_Core(%functionName, %arg1, %arg2, %arg3, %arg4) {
%vec = %rx @ " " @ %ry @ " " @ 0;
%arg1.direction = vectorNormalize(%vec);
%arg1.Mnum = getRandom(1, 20);
%arg1.zombieRmove = schedule(%arg1.updateTimeFrequency, %arg1, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %arg1);
%arg1.zombieRmove = schedule(500, %arg1, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %arg1);
//zrandommoveloop(%zombie): Moves the zombies around in a random direction
case "zrandommoveloop":
@ -202,10 +202,10 @@ function TWM2Lib_Zombie_Core(%functionName, %arg1, %arg2, %arg3, %arg4) {
%vector = vectorScale(%vec, %speed);
%arg1.applyImpulse(%arg1.direction, %vector);
%arg1.Mnum -= 1;
%arg1.zombieRmove = schedule(%arg1.updateTimeFrequency, %arg1, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %arg1);
%arg1.zombieRmove = schedule(500, %arg1, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %arg1);
}
else {
%arg1.zombieRmove = schedule(%arg1.updateTimeFrequency, %arg1, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %arg1);
%arg1.zombieRmove = schedule(500, %arg1, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %arg1);
}
//cureInfection(%player): Cures the zombie infection

View file

@ -74,7 +74,7 @@ function DemonZombieArmor::AI(%datablock, %zombie) {
if(!isObject(%zombie.targetedPlayer) || %zombie.targetedPlayer.getState() $= "dead") {
%zombie.targetedPlayer = 0;
%zombie.hasTarget = 0;
%datablock.schedule(%zombie.updateTimeFrequency, "AI", %zombie);
%datablock.schedule(500, "AI", %zombie);
return;
}
%tPos = %zombie.targetedPlayer.getPosition();
@ -100,10 +100,10 @@ function DemonZombieArmor::AI(%datablock, %zombie) {
}
//Nothing to hunt... random movement...
if(!%zombie.hasTarget) {
%zombie.zombieRmove = schedule(%zombie.updateTimeFrequency, %zombie, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %zombie);
%zombie.zombieRmove = schedule(500, %zombie, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %zombie);
}
}
%datablock.schedule(%zombie.updateTimeFrequency, "AI", %zombie);
%datablock.schedule(500, "AI", %zombie);
}
function DemonZombieArmor::move(%datablock, %zombie) {

View file

@ -179,7 +179,7 @@ function DemonMotherZombieArmor::AIRoutine(%datablock, %zombie) {
%zombie.justmelee = 0;
}
else {
%zombie.aiRoutine = %datablock.schedule(%zombie.updateTimeFrequency, 0, "AIRoutine", %zombie);
%zombie.aiRoutine = %datablock.schedule(500, 0, "AIRoutine", %zombie);
}
}
@ -196,7 +196,7 @@ function DemonMotherZombieArmor::Move(%datablock, %zombie) {
%vector = %x@" "@%y@" 150";
%zombie.applyImpulse(%zombie.getPosition(), %vector);
%zombie.aiRoutine = %datablock.schedule(%zombie.updateTimeFrequency, 0, "AIRoutine", %zombie);
%zombie.aiRoutine = %datablock.schedule(500, 0, "AIRoutine", %zombie);
}
function DemonMotherZombieArmor::AttackFunction(%datablock, %zombie, %attackFunction, %target) {

View file

@ -180,7 +180,7 @@ function LordZombieArmor::AI(%datablock, %zombie) {
%zPos = %zombie.getPosition();
//Are we currently in the firing weapon state?
if(%zombie.firingWeapon) {
%datablock.schedule(%zombie.updateTimeFrequency, "AI", %zombie);
%datablock.schedule(500, "AI", %zombie);
return;
}
//Check if we are currently shielding
@ -209,7 +209,7 @@ function LordZombieArmor::AI(%datablock, %zombie) {
TWM2Lib_Zombie_Core("setZFlag", %zombie, "canShield", 0);
schedule(25000, 0, TWM2Lib_Zombie_Core, "setZFlag", %zombie, "canShield", 1);
}
%datablock.schedule(%zombie.updateTimeFrequency, "AI", %zombie);
%datablock.schedule(500, "AI", %zombie);
return;
}
//Am I engaged with something?
@ -220,7 +220,7 @@ function LordZombieArmor::AI(%datablock, %zombie) {
%zombie.hasTarget = 0;
%zombie.movePoint = 0;
%zombie.movingToPosition = 0;
%datablock.schedule(%zombie.updateTimeFrequency, "AI", %zombie);
%datablock.schedule(500, "AI", %zombie);
return;
}
//Is it a tank?
@ -344,10 +344,10 @@ function LordZombieArmor::AI(%datablock, %zombie) {
}
//Nothing to hunt... random movement...
if(!%zombie.hasTarget) {
%zombie.zombieRmove = schedule(%zombie.updateTimeFrequency, %zombie, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %zombie);
%zombie.zombieRmove = schedule(500, %zombie, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %zombie);
}
}
%datablock.schedule(%zombie.updateTimeFrequency, "AI", %zombie);
%datablock.schedule(500, "AI", %zombie);
}
function LordZombieArmor::Move(%datablock, %zombie) {

View file

@ -58,8 +58,10 @@ function ZombieArmor::armorCollisionFunction(%datablock, %zombie, %colPlayer) {
%pushVector = vectorscale(%colPlayer.getvelocity(), 100);
%colPlayer.applyimpulse(%colPlayer.getposition(), %pushVector);
if(%causeInfect) {
%colPlayer.Infected = 1;
%colPlayer.InfectedLoop = schedule(10, %colPlayer, "TWM2Lib_Zombie_Core", "InfectLoop", %colPlayer, "impact");
if(!%colPlayer.Infected) {
%colPlayer.Infected = 1;
%colPlayer.InfectedLoop = schedule(10, %colPlayer, "TWM2Lib_Zombie_Core", "InfectLoop", %colPlayer, "impact");
}
}
%colPlayer.damage(0, %colPlayer.getPosition(), %total, $DamageType::Zombie);
}

View file

@ -94,8 +94,10 @@ function RapierZombieArmor::armorCollisionFunction(%datablock, %zombie, %colPlay
else {
%colPlayer.damage(0, %colPlayer.getPosition(), %total, $DamageType::Zombie);
if(%causeInfect) {
%colPlayer.Infected = 1;
%colPlayer.InfectedLoop = schedule(10, %colPlayer, "TWM2Lib_Zombie_Core", "InfectLoop", %colPlayer, "impact");
if(!%colPlayer.Infected) {
%colPlayer.Infected = 1;
%colPlayer.InfectedLoop = schedule(10, %colPlayer, "TWM2Lib_Zombie_Core", "InfectLoop", %colPlayer, "impact");
}
}
}
}
@ -108,7 +110,7 @@ function RapierZombieArmor::AI(%datablock, %zombie) {
%zombie.setHeat(999);
%zombie.setActionThread("scoutRoot",true);
%datablock.move(%zombie);
%datablock.schedule(%zombie.updateTimeFrequency, "AI", %zombie);
%datablock.schedule(500, "AI", %zombie);
}
function RapierZombieArmor::move(%datablock, %zombie) {

View file

@ -39,8 +39,10 @@ function RavagerZombieArmor::armorCollisionFunction(%datablock, %zombie, %colPla
%pushVector = vectorscale(%colPlayer.getvelocity(), 100);
%colPlayer.applyimpulse(%colPlayer.getposition(), %pushVector);
if(%causeInfect) {
%colPlayer.Infected = 1;
%colPlayer.InfectedLoop = schedule(10, %colPlayer, "TWM2Lib_Zombie_Core", "InfectLoop", %colPlayer, "impact");
if(!%colPlayer.Infected) {
%colPlayer.Infected = 1;
%colPlayer.InfectedLoop = schedule(10, %colPlayer, "TWM2Lib_Zombie_Core", "InfectLoop", %colPlayer, "impact");
}
}
%colPlayer.damage(0, %colPlayer.getPosition(), %total, $DamageType::Zombie);
}
@ -118,11 +120,11 @@ function RavagerZombieArmor::AI(%datablock, %zombie) {
}
else {
//No target, random movement.
%zombie.zombieRmove = schedule(%zombie.updateTimeFrequency, %zombie, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %zombie);
%zombie.zombieRmove = schedule(500, %zombie, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %zombie);
%zombie.setActionThread("ski", true);
}
}
%datablock.schedule(%zombie.updateTimeFrequency, "AI", %zombie);
%datablock.schedule(500, "AI", %zombie);
}
function RavagerZombieArmor::Move(%datablock, %zombie) {

View file

@ -58,8 +58,10 @@ function ShifterZombieArmor::armorCollisionFunction(%datablock, %zombie, %colPla
%pushVector = vectorscale(%colPlayer.getvelocity(), 100);
%colPlayer.applyimpulse(%colPlayer.getposition(), %pushVector);
if(%causeInfect) {
%colPlayer.Infected = 1;
%colPlayer.InfectedLoop = schedule(10, %colPlayer, "TWM2Lib_Zombie_Core", "InfectLoop", %colPlayer, "impact");
if(!%colPlayer.Infected) {
%colPlayer.Infected = 1;
%colPlayer.InfectedLoop = schedule(10, %colPlayer, "TWM2Lib_Zombie_Core", "InfectLoop", %colPlayer, "impact");
}
}
%colPlayer.damage(0, %colPlayer.getPosition(), %total, $DamageType::Zombie);
}
@ -117,7 +119,7 @@ function ShifterZombieArmor::Move(%datablock, %zombie) {
}
else if(%zombie.hastarget == 1) {
%zombie.hastarget = 0;
%zombie.zombieRmove = schedule(%zombie.updateTimeFrequency, %zombie, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %zombie);
%zombie.zombieRmove = schedule(500, %zombie, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %zombie);
}
%zombie.moveloop = %datablock.schedule(%zombie.updateTimeFrequency, "Move", %zombie);
%zombie.moveloop = %datablock.schedule(500, "Move", %zombie);
}

View file

@ -160,7 +160,7 @@ function SniperZombieArmor::AI(%datablock, %zombie) {
}
}
//No targets... Let's just wait.
%zombie.aiLoop = %datablock.schedule(%zombie.updateTimeFrequency, "AI", %zombie);
%zombie.aiLoop = %datablock.schedule(500, "AI", %zombie);
}
function SniperZombieArmor::Move(%datablock, %zombie) {

View file

@ -58,8 +58,10 @@ function SummonerZombieArmor::armorCollisionFunction(%datablock, %zombie, %colPl
%pushVector = vectorscale(%colPlayer.getvelocity(), 100);
%colPlayer.applyimpulse(%colPlayer.getposition(), %pushVector);
if(%causeInfect) {
%colPlayer.Infected = 1;
%colPlayer.InfectedLoop = schedule(10, %colPlayer, "TWM2Lib_Zombie_Core", "InfectLoop", %colPlayer, "impact");
if(!%colPlayer.Infected) {
%colPlayer.Infected = 1;
%colPlayer.InfectedLoop = schedule(10, %colPlayer, "TWM2Lib_Zombie_Core", "InfectLoop", %colPlayer, "impact");
}
}
%colPlayer.damage(0, %colPlayer.getPosition(), %total, $DamageType::Zombie);
}
@ -102,7 +104,7 @@ function SummonerZombieArmor::AI(%datablock, %zombie) {
schedule($Zombie::Summoner_Cooldown, 0, TWM2Lib_Zombie_Core, "setZFlag", %zombie, "canSummon", 1);
}
}
%datablock.schedule(%zombie.updateTimeFrequency, "AI", %zombie);
%datablock.schedule(500, "AI", %zombie);
}
function SummonerZombieArmor::Move(%datablock, %zombie) {