diff --git a/README.md b/README.md index 3c4140b..3bd96b1 100644 --- a/README.md +++ b/README.md @@ -70,9 +70,11 @@ PLEASE NOTE: For the Legacy (Pre-GitHub Versions) Changelogs, please see LEGACY * This change also applies to the 'From The Top' Challenge Category * In-Game, Missions have been renamed to Operations * Fixed the incorrect internal tags for Lordranius Trevor +* Depricated Weekly and Monthly challenges, we will only issue daily challenges from this point forward * Lib'd the TWM2 MainControl file and PGD Connect Support files to recover some functions * The F2 Menu now detects PGD Connected accounts and will no longer show the option to PGD Connect to already connected users * No more scary scientific notion when performing /checkstats or using the F2 menu to view player experience +* Both /checkStats and the F2 menu pages now display what rank number you are at along with the rank name * Addressed a security issue regarding players who are "attempting" to load code via universal rank files. * Nice try DDDX, but your fem-phantom fantasies will NOT be happening... ;) * Addressed the bug that would allow Vardison 2.0 to summon infinite minions @@ -125,7 +127,10 @@ PLEASE NOTE: For the Legacy (Pre-GitHub Versions) Changelogs, please see LEGACY * Shifter Zombies now have a randomzied element in their teleport method * Fixed a code bug with Lord Yvex which caused his death pulse to be replaced by nightmare missiles * Officer Weapons no longer require a rank to use, you only need to reach the officer level in question and you've got it! +* Addressed an additional Horde 3 out-of-game zombie spawning crash +* Cleaned up the player kill logic and moved all TWM2 specific damage and death functioning to a separate file * Addressed the bug preventing the challenges for reaching officer ranks from completing +* Addressed a bug in which vehicle bosses were not recording damage from players to the boss system correctly * Weapon Balancing Pass * Grapple Hook * Slowed down the attacher projectile a bit, lowering the range diff --git a/scripts/HordeGame.cs b/scripts/HordeGame.cs index 05759e8..cebebc5 100644 --- a/scripts/HordeGame.cs +++ b/scripts/HordeGame.cs @@ -600,6 +600,12 @@ function HordeGame::gameOver(%game) { $HordeGame::Zombiecount = 0; $HordeGame::LivingCount = 0; $HordeGame::CanSpawnZombies = 1; + + for(%i = 0; $HordeSpawnSched[%i] !$= ""; %i++) { + if(isEventPending($HordeSpawnSched[%i])) { + cancel($HordeSpawnSched[%i]); + } + } for(%i = 0; %i < ClientGroup.getCount(); %i ++) { %client = ClientGroup.getObject(%i); @@ -706,7 +712,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, 1); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, 1); } case 2: for(%i = 0; %i < 25; %i++) { @@ -714,7 +720,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, 1); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, 1); } case 3: for(%i = 0; %i < 30; %i++) { @@ -722,7 +728,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, 1); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, 1); } case 4: for(%i = 0; %i < 35; %i++) { @@ -730,7 +736,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, 1); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, 1); } case 5: for(%i = 0; %i < 40; %i++) { @@ -738,7 +744,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, 1); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, 1); } case 6: for(%i = 0; %i < 20; %i++) { @@ -747,7 +753,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 7: for(%i = 0; %i < 25; %i++) { @@ -756,7 +762,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 8: for(%i = 0; %i < 30; %i++) { @@ -765,7 +771,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 9: for(%i = 0; %i < 35; %i++) { @@ -774,7 +780,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 10: for(%i = 0; %i < 40; %i++) { @@ -783,7 +789,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 11: for(%i = 0; %i < 20; %i++) { @@ -792,7 +798,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 12: for(%i = 0; %i < 25; %i++) { @@ -801,7 +807,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 13: for(%i = 0; %i < 30; %i++) { @@ -810,7 +816,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 14: for(%i = 0; %i < 35; %i++) { @@ -819,7 +825,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 15: for(%i = 0; %i < 40; %i++) { @@ -828,7 +834,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 16: for(%i = 0; %i < 20; %i++) { @@ -837,7 +843,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 17: for(%i = 0; %i < 25; %i++) { @@ -846,7 +852,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 18: for(%i = 0; %i < 30; %i++) { @@ -855,7 +861,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 19: for(%i = 0; %i < 35; %i++) { @@ -864,7 +870,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 20: for(%i = 0; %i < 40; %i++) { @@ -873,7 +879,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 21: for(%i = 0; %i < 20; %i++) { @@ -882,7 +888,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 22: for(%i = 0; %i < 25; %i++) { @@ -891,7 +897,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 23: for(%i = 0; %i < 30; %i++) { @@ -900,7 +906,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 24: for(%i = 0; %i < 35; %i++) { @@ -909,7 +915,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } //The Rapier wave :D case 25: @@ -918,7 +924,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, 5); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, 5); } case 26: for(%i = 0; %i < 30; %i++) { @@ -933,7 +939,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 27: for(%i = 0; %i < 35; %i++) { @@ -948,7 +954,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 28: for(%i = 0; %i < 40; %i++) { @@ -963,7 +969,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 29: for(%i = 0; %i < 45; %i++) { @@ -978,7 +984,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 30: for(%i = 0; %i < 50; %i++) { @@ -993,7 +999,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 31: for(%i = 0; %i < 20; %i++) { @@ -1008,7 +1014,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 32: for(%i = 0; %i < 25; %i++) { @@ -1023,7 +1029,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 33: for(%i = 0; %i < 30; %i++) { @@ -1038,7 +1044,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 34: for(%i = 0; %i < 35; %i++) { @@ -1053,7 +1059,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 35: for(%i = 0; %i < 40; %i++) { @@ -1068,7 +1074,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 36: for(%i = 0; %i < 25; %i++) { @@ -1083,7 +1089,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 37: for(%i = 0; %i < 30; %i++) { @@ -1098,7 +1104,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 38: for(%i = 0; %i < 35; %i++) { @@ -1113,7 +1119,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 39: for(%i = 0; %i < 40; %i++) { @@ -1128,7 +1134,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 40: for(%i = 0; %i < 40; %i++) { @@ -1143,7 +1149,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } //The Lord wave :D case 41: @@ -1152,7 +1158,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, 3); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, 3); } //The Lord wave, 2.0 :D case 42: @@ -1161,7 +1167,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, 3); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, 3); } //Slasher Wave case 43: @@ -1170,7 +1176,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, 11); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, 11); } case 44: for(%i = 0; %i < 40; %i++) { @@ -1185,7 +1191,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 45: for(%i = 0; %i < 40; %i++) { @@ -1200,7 +1206,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 46: for(%i = 0; %i < 45; %i++) { @@ -1215,7 +1221,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } case 47: for(%i = 0; %i < 50; %i++) { @@ -1230,7 +1236,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, %type); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, %type); } //The sniper wave :p case 48: @@ -1239,7 +1245,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, 9); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, 9); } //The ravie wave, V2.0 :p case 49: @@ -1248,7 +1254,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, 2); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, 2); } //ZOMG!!!! Demon LORDS!!! RUN case 50: @@ -1257,7 +1263,7 @@ function StartHordeZombies(%mission, %wave) { %final = vectoradd($HordeGame::ZombieStartPt[%mission, %pt], TWM2Lib_MainControl("getRandomPosition", 10 TAB 1)); $HordeGame::Zombiecount++; %time = 1000 * getRandom(1, 60); - schedule(%time, 0, "HordeSpawnZombies", %final, 6); + $HordeSpawnSched[%i] = schedule(%time, 0, "HordeSpawnZombies", %final, 6); } default: error("Horde: Wave Error, Wave "@%wave@" is unknown on "@%mission@""); diff --git a/scripts/TWM2/ChatCommands/Public.cs b/scripts/TWM2/ChatCommands/Public.cs index f6975fc..113216e 100644 --- a/scripts/TWM2/ChatCommands/Public.cs +++ b/scripts/TWM2/ChatCommands/Public.cs @@ -1114,11 +1114,11 @@ function parsePublicCommands(%sender, %command, %args) { } } if(%Stats >= $Ranks::MinPoints[$Rank::RankCount]) { - messageClient(%sender, 'MsgClient', "\c2Your Rank is "@%Rank@", You Currently Have "@printCurrentEXP(%sender)@" XP."); + messageClient(%sender, 'MsgClient', "\c2Your Rank is "@%Rank@" ("@%clientController.rankNumber@"), You Currently Have "@printCurrentEXP(%sender)@" XP."); return 1; } else { - messageClient(%sender, 'MsgClient', "\c2Your Rank is "@%Rank@", You Currently Have "@printCurrentEXP(%sender)@" XP. Your next rank is "@%nextrank@" and you need "@(%nextrankXP - %stats)@" XP."); + messageClient(%sender, 'MsgClient', "\c2Your Rank is "@%Rank@" ("@%clientController.rankNumber@"), You Currently Have "@printCurrentEXP(%sender)@" XP. Your next rank is "@%nextrank@" and you need "@(%nextrankXP - %stats)@" XP."); return 1; } } @@ -1136,7 +1136,7 @@ function parsePublicCommands(%sender, %command, %args) { } %Rank = ""@$Prestige::Name[%targetController.officer]@""@%targetController.rank@""; %Stats = printCurrentEXP(%target); - messageClient(%sender, 'MsgClient', "\c2"@%target.namebase@"'s Rank is "@%Rank@" and "@%target.namebase@"'s XP is "@%stats@"."); + messageClient(%sender, 'MsgClient', "\c2"@%target.namebase@"'s Rank is "@%Rank@" ("@%targetController.rankNumber@") and "@%target.namebase@"'s XP is "@%stats@"."); return 1; } diff --git a/scripts/TWM2/ExteriorFunctioning/ArmorDamageEffects.cs b/scripts/TWM2/ExteriorFunctioning/ArmorDamageEffects.cs deleted file mode 100644 index 0550b72..0000000 --- a/scripts/TWM2/ExteriorFunctioning/ArmorDamageEffects.cs +++ /dev/null @@ -1,114 +0,0 @@ -datablock ParticleData(burnParticle) { - dragCoeffiecient = 0.0; - gravityCoefficient = -0.1; - inheritedVelFactor = 0.1; - - lifetimeMS = 500; - lifetimeVarianceMS = 50; - - textureName = "special/cloudflash"; - - spinRandomMin = -10.0; - spinRandomMax = 10.0; - - colors[0] = "1 0.18 0.03 0.4"; - colors[1] = "1 0.18 0.03 0.3"; - colors[2] = "1 0.18 0.03 0.0"; - sizes[0] = 2.0; - sizes[1] = 1.0; - sizes[2] = 0.8; - times[0] = 0.0; - times[1] = 0.6; - times[2] = 1.0; -}; - -datablock ParticleEmitterData(burnEmitter) { - ejectionPeriodMS = 3; - periodVarianceMS = 0; - - ejectionOffset = 0.2; - ejectionVelocity = 10.0; - velocityVariance = 0.0; - - thetaMin = 0.0; - thetaMax = 10.0; - - particles = "burnParticle"; -}; - -function burnloop(%obj){ - if(!isobject(%obj)) { - return; - } - if(%obj.onfire == 0) { - return; - } - if(%obj.firecount >= %obj.maxfirecount){ - %obj.firecount = ""; - %obj.maxfirecount = 0; - %obj.onfire = 0; - return; - } - else { - %obj.damage(0, %obj.getposition(), 0.01, $DamageType::Burn); - %obj.lastDamagedImage = "flamerImage"; - %fire = new ParticleEmissionDummy(){ - position = vectoradd(%obj.getPosition(),"0 0 0.5"); - dataBlock = "defaultEmissionDummy"; - emitter = "BurnEmitter"; - }; - MissionCleanup.add(%fire); - %fire.schedule(100, "delete"); - %obj.firecount++; - schedule(100, %obj, "burnloop", %obj); - } -} - -function ApplyEMP(%client) { - if(%client.isEMPd) { - //applying second emp = laggy + bad - return; - } - %client.isEMPd = 1; - EMPEKill(%client.player); - //echo("EMP: applied EMP to "@%client@" - "@%client.player@""); -} - -function KillEMP(%client) { - %client.isEMPd = 0; - %client.player.stopZap(); - messageClient(%client, 'msgDieEMP', "\c5Armor: Electronic Stability has returned."); - //echo("EMP: kill EMP: "@%client@""); -} - -function EMPEKill(%obj) { - if(%obj.client.isEMPd) { - if(!isObject(%obj) || %obj.getState() $= "Dead") { - //echo("EMP: "@%obj@" dead, sending Re-EMP to "@%obj.client@""); - ReEMPLoop(%obj.client); - return; - } - %obj.setEnergyLevel(0.0); - %obj.zapObject(); - schedule(100, 0, "EMPEKill", %obj); - } - else { - %obj.stopZap(); - return; - } -} - -function ReEMPLoop(%client) { - if(!%client.isEMPd) { - //echo("EMP: RE-EMP: "@%client@" no longer EMP"); - return; - } - if(!isObject(%client.player) || %client.player.getState() $= "Dead") { - //echo("EMP: RE: dead, trying to re-loop on "@%client@""); - schedule(500, 0, "ReEMPLoop", %client); - return; - } - EMPLoop(%client.player); - EMPEKill(%client.player); - //echo("EMP: Re-EMP: "@%client@" - "@%client.player@""); -} diff --git a/scripts/TWM2/LoadMod.cs b/scripts/TWM2/LoadMod.cs index 0d0d252..afb54d2 100644 --- a/scripts/TWM2/LoadMod.cs +++ b/scripts/TWM2/LoadMod.cs @@ -11,6 +11,7 @@ exec("serverControl.cs"); //Server Settings exec("scripts/TWM2/Systems/Directorate.cs"); //Client Container Objects exec("scripts/TWM2/Systems/AdvancedRankSystem.cs"); //Adv. Ranks exec("scripts/TWM2/Systems/MainControl.cs"); //TWM2 Core Functions +exec("scripts/TWM2/Systems/ObjectDamage.cs"); //Object Damage Functioning exec("scripts/TWM2/Systems/Scoremenucmds.cs"); //Score Menu exec("scripts/TWM2/Systems/BossSystem.cs"); //Bosses exec("scripts/TWM2/Systems/Medals.cs"); //Medals @@ -65,7 +66,6 @@ exec("scripts/TWM2/ExteriorFunctioning/killTrigger.cs"); //TWM2 Kill Trigger exec("scripts/TWM2/ExteriorFunctioning/BloodEffects.cs");//TWM2 Gore Mod exec("scripts/TWM2/ExteriorFunctioning/ProtPatch.cs"); //Alv's CCM Patch exec("scripts/TWM2/ExteriorFunctioning/PConFunctions.cs");//P-Con Functions 1.7 -exec("scripts/TWM2/ExteriorFunctioning/ArmorDamageEffects.cs");//Loop Damages exec("scripts/TWM2/ExteriorFunctioning/cmdArmor.cs"); //cmdArmor patch //Chat Commands diff --git a/scripts/TWM2/Systems/DChalg.cs b/scripts/TWM2/Systems/DChalg.cs index 7e085e0..6672245 100644 --- a/scripts/TWM2/Systems/DChalg.cs +++ b/scripts/TWM2/Systems/DChalg.cs @@ -51,15 +51,16 @@ function downloadChallenges_Manual() { } function ChallengeDownload::onConnected(%this) { - %this.send(%this.request); + %this.send(%this.request); } function ChallengeDownload::onConnectFailed( %this ) { - error("Challenges: Connection failed"); + error("Challenges: Connection failed"); } function ChallengeDownload::onDisconnect(%this) { - %this.delete(); + $Challenge::PerformingTimeUpdateCall = 0; + %this.delete(); } function ChallengeDownload::onLine(%this, %line) { @@ -75,11 +76,8 @@ function ChallengeDownload::onLine(%this, %line) { if (strstr(%line, "#TIME ") != -1) { //expire date line %line = strReplace(%line, "#TIME ", ""); - echo("* Time Line: "@getField(%line, 1)@" -> "@getField(%line, 0)@" / "@getField(%line, 3)@" -> "@getField(%line, 2)@""); - $CurrentStartOfMonth = getField(%line, 1); - $CurrentMonthlyChallengeExpire = getField(%line, 0); - $CurrentWeeklyChallengeExpire = getField(%line, 2); //aka: end of week - $CurrentStartOfWeek = getField(%line, 3); + echo("* Time Line: "@getWord(%line, 0)); + $TomorrowDate = getWord(%line, 0); return; } else if (strstr(%line, "#CHLG ") != -1) { @@ -129,6 +127,7 @@ function doChallengeKillRecording(%sourceObject, %targetObject) { function recordAction(%client, %action, %variables) { %ymd = formattimestring("yymmdd"); %so = %client.TWM2Controller; + checkDateOnChallenge(%client); //echo(""@%client@" - "@%action@" - "@%variables@""); // switch$(%action) { @@ -206,7 +205,6 @@ function recordAction(%client, %action, %variables) { //no action recorded } allCheckCompletion(%client); - updateChallengeFile(%client); } function cleanChallenges() { @@ -232,16 +230,9 @@ function AddToChallenges(%line) { } function allCheckCompletion(%client) { - for(%i = 1; isSet($Challenges::Challenge[%i]); %i++) { - %cType = getField($Challenges::Challenge[%i], 0); - if(%cType == 1) { - checkCompletion(%client, %i); //daily - } - else { - checkMultiCompletion(%client, %i); - } - } - // + for(%i = 1; isSet($Challenges::Challenge[%i]); %i++) { + checkCompletion(%client, %i); + } } function checkCompletion(%client, %cID) { @@ -380,380 +371,81 @@ function checkCompletion(%client, %cID) { } } -//Check Multi-Completion (handles weekly & monthly challenges) -function checkMultiCompletion(%client, %cID) { - %challenge = $Challenges::Challenge[%cID]; - %cType = trim(getField(%challenge, 0)); - %cCond = getsubstr(getField(%challenge, 3), 1, strlen(getField(%challenge, 3))); - %so = %client.TWM2Controller; - %dateStr = formattimestring("yymmdd"); - //cannot complete the same one twice :P - if(%so.completed[%cid, %dateStr]) { - return; - } - // - switch$(getWord(%cCond, 0)) { - case "E": - %killCount = getWord(%cCond, 1); - %killDB = getWord(%cCond, 2) $= "A" ? 0 : getWord(%cCond, 2); - if(%killDB != 0) { - if(%cType == 2) { - if(getCurrentWeekTotal(%client, PlayerKillCount, %killDB) >= %killCount) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, PlayerKillCount, %killDB) >= %killCount) { - %done = true; - } - } - } - else { - if(%cType == 2) { - if(getCurrentWeekTotal(%client, totalPlayerKillCount) >= %killCount) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, totalPlayerKillCount) >= %killCount) { - %done = true; - } - } - } - case "Z": - %killCount = getWord(%cCond, 1); - %killedType = getWord(%cCond, 2) $= "A" ? -1 : getWord(%cCond, 2); - %killDB = getWord(%cCond, 3) $= "A" ? 0 : getWord(%cCond, 3); - if(%killDB != 0) { - if(%killedType != -1) { - if(%cType == 2) { - if(getCurrentWeekTotal(%client, ZombieKillCount, %killDB SPC %killedType) >= %killCount) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, ZombieKillCount, %killDB SPC %killedType) >= %killCount) { - %done = true; - } - } - } - else { - if(%cType == 2) { - if(getCurrentWeekTotal(%client, ZombieKillCount, %killDB SPC "") >= %killCount) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, ZombieKillCount, %killDB SPC "") >= %killCount) { - %done = true; - } - } - } - } - else { - if(%killedType != -1) { - if(%cType == 2) { - if(getCurrentWeekTotal(%client, ZombieKillCount, 0 SPC %killedType) >= %killCount) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, ZombieKillCount, 0 SPC %killedType) >= %killCount) { - %done = true; - } - } - } - else { - if(%cType == 2) { - if(getCurrentWeekTotal(%client, totalZombieKillCount) >= %killCount) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, totalZombieKillCount) >= %killCount) { - %done = true; - } - } - } - } - case "HS": - %counter = getWord(%cCond, 1); - %type = getWord(%cCond, 2) $= "E" ? "E" : "Z"; - if(%type $= "E") { - if(%cType == 2) { - if(getCurrentWeekTotal(%client, playerHeadshots) >= %counter) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, playerHeadshots) >= %counter) { - %done = true; - } - } - } - else { - if(%cType == 2) { - if(getCurrentWeekTotal(%client, zombieHeadshots) >= %counter) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, zombieHeadshots) >= %counter) { - %done = true; - } - } - } - case "KS": - %type = getWord(%cCond, 1); - %ammount = getWord(%cCond, 2); - if(%cType == 2) { - if(getCurrentWeekTotal(%client, killstreakCalls, %type) >= %ammount) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, killstreakCalls, %type) >= %ammount) { - %done = true; - } - } - case "KSK": - %type = getWord(%cCond, 1); - %ammount = getWord(%cCond, 2); - if(%cType == 2) { - if(getCurrentWeekTotal(%client, killstreakKills, %type) >= %ammount) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, killstreakKills, %type) >= %ammount) { - %done = true; - } - } - case "SK": - %soloType = getWord(%cCond, 1); - %ammount = getWord(%cCond, 2); - if(%cType == 2) { - if(getCurrentWeekTotal(%client, successiveSolo, %soloType) >= %ammount) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, successiveSolo, %soloType) >= %ammount) { - %done = true; - } - } - case "SKS": - %streakType = getWord(%cCond, 1); - %ammount = getWord(%cCond, 2); - if(%cType == 2) { - if(getCurrentWeekTotal(%client, successiveStreak, %streakType) >= %ammount) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, successiveStreak, %streakType) >= %ammount) { - %done = true; - } - } - //easy enough :) - case "Prestige": - %level = getWord(%cCond, 1); - if(%client.TWM2Core.officer >= %level) { - %done = true; - } - case "Boss": - %name = getWord(%cCond, 1); - %amount = getWord(%cCond, 2); - if(%cType == 2) { - if(getCurrentWeekTotal(%client, bossSlayCount, %name) >= %amount) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, bossSlayCount, %name) >= %amount) { - %done = true; - } - } - case "Back": - %zOrA = getWord(%cCond, 1); - %amount = getWord(%cCond, 2); - if(%zOrA $= "Z") { - if(%cType == 2) { - if(getCurrentWeekTotal(%client, zombieBackstabs) >= %amount) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, zombieBackstabs) >= %amount) { - %done = true; - } - } - } - else { - if(%cType == 2) { - if(getCurrentWeekTotal(%client, playerBackstabs) >= %amount) { - %done = true; - } - } - else { - if(getCurrentMonthTotal(%client, playerBackstabs) >= %amount) { - %done = true; - } - } - } - default: - error("Unknown challenge in parser..."); - } - if(%done) { - %cName = getField(%challenge, 1); - %CRewd = getField(%challenge, 4); - CenterPrint(%client, ""@(%cType == 2 ? "WEEKLY" : "MONTHLY")@" CHALLENGE COMPLETED\n"@%cName@"", 3, 3); - GainExperience(%client, %cRewd, %cName@" Challenge Completed"); - recordAction(%client, "CCMP", ""@%cid@"\t1"); - } +function checkDateOnChallenge(%client) { + if(!%client || %client $= "") { + return; + } + %cDATE = formattimestring("yymmdd"); + %so = NameToID("Container_"@%client.guid@"/CCD_"@%client.guid); + if(%so.expireDate == %cDATE) { + //Midnight? + if(!$Challenge::PerformingTimeUpdateCall) { + echo("Challenge expiration date matches current, check for midnight update, manually expiring challenge data."); + + downloadChallenges_Manual(); + $Challenge::PerformingTimeUpdateCall = 1; + + //Manually expire the challenge data. + %so.expireDate = 0; + schedule(5000, 0, "checkDateOnChallenge", %client); + } + return; + } + if(%so.expireDate <= 0 || %so.expireDate < %cDATE) { + echo("Client daily challenge container is expired, cleaning.."); + if(isObject(%so)) { + %so.delete(); + } + %client.TWM2Controller = new ScriptObject("CCD_"@%client.guid@"") {}; + %client.container.add(%client.TWM2Controller); + if(!isSet($TomorrowDate)) { + %setTo = %cDATE + 1; + } + else { + %setTo = $TomorrowDate; + } + %client.TWM2Controller.expireDate = %setTo; + SaveClientFile(%client); //give em a save + } } -//keep a running weekly total -function getCurrentWeekTotal(%client, %field, %additional_variables) { - if(!isSet(%client) || !isSet(%field)) { - return 0; - } - %scriptObj = %client.TWM2Controller; - if(isSet(%additional_variables)) { - %var_count = getWordCount(%additional_variables); - %vStr = ""; - %integer = 0; - while(isSet(getWord(%additional_variables, %integer))) { - %vStr = %vStr @","@ getWord(%additional_variables, %integer); - %integer++; - } - } - //get the start and end day numbers of the week. - %sOW = getSubStr($CurrentStartOfWeek, 6, 2); - %eOW = %sOW + 7; //7 day total. - //if we cross over months, we don't care, because the file is killed at month's end. - %cTotal = 0; - for(%i = %sOW; %i < %eOW; %i++) { - %iStor = %i; - if(%i < 10) { - %iStor = "0"@%i; - } - %day = %year@%month@%iStor; - if(isSet(%vStr)) { - eval("%cTotal += isSet("@%scriptObj@"."@%field@"["@%day SPC %vStr@"]) ? ("@%scriptObj@"."@%field@"["@%day SPC %vStr@"]) : 0;"); - } - else { - eval("%cTotal += isSet("@%scriptObj@"."@%field@"["@%day@"]) ? ("@%scriptObj@"."@%field@"["@%day@"]) : 0;"); - } - } - return %cTotal; -} - -//keep a running monthly total -function getCurrentMonthTotal(%client, %field, %additional_variables) { - if(!isSet(%client) || !isSet(%field)) { - return 0; - } - %scriptObj = %client.TWM2Controller; - if(isSet(%additional_variables)) { - %var_count = getWordCount(%additional_variables); - %vStr = ""; - %integer = 0; - while(isSet(getWord(%additional_variables, %integer))) { - %vStr = %vStr @","@ getWord(%additional_variables, %integer); - %integer++; - } - } - // - %year = getSubStr($CurrentStartOfMonth, 0, 4); - %month = getSubStr($CurrentStartOfMonth, 4, 2); - // - %sOM = getSubStr($CurrentStartOfMonth, 6, 2); - %eOM = getSubStr($CurrentMonthlyChallengeExpire, 6, 2); - %cTotal = 0; //hold the counter at 0 - for(%i = %sOM; %i <= %eOM; %i++) { - %iStor = %i; - if(%i < 10) { - %iStor = "0"@%i; - } - %day = %year@%month@%iStor; - if(isSet(%vStr)) { - eval("%cTotal += isSet("@%scriptObj@"."@%field@"["@%day SPC %vStr@"]) ? ("@%scriptObj@"."@%field@"["@%day SPC %vStr@"]) : 0;"); - } - else { - eval("%cTotal += isSet("@%scriptObj@"."@%field@"["@%day@"]) ? ("@%scriptObj@"."@%field@"["@%day@"]) : 0;"); - } - } - // - return %cTotal; -} - - function loadChallengeData(%client) { - //Daily Challenges = Core Servers Only - if(!IsServerMain()) { - error("* Daily Challenges: Restricted To Core Servers Only"); - return; - } - // - %object = NameToID("Container_"@%client.guid@"/CCD_"@%client.guid); - if(!isObject(%object)) { - %name = "CCD_"@%client.guid@""; - %client.TWM2Controller = new ScriptObject(%name) {}; - %client.container.add(%client.TWM2Controller); - } - else { - %client.TWM2Controller = %object; - } - // - updateChallengeFile(%client); -} - -//file update -function updateChallengeFile(%client) { - if(!isSet(%client) || !ClientGroup.isMember(%client)) { - return; - } - if(%client.cannotReset) { - return; - } - //if the expry date is smaller than the current date, clear the current file for write - %so = %client.TWM2Controller; - //%file = ""@$TWM::RanksDirectory@"/"@%client.guid@"/Saved.TWMSave"; - //exec(%file); - // - %cDATE = formattimestring("yymmdd"); - if(%so.expireDate <= 0) { - if(isObject(%so)) { - %so.delete(); - } - %client.TWM2Controller = new ScriptObject("CCD_"@%client.guid@"") {}; - %client.container.add(%client.TWM2Controller); - // - if(!isSet($CurrentMonthlyChallengeExpire)) { - %setTo = %cDATE + 31; //temp, will auto adjust at the end of the month. - } - else { - %setTo = $CurrentMonthlyChallengeExpire; - } - %client.TWM2Controller.expireDate = %setTo; - SaveClientFile(%client); //give em a save - } - //delete if expired and ONLY if the expire is present. - if(%cDATE > %client.TWM2Controller.expireDate) { - %client.TWM2Controller.expireDate = -1; - // - echo("Daily Challenge File Expired for "@%client@", preparing new file."); - // - %client.resetAttemps++; - if(%client.resetAttemps >= 3) { - error("Client "@%client@" reset attempts > 3, disabling challenge interpreter"); - %client.cannotReset = 1; - return; - } - schedule(1500, 0, "updateChallengeFile", %client); - return; - } + //Daily Challenges = Core Servers Only + if(!IsServerMain()) { + error("* Daily Challenges: Restricted To Core Servers Only"); + return; + } + // + %cDATE = formattimestring("yymmdd"); + echo("Updating daily challenge data for "@%client); + %so = NameToID("Container_"@%client.guid@"/CCD_"@%client.guid); + if(!isObject(%so)) { + %name = "CCD_"@%client.guid@""; + %client.TWM2Controller = new ScriptObject(%name) {}; + %client.container.add(%client.TWM2Controller); + } + else { + if(%so.expireDate <= 0 || %so.expireDate < %cDATE) { + echo("Expired daily challenge data located for "@%client@", performing clean"); + if(isObject(%so)) { + %so.delete(); + } + %client.TWM2Controller = new ScriptObject("CCD_"@%client.guid@"") {}; + %client.container.add(%client.TWM2Controller); + // + if(!isSet($TomorrowDate)) { + %setTo = %cDATE + 1; + } + else { + %setTo = $TomorrowDate; + } + %client.TWM2Controller.expireDate = %setTo; + SaveClientFile(%client); //give em a save + } + else { + %client.TWM2Controller = %so; + } + } } function GenerateDWMChallengeMenu(%client, %tag, %index) { @@ -789,27 +481,6 @@ function GenerateDWMChallengeMenu(%client, %tag, %index) { %index+=2; } } - // - else if(%cType == 2) { - if(%client.TWM2Controller.completed[%i, %dateStr]) { - messageClient( %client, 'SetLineHud', "", %tag, %index, "*WEEKLY* "@%cName@" - Completed"); - %index+=2; - } - else { - messageClient( %client, 'SetLineHud', "", %tag, %index, "*WEEKLY* "@%cName@" - "@%cDesc@" *"@%CRewd@"EXP"); - %index+=2; - } - } - else { - if(%client.TWM2Controller.completed[%i, %dateStr]) { - messageClient( %client, 'SetLineHud', "", %tag, %index, "*MONTHLY* "@%cName@" - Completed"); - %index+=2; - } - else { - messageClient( %client, 'SetLineHud', "", %tag, %index, "*MONTHLY* "@%cName@" - "@%cDesc@" *"@%CRewd@"EXP"); - %index+=2; - } - } } return %index; } diff --git a/scripts/TWM2/Systems/MainControl.cs b/scripts/TWM2/Systems/MainControl.cs index 6af7c76..977c570 100644 --- a/scripts/TWM2/Systems/MainControl.cs +++ b/scripts/TWM2/Systems/MainControl.cs @@ -640,187 +640,6 @@ function E_Sigma(%from, %to, %formula) { } return %totalSum; } -//========================================================= - -//========================================================= -//TWM2 Damage Control Function -//Added in TWM2 3.8 - -//I'm mostly using this function to cut down the mess in projectiles.cs and -//to better control the current problems in the boss system. - -function TWM2Damage(%projectile, %target, %amount, %dType, %damLoc, %type) { - //terrain block - if(%target.getType() & ($TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType)) { - return; - } - - %data = %projectile.getDatablock(); - %sourceObject = %projectile.sourceObject; - %sourceClient = %sourceObject.client; - %targetClient = %target.client $= "" ? 0 : %target.client; - %TDB = %target.getDatablock(); - if(isObject(%sourceObject)) { - %SDB = %sourceObject.getDatablock(); - } - else { - %SDB = ""; - } - %total = 1; - - switch$(%type) { - //Projectiles... - case "projectile": - %target.headShot = 0; //Reset first - if(%sourceClient.ActivePerk["AP Bullets"]) { - %total *= 1.5; - } - if(%targetClient != 0) { - if(%targetClient.IsActivePerk("Kevlar Armor")) { - %total *= 0.5; - } - } - if(%target.isZombie) { - if(Game.CheckModifier("Demonic") == 1) { - %total = 0.5; - } - } - //------------------------------------------------------ - //source object fixing - if(strStr(%SDB.getClassName(), "Turret") != -1) { - if(%SDB.getName() $= "HarbingerGunshipTurret") { - %projectile.sourceObject = %projectile.sourceObject.mountobj; - %sourceObject = %projectile.sourceObject; - %SDB = %sourceObject.getDataBlock(); - } - else if(%SDB.getName() $= "AC130GunshipTurret") { - %projectile.sourceObject = %projectile.sourceObject.mountobj; - %sourceObject = %projectile.sourceObject; - %SDB = %sourceObject.getDataBlock(); - } - else if(%SDB.getName() $= "CentaurTurret") { - %projectile.sourceObject = %projectile.sourceObject.source; - %sourceObject = %projectile.sourceObject; - %SDB = %sourceObject.getDataBlock(); - } - } - //------------------------------------------------------ - //vehicle kill checking - //NOTE: THIS DOESN'T GO HERE!!! - if(strStr(%SDB.getClassName(), "Vehicle") != -1) { - if((%target.getType() & ($TypeMasks::PlayerObjectType)) && %target.getState() $= "dead") { - %pl = %sourceObject.getMountNodeObject(0); //the pilot - %cl = %pl.client; - if(%cl !$= "") { - if(%target.client !$= "" && !%target.isZombie && %target.team != %pl.team) { - %cl.TWM2Core.PvPVehicleKills++; - if(%cl.TWM2Core.PvPVehicleKills >= 50) { - CompleteNWChallenge(%cl, "VehMans1"); - if(%cl.TWM2Core.PvPVehicleKills >= 100) { - CompleteNWChallenge(%cl, "VehMans2"); - if(%cl.TWM2Core.PvPVehicleKills >= 250) { - CompleteNWChallenge(%cl, "VehMans3"); - } - } - } - } - UpdateVehicleKillFile(%cl, %SDB.getName()); - // - if(%TDB $= "DemonMotherZombieArmor" && %SDB $= "CentaurVehicle") { - %cl.CDLKills++; - if(%cl.CDLKills >= 5) { - AwardClient(%cl, "19"); - } - } - } - } - } - //-------------------------------------------------------- - //Headshot checking - if(%damLoc $= "head" && %TDB.getClassName() $= "PlayerData") { - if(%data.HeadMultiplier !$= "") { - %modifier *= %data.HeadMultiplier; - } - if(%data.HeadShotKill && $TWM2::HeadshotKill) { - %target.headShot = 1; - } - if(%sourceClient !$= "") { - if(%sourceClient.UpgradeOn("HSBullets", %projectile.WeaponImageSource) && $TWM2::HeadshotKill) { - %target.headShot = 1; - } - } - if(%target.headShot) { - if(%targetClient != 0 && %targetClient.ActivePerk["Head Guard"]) { - %target.headShot = 0; - } - else { - if((!%target.isBoss && !%target.noHS) && !(%target.getShieldHealth() > 0)) { - if(%target.isZombie) { - if(%TDB $= "FZombieArmor") { - AwardClient(%sourceClient, "16"); - } - // - if(Game.CheckModifier("WheresMyHead") == 1) { - %target.headShot = 0; - } - else { - %total *= 1000; - } - } - else { - if(%target.isPilot() || %target.vehicleMounted) { - %target.headShot = 0; - } - else { - %total *= 1000; - if(%targetClient != 0) { - BottomPrint(%targetClient, "You Lost Your Head!!!", 3, 1); - //Recording... - if(%sourceClient !$= "") { - %sourceClient.TWM2Core.PvPHeadshotKills++; - if(%sourceClient.TWM2Core.PvPHeadshotKills >= 100) { - CompleteNWChallenge(%sourceClient, "HSHoncho1"); - if(%sourceClient.TWM2Core.PvPHeadshotKills >= 200) { - CompleteNWChallenge(%sourceClient, "HSHoncho2"); - if(%sourceClient.TWM2Core.PvPHeadshotKills >= 300) { - CompleteNWChallenge(%sourceClient, "HSHoncho3"); - } - } - } - } - } - } - } - } - } - } - } - else if(%damLoc $= "legs") { - if(%data.LegsMultiplier !$= "") { - %total *= %data.LegsMultiplier; - } - } - - case "explosion": - %total = 1; - if(%dType == $DamageType::RapierShield) { - if(%target == %sourceObject || %target.isZombie || %target.isBoss) { - %total = 0; - } - } - } - - %deal = %total * %amount; - if(%target.isBoss) { - if(%dType == $DamageType::SuperChaingun) { - %deal = 0; - } - %sourceClient.damageToBoss += %deal; - } - - return %total; -} - //=============================================================================== //=============================================================================== diff --git a/scripts/TWM2/Systems/ObjectDamage.cs b/scripts/TWM2/Systems/ObjectDamage.cs new file mode 100644 index 0000000..486093f --- /dev/null +++ b/scripts/TWM2/Systems/ObjectDamage.cs @@ -0,0 +1,492 @@ +//objectDamage.cs +//TWM2 3.9.1 +//By: Robert C. Fritzen (Phantom139) + +//A collection of TWM2's damage functions, object handler events, and damage over time style functioning + +//========================================================= +//CalculateProjectileDamage +// %projectile: The source projectile +// %target: The target object recieving damage +// %amount: The numeric damage amount +// %dType: The damage type flag +// %damLoc: The damage location +// %type: The type of damage (Projectile or Explosion) +// Calculates a damage modifier based on TWM2 settings (Perks, Armors, Equipment) to apply to an object struck by damage +function CalculateProjectileDamage(%projectile, %target, %amount, %dType, %damLoc, %type) { + //terrain block + if(%target.getType() & ($TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType)) { + return; + } + + %data = %projectile.getDatablock(); + %sourceObject = %projectile.sourceObject; + %sourceClient = %sourceObject.client; + %targetClient = %target.client $= "" ? 0 : %target.client; + %TDB = %target.getDatablock(); + if(isObject(%sourceObject)) { + %SDB = %sourceObject.getDatablock(); + } + else { + %SDB = ""; + } + %total = 1; + + switch$(%type) { + //Projectiles... + case "projectile": + %target.headShot = 0; //Reset first + if(%sourceClient.ActivePerk["AP Bullets"]) { + %total *= 1.5; + } + if(%targetClient != 0) { + if(%targetClient.IsActivePerk("Kevlar Armor")) { + %total *= 0.5; + } + } + if(%target.isZombie) { + if(Game.CheckModifier("Demonic") == 1) { + %total = 0.5; + } + } + //------------------------------------------------------ + //source object fixing + if(strStr(%SDB.getClassName(), "Turret") != -1) { + if(%SDB.getName() $= "HarbingerGunshipTurret") { + %projectile.sourceObject = %projectile.sourceObject.mountobj; + %sourceObject = %projectile.sourceObject; + %SDB = %sourceObject.getDataBlock(); + } + else if(%SDB.getName() $= "AC130GunshipTurret") { + %projectile.sourceObject = %projectile.sourceObject.mountobj; + %sourceObject = %projectile.sourceObject; + %SDB = %sourceObject.getDataBlock(); + } + else if(%SDB.getName() $= "CentaurTurret") { + %projectile.sourceObject = %projectile.sourceObject.source; + %sourceObject = %projectile.sourceObject; + %SDB = %sourceObject.getDataBlock(); + } + } + + //-------------------------------------------------------- + //Headshot checking + if(%damLoc $= "head" && %TDB.getClassName() $= "PlayerData") { + if(%data.HeadMultiplier !$= "") { + %modifier *= %data.HeadMultiplier; + } + if(%data.HeadShotKill && $TWM2::HeadshotKill) { + %target.headShot = 1; + } + if(%sourceClient !$= "") { + if(%sourceClient.UpgradeOn("HSBullets", %projectile.WeaponImageSource) && $TWM2::HeadshotKill) { + %target.headShot = 1; + } + } + if(%target.headShot) { + if(%targetClient != 0 && %targetClient.ActivePerk["Head Guard"]) { + %target.headShot = 0; + } + else { + if((!%target.isBoss && !%target.noHS) && !(%target.getShieldHealth() > 0)) { + if(%target.isZombie) { + if(%TDB $= "FZombieArmor") { + AwardClient(%sourceClient, "16"); + } + // + if(Game.CheckModifier("WheresMyHead") == 1) { + %target.headShot = 0; + } + else { + %total *= 1000; + } + } + else { + if(%target.isPilot() || %target.vehicleMounted) { + %target.headShot = 0; + } + else { + %total *= 1000; + if(%targetClient != 0) { + BottomPrint(%targetClient, "You Lost Your Head!!!", 3, 1); + //Recording... + if(%sourceClient !$= "") { + %sourceClient.TWM2Core.PvPHeadshotKills++; + if(%sourceClient.TWM2Core.PvPHeadshotKills >= 100) { + CompleteNWChallenge(%sourceClient, "HSHoncho1"); + if(%sourceClient.TWM2Core.PvPHeadshotKills >= 200) { + CompleteNWChallenge(%sourceClient, "HSHoncho2"); + if(%sourceClient.TWM2Core.PvPHeadshotKills >= 300) { + CompleteNWChallenge(%sourceClient, "HSHoncho3"); + } + } + } + } + } + } + } + } + } + } + } + else if(%damLoc $= "legs") { + if(%data.LegsMultiplier !$= "") { + %total *= %data.LegsMultiplier; + } + } + + case "explosion": + %total = 1; + if(%dType == $DamageType::RapierShield) { + if(%target == %sourceObject || %target.isZombie || %target.isBoss) { + %total = 0; + } + } + } + + %deal = %total * %amount; + if(%target.isBoss) { + if(%dType == $DamageType::SuperChaingun) { + %deal = 0; + } + %sourceClient.damageToBoss += %deal; + } + + return %total; +} + +//========================================================= +//postObjectDestroyed +// %source: The source of what killed the object (Another object, projectile, etc) +// %targetObject: What died. +// %dType: The internal damage type flag +// %dLoc: The location of damage +function postObjectDestroyed(%source, %targetObject, %dType, %dLoc) { + if(%targetObject.getType() & ($TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType)) { + //Skip terrain and interiors + return; + } + if(!isObject(%source) || %source $= "") { + %SDB = ""; + %sourceObject = 0; + %sourceClient = 0; + } + else { + %sourceDatablock = %source.getDatablock(); + if(strStr(%sourceDatablock.getName(), "Projectile") != -1) { + %sourceObject = %source.sourceObject; + } + else { + %sourceObject = %source; + } + %sourceClient = %sourceObject.client; + if(isObject(%sourceObject)) { + %SDB = %sourceObject.getDatablock(); + } + else { + %SDB = ""; + } + } + %targetClient = %targetObject.client $= "" ? 0 : %targetObject.client; + %TDB = %targetObject.getDatablock(); + //Proceed into object specific tests now... + //Killed by Vehicle. + if(strStr(%SDB.getClassName(), "Vehicle") != -1) { + if((%targetObject.getType() & ($TypeMasks::PlayerObjectType)) && %targetObject.getState() $= "dead") { + %pl = %sourceObject.getMountNodeObject(0); //the pilot + %cl = %pl.client; + if(%cl !$= "") { + if(%targetObject.client !$= "" && !%targetObject.isZombie && %targetObject.team != %pl.team) { + %cl.TWM2Core.PvPVehicleKills++; + if(%cl.TWM2Core.PvPVehicleKills >= 50) { + CompleteNWChallenge(%cl, "VehMans1"); + if(%cl.TWM2Core.PvPVehicleKills >= 100) { + CompleteNWChallenge(%cl, "VehMans2"); + if(%cl.TWM2Core.PvPVehicleKills >= 250) { + CompleteNWChallenge(%cl, "VehMans3"); + } + } + } + } + UpdateVehicleKillFile(%cl, %SDB.getName()); + // + if(%TDB $= "DemonMotherZombieArmor" && %SDB $= "CentaurVehicle") { + %cl.CDLKills++; + if(%cl.CDLKills >= 5) { + AwardClient(%cl, "19"); + } + } + } + } + } + //Is there a boss going? + if(!%targetObject.isZombie && !%targetObject.isBossMinion) { + if($TWM2::BossGoing) { + //Chalk up the kill count :P + $TWM2::BossManager.addKill(%targetObject); + } + } + if(%targetObject.isVardisonMinion) { + $TWM2::VardisonManager.minionCount--; + } + //Game modes + if($TWM2::PlayingSabo) { + if(Game.Bomb.Carrier == %targetObject) { + if(%damageType == $DamageType::FellOff) { + MessageAll('msgWhoops', "\c5SABOTAGE: Bomb Reset."); + Game.BombDropped(Game.Bomb, %targetObject); + Game.bomb.setPosition($SabotageGame::BombLocation[$CurrentMission]); + } + else { + Game.BombDropped(Game.Bomb, %targetObject); + } + } + } + //Gore Mod On? + if($TWM2::UseGoreMod) { + CreateBlood(%targetObject); + } + //Rog Rapier Shield + if(%damageType == $DamageType::RapierShield) { + if(%sourceObject.client !$= "") { + UpdateWeaponKillFile(%sourceObject.client, "rapierShieldImage"); + } + } + //Zombie Checks + if(%targetObject.isZombie) { + //Horde 3 Checks + if($TWM::PlayingHorde == 1) { + if($HordeGame::Zombiecount > 0) { + $HordeGame::Zombiecount--; + messageAll('MsgSPCurrentObjective1' ,"", "Wave "@$HordeGame::CurrentWave@" | Zombies Left: "@$HordeGame::Zombiecount@""); + } + if($HordeGame::Zombiecount <= 0) { + HordeNextWave($HordeGame::Game, $HordeGame::NextWave); + } + } + //Helljump Checks + if($TWM::PlayingHelljump == 1) { + if($HellJump::Zombiecount > 0) { + $HellJump::Zombiecount--; + messageAll('MsgSPCurrentObjective1' ,"", "[W"@$HellJump::CurrentWave@"|G"@$HellJump::CurrentGroup@"|S"@$HellJump::CurrentStrike@"] | Zombies Left: "@$HellJump::Zombiecount@""); + } + if($HellJump::Zombiecount <= 0) { + $HellJump::Game.GoNextStrike(); + } + } + //TWM Infection / PvPz Checks + if(%targetObject.isPlayerZombie) { + %sourceClient.TWM2Core.PvPZombieKills++; + if(%sourceClient.TWM2Core.PvPZombieKills >= 100) { + CompleteNWChallenge(%sourceClient, "Defectionator1"); + if(%sourceClient.TWM2Core.PvPZombieKills >= 250) { + CompleteNWChallenge(%sourceClient, "Defectionator2"); + if(%sourceClient.TWM2Core.PvPZombieKills >= 500) { + CompleteNWChallenge(%sourceClient, "Defectionator3"); + } + } + } + } + //Global Methods + Game.ZkillUpdateScore(%sourceClient, %sourceObject, %targetObject); + %sourceObject.zombiekillsinarow++; + DoZKillstreakChecks(%sourceClient); + } + //PvP Checks + else { + if(%targetObject.team != %sourceClient.team && !%targetObject.isBoss) { + if(isObject(%sourceClient) && %sourceClient.IsActivePerk("Double Down")) { + GainExperience(%sourceClient, $TWM2::KillXPGain * 2, "[D-D]Enemy Killed "); + } + else { + GainExperience(%sourceClient, $TWM2::KillXPGain, "Enemy Killed "); + } + //Zombie Kills Player + if(!%targetObject.isZombie && %sourceObject.isZombie) { + %sourceClient.TWM2Core.PvPHumanKills++; + if(%sourceClient.TWM2Core.PvPHumanKills >= 50) { + CompleteNWChallenge(%sourceClient, "Infectionator1"); + if(%sourceClient.TWM2Core.PvPHumanKills >= 100) { + CompleteNWChallenge(%sourceClient, "Infectionator2"); + if(%sourceClient.TWM2Core.PvPHumanKills >= 250) { + CompleteNWChallenge(%sourceClient, "Infectionator3"); + } + } + } + } + else { + //Player Kills Player + %sourceClient.TWM2Core.PvPKills++; + if(%sourceClient.TWM2Core.PvPKills >= 100) { + CompleteNWChallenge(%sourceClient, "Slayer1"); + if(%sourceClient.TWM2Core.PvPKills >= 250) { + CompleteNWChallenge(%sourceClient, "Slayer2"); + if(%sourceClient.TWM2Core.PvPKills >= 500) { + CompleteNWChallenge(%sourceClient, "Slayer3"); + if(%sourceClient.TWM2Core.PvPKills >= 750) { + CompleteNWChallenge(%sourceClient, "Slayer4"); + if(%sourceClient.TWM2Core.PvPKills >= 1000) { + CompleteNWChallenge(%sourceClient, "Slayer5"); + } + } + } + } + } + } + //Team Gain Perk + if(isObject(%sourceClient) && %sourceClient.IsActivePerk("Team Gain")) { + %TargetSearchMask = $TypeMasks::PlayerObjectType; + InitContainerRadiusSearch(%sourceObject.getPosition(), 20, %TargetSearchMask); //small distance + while ((%potentialTarget = ContainerSearchNext()) != 0){ + if (%potentialTarget.getPosition() != %pos) { + if(%potentialTarget.client.team == %sourceClient.team && %potentialTarget != %sourceObject) { + GainExperience(%potentialTarget.client, $TWM2::KillXPGain, "Team Gain From "@%sourceClient.namebase@" "); + } + } + } + } + //Challenges, Successive Kills, Killstreaks + doChallengeCheck(%sourceClient, %targetClient); + %sourceObject.killsinarow++; + %sourceObject.killsinarow2++; + //TWM2 3.2 -> Successive Kills + %sourceObject.kills[%damageType]++; + PerformSuccessiveKills(%sourceObject, %damageType); + // + if(%sourceObject.killsinarow2 == 10 && !(%sourceObject.isBoss || %sourceObject.isZombie)) { + MessageAll('MsgWOW', "\c2TWM2: "@%sourceClient.namebase@" is on a killsteak of 10"); + awardClient(%sourceClient, "14"); + } + if(%sourceObject.killsinarow2 == 20 && !(%sourceObject.isBoss || %sourceObject.isZombie)) { + MessageAll('MsgWOW', "\c2TWM2: "@%sourceClient.namebase@" is on a killsteak of 20"); + } + if(%sourceObject.killsinarow2 == 25 && !(%sourceObject.isBoss || %sourceObject.isZombie)) { + MessageAll('MsgWOW', "\c2TWM2: "@%sourceClient.namebase@" is on a killsteak of 25"); + } + DoKillstreakChecks(%sourceClient); + } + } + //Record Challenge Kill + doChallengeKillRecording(%sourceObject, %targetObject); + //martydom + if(%targetClient !$= "" && %targetClient != 0 && %targetClient.IsActivePerk("Martydom")) { + serverPlay3d(SatchelChargeActivateSound, %targetObject.getPosition()); + schedule(2200, 0, "MartydomExplode", %targetObject.getPosition(), %targetClient); + } +} + + +datablock ParticleData(burnParticle) { + dragCoeffiecient = 0.0; + gravityCoefficient = -0.1; + inheritedVelFactor = 0.1; + + lifetimeMS = 500; + lifetimeVarianceMS = 50; + + textureName = "special/cloudflash"; + + spinRandomMin = -10.0; + spinRandomMax = 10.0; + + colors[0] = "1 0.18 0.03 0.4"; + colors[1] = "1 0.18 0.03 0.3"; + colors[2] = "1 0.18 0.03 0.0"; + sizes[0] = 2.0; + sizes[1] = 1.0; + sizes[2] = 0.8; + times[0] = 0.0; + times[1] = 0.6; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(burnEmitter) { + ejectionPeriodMS = 3; + periodVarianceMS = 0; + + ejectionOffset = 0.2; + ejectionVelocity = 10.0; + velocityVariance = 0.0; + + thetaMin = 0.0; + thetaMax = 10.0; + + particles = "burnParticle"; +}; + +function burnloop(%obj){ + if(!isobject(%obj)) { + return; + } + if(%obj.onfire == 0) { + return; + } + if(%obj.firecount >= %obj.maxfirecount){ + %obj.firecount = ""; + %obj.maxfirecount = 0; + %obj.onfire = 0; + return; + } + else { + %obj.damage(0, %obj.getposition(), 0.01, $DamageType::Burn); + %obj.lastDamagedImage = "flamerImage"; + %fire = new ParticleEmissionDummy(){ + position = vectoradd(%obj.getPosition(),"0 0 0.5"); + dataBlock = "defaultEmissionDummy"; + emitter = "BurnEmitter"; + }; + MissionCleanup.add(%fire); + %fire.schedule(100, "delete"); + %obj.firecount++; + schedule(100, %obj, "burnloop", %obj); + } +} + +function ApplyEMP(%client) { + if(%client.isEMPd) { + //applying second emp = laggy + bad + return; + } + %client.isEMPd = 1; + EMPEKill(%client.player); + //echo("EMP: applied EMP to "@%client@" - "@%client.player@""); +} + +function KillEMP(%client) { + %client.isEMPd = 0; + %client.player.stopZap(); + messageClient(%client, 'msgDieEMP', "\c5Armor: Electronic Stability has returned."); + //echo("EMP: kill EMP: "@%client@""); +} + +function EMPEKill(%obj) { + if(%obj.client.isEMPd) { + if(!isObject(%obj) || %obj.getState() $= "Dead") { + //echo("EMP: "@%obj@" dead, sending Re-EMP to "@%obj.client@""); + ReEMPLoop(%obj.client); + return; + } + %obj.setEnergyLevel(0.0); + %obj.zapObject(); + schedule(100, 0, "EMPEKill", %obj); + } + else { + %obj.stopZap(); + return; + } +} + +function ReEMPLoop(%client) { + if(!%client.isEMPd) { + //echo("EMP: RE-EMP: "@%client@" no longer EMP"); + return; + } + if(!isObject(%client.player) || %client.player.getState() $= "Dead") { + //echo("EMP: RE: dead, trying to re-loop on "@%client@""); + schedule(500, 0, "ReEMPLoop", %client); + return; + } + EMPLoop(%client.player); + EMPEKill(%client.player); + //echo("EMP: Re-EMP: "@%client@" - "@%client.player@""); +} diff --git a/scripts/TWM2/Systems/scoremenucmds.cs b/scripts/TWM2/Systems/scoremenucmds.cs index 04fbefa..8d3fb9a 100644 --- a/scripts/TWM2/Systems/scoremenucmds.cs +++ b/scripts/TWM2/Systems/scoremenucmds.cs @@ -831,7 +831,7 @@ function ConstructionGame::processGameLink(%game, %client, %arg1, %arg2, %arg3, %timeString = ""@%daysFloored@" Days, "@%hoursFloored@" Hours, "@%timeLeft@" Minutes"; } //Card - messageClient( %client, 'SetLineHud', "", %tag, %index, "Rank: "@%rank@", XP Points: "@%XP@"."); + messageClient( %client, 'SetLineHud', "", %tag, %index, "Rank: "@%rank@" ("@%targetController.rankNumber@"), XP Points: "@%XP@"."); %index++; messageClient( %client, 'SetLineHud', "", %tag, %index, "TWM2 Time Played: "@%timeString@"."); %index++; diff --git a/scripts/chatCommands.cs b/scripts/chatCommands.cs index 9df59b0..32e056d 100644 --- a/scripts/chatCommands.cs +++ b/scripts/chatCommands.cs @@ -38,7 +38,6 @@ function VectToRot(%vec){ function addCMD(%proxy, %name, %send) { $CCHelp[%name] = ""@%send@""; $CommandGroup[%name] = %proxy; - echo("Command "@%name@" added to list under proxy "@%proxy@", Help: "@%send@""); } function chatcommands(%sender, %message) { @@ -252,8 +251,6 @@ function VoteBoss_StartBoss(%BossAbbr) StartTrevor(%pos); // its lots of lulz though! case "Vardison": StartVardison1(%pos); - case "DAVardison": - StartDAVardison(%pos); case "ShadeLord": SpawnShadeLord(%pos); default: diff --git a/scripts/player.cs b/scripts/player.cs index 5f30f01..be314ab 100644 --- a/scripts/player.cs +++ b/scripts/player.cs @@ -3593,31 +3593,9 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am //now call the "onKilled" function if the client was... you know... if(%targetObject.getState() $= "Dead") { - //Is there a boss going? - if(!%targetObject.isZombie && !%targetObject.isBossMinion) { - if($TWM2::BossGoing) { - //Chalk up the kill count :P - $TWM2::BossManager.addKill(%targetObject); - } - } - if(%targetObject.isVardisonMinion) { - $TWM2::VardisonManager.minionCount--; - } - - if($TWM2::PlayingSabo) { - if(Game.Bomb.Carrier == %targetObject) { - if(%damageType == $DamageType::FellOff) { - MessageAll('msgWhoops', "\c5SABOTAGE: Bomb Reset."); - Game.BombDropped(Game.Bomb, %targetObject); - Game.bomb.setPosition($SabotageGame::BombLocation[$CurrentMission]); - } - else { - Game.BombDropped(Game.Bomb, %targetObject); - } - } - } // where did this guy get it? - %damLoc = %targetObject.getDamageLocation(%position); + %damLoc = %targetObject.getDamageLocation(%position); + postObjectDestroyed(%sourceObject, %targetObject, %damageType, %damLoc); // should this guy be blown apart? if( %damageType == $DamageType::Explosion || @@ -3646,138 +3624,6 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am // If we were killed, max out the flash %targetObject.setDamageFlash(0.75); - - %damLoc = %targetObject.getDamageLocation(%position); - if($TWM2::UseGoreMod) { - CreateBlood(%targetObject); - } - - if(%damageType == $DamageType::RapierShield) { - if(%sourceObject.client !$= "") { - UpdateWeaponKillFile(%sourceObject.client, "rapierShieldImage"); - } - } - - if(%targetObject.isZombie) { - if($TWM::PlayingHorde == 1) { - if($HordeGame::Zombiecount > 0) { //ha! this should stop multiple waves from spawning - $HordeGame::Zombiecount--; - messageAll('MsgSPCurrentObjective1' ,"", "Wave "@$HordeGame::CurrentWave@" | Zombies Left: "@$HordeGame::Zombiecount@""); - } - //Echo("Horde: Zombie Killed, "@$HordeGame::Zombiecount@" remain."); //was used for debugging - if($HordeGame::Zombiecount <= 0) { - HordeNextWave($HordeGame::Game, $HordeGame::NextWave); //working on this - } - } - // - if($TWM::PlayingHelljump == 1) { - if($HellJump::Zombiecount > 0) { //ha! this should stop multiple waves from spawning - $HellJump::Zombiecount--; - messageAll('MsgSPCurrentObjective1' ,"", "[W"@$HellJump::CurrentWave@"|G"@$HellJump::CurrentGroup@"|S"@$HellJump::CurrentStrike@"] | Zombies Left: "@$HellJump::Zombiecount@""); - } - //Echo("Horde: Zombie Killed, "@$HordeGame::Zombiecount@" remain."); //was used for debugging - if($HellJump::Zombiecount <= 0) { - $HellJump::Game.GoNextStrike(); - } - } - // - if(%targetObject.isPlayerZombie) { - %sourceClient.TWM2Core.PvPZombieKills++; - if(%sourceClient.TWM2Core.PvPZombieKills >= 100) { - CompleteNWChallenge(%sourceClient, "Defectionator1"); - if(%sourceClient.TWM2Core.PvPZombieKills >= 250) { - CompleteNWChallenge(%sourceClient, "Defectionator2"); - if(%sourceClient.TWM2Core.PvPZombieKills >= 500) { - CompleteNWChallenge(%sourceClient, "Defectionator3"); - } - } - } - } - // - Game.ZkillUpdateScore(%sourceClient, %sourceObject, %targetObject); - %sourceObject.zombiekillsinarow++; - DoZKillstreakChecks(%sourceClient); - } - else { - if(%targetObject.team != %sourceClient.team && !%targetObject.isBoss) { - if(isObject(%sourceClient) && %sourceClient.IsActivePerk("Double Down")) { - GainExperience(%sourceClient, $TWM2::KillXPGain * 2, "[D-D]Enemy Killed "); - } - else { - GainExperience(%sourceClient, $TWM2::KillXPGain, "Enemy Killed "); - } - //Kill Recording.. - if(!%targetObject.isZombie && %sourceObject.isZombie) { - %sourceClient.TWM2Core.PvPHumanKills++; - if(%sourceClient.TWM2Core.PvPHumanKills >= 50) { - CompleteNWChallenge(%sourceClient, "Infectionator1"); - if(%sourceClient.TWM2Core.PvPHumanKills >= 100) { - CompleteNWChallenge(%sourceClient, "Infectionator2"); - if(%sourceClient.TWM2Core.PvPHumanKills >= 250) { - CompleteNWChallenge(%sourceClient, "Infectionator3"); - } - } - } - } - else { - %sourceClient.TWM2Core.PvPKills++; - if(%sourceClient.TWM2Core.PvPKills >= 100) { - CompleteNWChallenge(%sourceClient, "Slayer1"); - if(%sourceClient.TWM2Core.PvPKills >= 250) { - CompleteNWChallenge(%sourceClient, "Slayer2"); - if(%sourceClient.TWM2Core.PvPKills >= 500) { - CompleteNWChallenge(%sourceClient, "Slayer3"); - if(%sourceClient.TWM2Core.PvPKills >= 750) { - CompleteNWChallenge(%sourceClient, "Slayer4"); - if(%sourceClient.TWM2Core.PvPKills >= 1000) { - CompleteNWChallenge(%sourceClient, "Slayer5"); - } - } - } - } - } - } - //Team Gain Perk - if(isObject(%sourceClient) && %sourceClient.IsActivePerk("Team Gain")) { - %TargetSearchMask = $TypeMasks::PlayerObjectType; - InitContainerRadiusSearch(%sourceObject.getPosition(), 20, %TargetSearchMask); //small distance - while ((%potentialTarget = ContainerSearchNext()) != 0){ - if (%potentialTarget.getPosition() != %pos) { - if(%potentialTarget.client.team == %sourceClient.team && %potentialTarget != %sourceObject) { - GainExperience(%potentialTarget.client, $TWM2::KillXPGain, "Team Gain From "@%sourceClient.namebase@" "); - } - } - } - } - //End - doChallengeCheck(%sourceClient, %targetClient); - %sourceObject.killsinarow++; - %sourceObject.killsinarow2++; - //TWM2 3.2 -> Successive Kills - %sourceObject.kills[%damageType]++; - PerformSuccessiveKills(%sourceObject, %damageType); - // - if(%sourceObject.killsinarow2 == 10 && !(%sourceObject.isBoss || %sourceObject.isZombie)) { - MessageAll('MsgWOW', "\c2TWM2: "@%sourceClient.namebase@" is on a killsteak of 10"); - awardClient(%sourceClient, "14"); - } - if(%sourceObject.killsinarow2 == 20 && !(%sourceObject.isBoss || %sourceObject.isZombie)) { - MessageAll('MsgWOW', "\c2TWM2: "@%sourceClient.namebase@" is on a killsteak of 20"); - } - if(%sourceObject.killsinarow2 == 25 && !(%sourceObject.isBoss || %sourceObject.isZombie)) { - MessageAll('MsgWOW', "\c2TWM2: "@%sourceClient.namebase@" is on a killsteak of 25"); - } - DoKillstreakChecks(%sourceClient); - } - } - //Challenges! - doChallengeKillRecording(%sourceObject, %targetObject); - // - //martydom - if(%targetClient !$= "" && %targetClient.IsActivePerk("Martydom")) { - serverPlay3d(SatchelChargeActivateSound, %targetObject.getPosition()); - schedule(2200, 0, "MartydomExplode", %targetObject.getPosition(), %targetClient); - } Game.onClientKilled(%targetClient, %sourceClient, %damageType, %sourceObject, %damLoc); } else if ( %amount > 0.1 ) diff --git a/scripts/projectiles.cs b/scripts/projectiles.cs index 269d354..77443ad 100644 --- a/scripts/projectiles.cs +++ b/scripts/projectiles.cs @@ -25,7 +25,7 @@ function ProjectileData::onCollision(%data, %projectile, %targetObject, %modifie else { %damLoc = ""; } - %test = TWM2Damage(%projectile, %targetObject, %data.directDamage, %data.directDamageType, %damLoc, "projectile"); + %test = CalculateProjectileDamage(%projectile, %targetObject, %data.directDamage, %data.directDamageType, %damLoc, "projectile"); if(%test == 0) { return; } @@ -600,7 +600,7 @@ function RadiusExplosion(%explosionSource, %position, %radius, %damage, %impulse if (%dist > %radius) continue; - %modifier = TWM2Damage(%explosionSource, %targetObject, %damage, %damageType, "", "explosion"); + %modifier = CalculateProjectileDamage(%explosionSource, %targetObject, %damage, %damageType, "", "explosion"); if(%modifier == 0) { return; }