mirror of
https://github.com/PhantomGamesDevelopment/TWM2.git
synced 2026-01-19 19:44:47 +00:00
Deadlock Fix
Fix the deadlocking issue, tweak some of the new zombie AI and speeds.
This commit is contained in:
parent
e5792ecc9a
commit
42d636b4b8
|
|
@ -101,30 +101,36 @@ function ChallengeDownload::onLine(%this, %line) {
|
|||
//////////////////////////////////////////////////
|
||||
|
||||
function doChallengeKillRecording(%sourceObject, %targetObject) {
|
||||
if(%sourceObject.team == %targetObject.team) {
|
||||
//Teamkill = no recorded challenge :)
|
||||
return;
|
||||
}
|
||||
//killed a player?
|
||||
if(isClientControlledPlayer(%targetObject)) {
|
||||
//echo("Kill: "@%sourceObject.client@"/"@%targetObject.lastDamagedImage@"");
|
||||
recordAction(%sourceObject.client, "PKC", "single\t"@%targetObject.lastDamagedImage@"\t1");
|
||||
recordAction(%sourceObject.client, "PKC", "total\t1");
|
||||
}
|
||||
else {
|
||||
//killed a zombie
|
||||
%zType = %targetObject.type;
|
||||
if(!isSet(%zType)) {
|
||||
//illegal target for challenge set, end here
|
||||
return;
|
||||
}
|
||||
recordAction(%sourceObject.client, "ZKC", "total\t1");
|
||||
recordAction(%sourceObject.client, "ZKC", "single\t"@%zType@"\t1");
|
||||
recordAction(%sourceObject.client, "ZKC", "single\t"@%targetObject.lastDamagedImage@"\t"@%zType@"\t1");
|
||||
}
|
||||
if(%sourceObject $= "" || %targetObject $= "") {
|
||||
return;
|
||||
}
|
||||
if(%sourceObject.team == %targetObject.team) {
|
||||
//Teamkill = no recorded challenge :)
|
||||
return;
|
||||
}
|
||||
//killed a player?
|
||||
if(isClientControlledPlayer(%targetObject)) {
|
||||
//echo("Kill: "@%sourceObject.client@"/"@%targetObject.lastDamagedImage@"");
|
||||
recordAction(%sourceObject.client, "PKC", "single\t"@%targetObject.lastDamagedImage@"\t1");
|
||||
recordAction(%sourceObject.client, "PKC", "total\t1");
|
||||
}
|
||||
else {
|
||||
//killed a zombie
|
||||
%zType = %targetObject.type;
|
||||
if(!isSet(%zType)) {
|
||||
//illegal target for challenge set, end here
|
||||
return;
|
||||
}
|
||||
recordAction(%sourceObject.client, "ZKC", "total\t1");
|
||||
recordAction(%sourceObject.client, "ZKC", "single\t"@%zType@"\t1");
|
||||
recordAction(%sourceObject.client, "ZKC", "single\t"@%targetObject.lastDamagedImage@"\t"@%zType@"\t1");
|
||||
}
|
||||
}
|
||||
|
||||
function recordAction(%client, %action, %variables) {
|
||||
if(!%client || %client $= "") {
|
||||
return;
|
||||
}
|
||||
%ymd = formattimestring("yymmdd");
|
||||
%so = %client.TWM2Controller;
|
||||
checkDateOnChallenge(%client);
|
||||
|
|
@ -236,6 +242,9 @@ function allCheckCompletion(%client) {
|
|||
}
|
||||
|
||||
function checkCompletion(%client, %cID) {
|
||||
if(!%client || %client $= "") {
|
||||
return;
|
||||
}
|
||||
%challenge = $Challenges::Challenge[%cID];
|
||||
%cType = trim(getField(%challenge, 0));
|
||||
%cCond = getsubstr(getField(%challenge, 3), 1, strlen(getField(%challenge, 3)));
|
||||
|
|
|
|||
|
|
@ -770,6 +770,9 @@ $Challenge::IsNotMultiTier["SoulsticeBombard"] = true;
|
|||
|
||||
//Core Functions
|
||||
function GameConnection::AllowedToDoNW(%client, %name) {
|
||||
if(!%client || %client $= "") {
|
||||
return 0;
|
||||
}
|
||||
if($Challenge::FlagDisabled[%name]) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -798,6 +801,9 @@ function GameConnection::AllowedToDoNW(%client, %name) {
|
|||
}
|
||||
|
||||
function GameConnection::CheckNWChallengeCompletion(%client, %name) {
|
||||
if(!%client || %client $= "") {
|
||||
return false;
|
||||
}
|
||||
%scriptController = %client.TWM2Core;
|
||||
if(%scriptController.challengeComplete[%name] == 1) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -186,6 +186,10 @@ function postObjectDestroyed(%source, %targetObject, %dType, %dLoc) {
|
|||
//Skip terrain and interiors
|
||||
return;
|
||||
}
|
||||
if((%source.isZombie || %source.isBoss) && !%source.isPlayerZombie) {
|
||||
//Stop here.
|
||||
return;
|
||||
}
|
||||
if(!isObject(%source) || %source $= "") {
|
||||
%SDB = "";
|
||||
%sourceObject = 0;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
//Handles the successive and specific weapon kill listing
|
||||
|
||||
function PerformSuccessiveKills(%player, %damageType) {
|
||||
if(!isObject(%player) || !%player.isAlive()) {
|
||||
return;
|
||||
}
|
||||
cancel(%player.successiveReset);
|
||||
%currentKills = %player.killsinarow2;
|
||||
%currentDTKills = %player.kills[%damageType];
|
||||
|
|
@ -47,6 +50,9 @@ function DoStreakPrint(%player, %kills, %damageType) {
|
|||
}
|
||||
|
||||
function DoSuccessivePrint(%player) {
|
||||
if(!isObject(%player) || !%player.isAlive()) {
|
||||
return;
|
||||
}
|
||||
%client = %player.client;
|
||||
messageClient(%client, 'msgSoundFX', "~wfx/misc/MA1.wav");
|
||||
recordAction(%client, "SKC", %player.successive@"\t1");
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ $Zombie::TypeSpeed[11] = 1200;
|
|||
$Zombie::BaseJumpCooldown = 1500;
|
||||
|
||||
//$Zombie::SpeedMultiplier[#]: An additional multiplier to be applied to the zombie's base speed when calculating the impulse, used to fine tune speed values
|
||||
$Zombie::SpeedMultiplier[2] = 0.6;
|
||||
$Zombie::SpeedMultiplier[2] = 0.95;
|
||||
$Zombie::SpeedMultiplier[3] = 0.8;
|
||||
$Zombie::SpeedMultiplier[4] = 0.75;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,15 +59,32 @@ function RavagerZombieArmor::AI(%datablock, %zombie) {
|
|||
if(!isObject(%zombie) || %zombie.getState() $= "dead") {
|
||||
return;
|
||||
}
|
||||
if(isSet(%zombie.targetedPlayer)) {
|
||||
if(%zombie.targetedPlayer !$= "") {
|
||||
if(!isObject(%zombie.targetedPlayer) || %zombie.targetedPlayer.getState() $= "dead") {
|
||||
%zombie.ambushing = 0;
|
||||
%zombie.fullAttack = 0;
|
||||
%zombie.ambushPosition = 0;
|
||||
%zombie.targetedPlayer = 0;
|
||||
%zombie.targetedPlayer = "";
|
||||
%zombie.hasTarget = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
%targetParams = TWM2Lib_Zombie_Core("lookForTarget", %zombie);
|
||||
%target = getWord(%targetParams, 0);
|
||||
%distance = getWord(%targetParams, 1);
|
||||
if(isObject(%target.player)) {
|
||||
if(%distance <= $zombie::detectDist) {
|
||||
%zombie.hasTarget = 1;
|
||||
%zombie.targetedPlayer = %target.player;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//No target, random movement.
|
||||
%zombie.zombieRmove = schedule(500, %zombie, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %zombie);
|
||||
%zombie.setActionThread("ski", true);
|
||||
}
|
||||
}
|
||||
//
|
||||
if(%zombie.ambushing) {
|
||||
//We're currently in an ambush maneuver, continue moving to position
|
||||
if(vectorDist(%zombie.getPosition(), %zombie.ambushPosition) < 10) {
|
||||
|
|
@ -78,31 +95,37 @@ function RavagerZombieArmor::AI(%datablock, %zombie) {
|
|||
}
|
||||
else {
|
||||
//If the target is near us, break off the ambush and go in for the kill...
|
||||
%distanceToTarget = vectorDist(%zombie.getPosition(), %zombie.targetedPlayer.getPosition());
|
||||
if(%distanceToTarget < 20) {
|
||||
if(!isObject(%zombie.targetedPlayer)) {
|
||||
//Target is dead... Look for a new one.
|
||||
%zombie.targetedPlayer = "";
|
||||
%zombie.hasTarget = 0;
|
||||
%zombie.ambushing = 0;
|
||||
%zombie.fullAttack = 1;
|
||||
%zombie.ambushPosition = 0;
|
||||
%zombie.fullAttack = 0;
|
||||
%zombie.ambushPosition = 0;
|
||||
}
|
||||
else {
|
||||
%distanceToTarget = vectorDist(%zombie.getPosition(), %zombie.targetedPlayer.getPosition());
|
||||
if(%distanceToTarget < 20) {
|
||||
%zombie.ambushing = 0;
|
||||
%zombie.fullAttack = 1;
|
||||
%zombie.ambushPosition = 0;
|
||||
}
|
||||
//Otherwise, keep moving...
|
||||
%datablock.move(%zombie);
|
||||
}
|
||||
//Otherwise, keep moving...
|
||||
%datablock.move(%zombie);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!%zombie.hasTarget) {
|
||||
%targetParams = TWM2Lib_Zombie_Core("lookForTarget", %zombie);
|
||||
%target = getWord(targetParams, 0);
|
||||
%distance = getWord(%targetParams, 1);
|
||||
if(isObject(%target.player)) {
|
||||
if(%distance <= $zombie::detectDist) {
|
||||
%zombie.hasTarget = 1;
|
||||
%zombie.targetedPlayer = %target.player;
|
||||
}
|
||||
}
|
||||
//Outside targeting range, ignore...
|
||||
}
|
||||
if(%zombie.hasTarget) {
|
||||
//Ambush logic, determine if the best plan of action is a ambush, or a direct approach
|
||||
//Ambush logic, determine if the best plan of action is a ambush, or a direct approach
|
||||
if(!isObject(%zombie.targetedPlayer)) {
|
||||
//Target is dead... Look for a new one.
|
||||
%zombie.targetedPlayer = "";
|
||||
%zombie.hasTarget = 0;
|
||||
%zombie.ambushing = 0;
|
||||
%zombie.fullAttack = 0;
|
||||
%zombie.ambushPosition = 0;
|
||||
}
|
||||
else {
|
||||
%distanceToTarget = vectorDist(%zombie.getPosition(), %zombie.targetedPlayer.getPosition());
|
||||
if(%distanceToTarget > 50 && getRandom(1,10) == 1 && !%zombie.ambushing && !%zombie.fullAttack) {
|
||||
//Ambush: Move to a side position from the target, then strike.
|
||||
|
|
@ -118,11 +141,6 @@ function RavagerZombieArmor::AI(%datablock, %zombie) {
|
|||
%datablock.move(%zombie);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//No target, random movement.
|
||||
%zombie.zombieRmove = schedule(500, %zombie, "TWM2Lib_Zombie_Core", "zRandomMoveLoop", %zombie);
|
||||
%zombie.setActionThread("ski", true);
|
||||
}
|
||||
}
|
||||
%datablock.schedule(500, "AI", %zombie);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2805,7 +2805,7 @@ function Armor::onCollision(%this, %obj, %col, %forceVehicleNode) {
|
|||
%obj.onfire = 1;
|
||||
schedule(10, %obj, "burnloop", %obj);
|
||||
}
|
||||
if(%col.getState() $= "Dead" && (!%obj.isZombie && !%col.isZombie)) {
|
||||
if(%col.getState() $= "Dead" && (!%obj.isZombie && !%obj.isBoss)) {
|
||||
%obj.lasttouchedcorpse = %col;
|
||||
%gotSomething = false;
|
||||
// it's corpse-looting time!
|
||||
|
|
|
|||
Loading…
Reference in a new issue