From e5792ecc9a4e8fc87b3bd776384b3244a5ec72b4 Mon Sep 17 00:00:00 2001 From: Robert Fritzen Date: Sat, 23 Dec 2017 14:15:41 -0600 Subject: [PATCH] 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. --- README.md | 4 ---- scripts/TWM2/Zombie/ZombieCore.cs | 6 +++--- scripts/TWM2/Zombie/ZombieTypes/Demon.cs | 6 +++--- scripts/TWM2/Zombie/ZombieTypes/DemonLord.cs | 4 ++-- scripts/TWM2/Zombie/ZombieTypes/Lord.cs | 10 +++++----- scripts/TWM2/Zombie/ZombieTypes/Normal.cs | 6 ++++-- scripts/TWM2/Zombie/ZombieTypes/Rapier.cs | 8 +++++--- scripts/TWM2/Zombie/ZombieTypes/Ravager.cs | 10 ++++++---- scripts/TWM2/Zombie/ZombieTypes/Shifter.cs | 10 ++++++---- scripts/TWM2/Zombie/ZombieTypes/Sniper.cs | 2 +- scripts/TWM2/Zombie/ZombieTypes/Summoner.cs | 8 +++++--- 11 files changed, 40 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 114180c..c77732e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/scripts/TWM2/Zombie/ZombieCore.cs b/scripts/TWM2/Zombie/ZombieCore.cs index 3f98bec..ea60d8f 100644 --- a/scripts/TWM2/Zombie/ZombieCore.cs +++ b/scripts/TWM2/Zombie/ZombieCore.cs @@ -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 diff --git a/scripts/TWM2/Zombie/ZombieTypes/Demon.cs b/scripts/TWM2/Zombie/ZombieTypes/Demon.cs index b220d28..8420b86 100644 --- a/scripts/TWM2/Zombie/ZombieTypes/Demon.cs +++ b/scripts/TWM2/Zombie/ZombieTypes/Demon.cs @@ -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) { diff --git a/scripts/TWM2/Zombie/ZombieTypes/DemonLord.cs b/scripts/TWM2/Zombie/ZombieTypes/DemonLord.cs index 04b706c..1938266 100644 --- a/scripts/TWM2/Zombie/ZombieTypes/DemonLord.cs +++ b/scripts/TWM2/Zombie/ZombieTypes/DemonLord.cs @@ -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) { diff --git a/scripts/TWM2/Zombie/ZombieTypes/Lord.cs b/scripts/TWM2/Zombie/ZombieTypes/Lord.cs index d94f1f7..a7a5a32 100644 --- a/scripts/TWM2/Zombie/ZombieTypes/Lord.cs +++ b/scripts/TWM2/Zombie/ZombieTypes/Lord.cs @@ -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) { diff --git a/scripts/TWM2/Zombie/ZombieTypes/Normal.cs b/scripts/TWM2/Zombie/ZombieTypes/Normal.cs index 51ec938..4494bad 100644 --- a/scripts/TWM2/Zombie/ZombieTypes/Normal.cs +++ b/scripts/TWM2/Zombie/ZombieTypes/Normal.cs @@ -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); } diff --git a/scripts/TWM2/Zombie/ZombieTypes/Rapier.cs b/scripts/TWM2/Zombie/ZombieTypes/Rapier.cs index c9e4633..67dff3e 100644 --- a/scripts/TWM2/Zombie/ZombieTypes/Rapier.cs +++ b/scripts/TWM2/Zombie/ZombieTypes/Rapier.cs @@ -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) { diff --git a/scripts/TWM2/Zombie/ZombieTypes/Ravager.cs b/scripts/TWM2/Zombie/ZombieTypes/Ravager.cs index c4a66c5..f5e3dcb 100644 --- a/scripts/TWM2/Zombie/ZombieTypes/Ravager.cs +++ b/scripts/TWM2/Zombie/ZombieTypes/Ravager.cs @@ -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) { diff --git a/scripts/TWM2/Zombie/ZombieTypes/Shifter.cs b/scripts/TWM2/Zombie/ZombieTypes/Shifter.cs index 0f91d45..1debc5f 100644 --- a/scripts/TWM2/Zombie/ZombieTypes/Shifter.cs +++ b/scripts/TWM2/Zombie/ZombieTypes/Shifter.cs @@ -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); } \ No newline at end of file diff --git a/scripts/TWM2/Zombie/ZombieTypes/Sniper.cs b/scripts/TWM2/Zombie/ZombieTypes/Sniper.cs index fb79af4..801d5b7 100644 --- a/scripts/TWM2/Zombie/ZombieTypes/Sniper.cs +++ b/scripts/TWM2/Zombie/ZombieTypes/Sniper.cs @@ -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) { diff --git a/scripts/TWM2/Zombie/ZombieTypes/Summoner.cs b/scripts/TWM2/Zombie/ZombieTypes/Summoner.cs index edd6bc8..462cb44 100644 --- a/scripts/TWM2/Zombie/ZombieTypes/Summoner.cs +++ b/scripts/TWM2/Zombie/ZombieTypes/Summoner.cs @@ -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) {