From 83166b4b0e34fd368f311f07da00e13bcb158c9c Mon Sep 17 00:00:00 2001 From: SethDGamre <165520713+SethDGamre@users.noreply.github.com> Date: Sun, 23 Jun 2024 07:30:43 -0500 Subject: [PATCH] Evocom - hotfix to improve cortex commanders shield behavior and animation (#3221) change the way cortex commander transfers damage to shield it used to be that the commander would just be armored while shield was up to reduce damage from attacks that ignored shield. Now, the damage dealt to the commander is accurately transferred to the shield. Due to technical limitations, overkill damage that's bigger than the shield is ignored. So a single attack of 10000000 damage would deplete the shield, but that's it. Once below the shield threshold (4% or so) then damage is taken like normal Also added RestoreAfterDelay() equivalent to reset torso and head position --- scripts/Units/corcomhilvl.bos | 74 ++++++++++++++++++---------------- scripts/Units/corcomhilvl.cob | Bin 31894 -> 32006 bytes 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/scripts/Units/corcomhilvl.bos b/scripts/Units/corcomhilvl.bos index f546d8601eb..34c28c7e3be 100644 --- a/scripts/Units/corcomhilvl.bos +++ b/scripts/Units/corcomhilvl.bos @@ -6,7 +6,7 @@ piece torso, lfirept, rbigflash, nanospray, nanolathe, luparm, ruparm, pelvis, rthigh, lthigh, biggun, lleg, l_foot, rleg, r_foot, head, teleport, aimx1, aimy1, nanol1, nanol2, nanol3, leye, reye, eyeflare, cagelight, cagelight_emit, headmount, hatpoint, crown, medalsilver, medalbronze, medalgold, torsofrontmarker; -static-var bMoving, bAiming, Busy, gun_6, gun_3, gun_2, gun_eye, counter, shieldUp, +static-var bMoving, bAiming, Busy, gun_6, gun_3, gun_2, gun_eye, counter, bIsBuilding, buildPitch, buildHeading, maxSpeed, currentSpeed, animSpeed, justMoved, shotcount; // for the AimPrimary script, to skip wait-for-turn if needed @@ -769,23 +769,6 @@ UnitSpeed(){ } } - -UnitTimer() -{ - while (TRUE) - { - shieldUp = get SHIELD_POWER; - if (shieldUp > 40000000){ - set ARMORED to 1; - sleep 500; - } - else{ - set ARMORED to 0; - sleep 3000; - } - } -} - Create() { hide rbigflash; @@ -835,7 +818,6 @@ Create() currentSpeed = 100; //call-script TeleportControl(); start-script UnitSpeed(); - start-script UnitTimer(); } lua_UnitScriptLight(lightIndex, count) @@ -944,6 +926,22 @@ ResumeBuilding() return (0); } +HitByWeaponId(anglex, anglez, weaponid, dmg) // angle[x|z] is always [-500;500], +{ + var shieldPower, shieldDamage; + + shieldPower = get SHIELD_POWER; + + if (shieldPower > 40000000){ + set SHIELD_POWER to (shieldPower - ( dmg * 635 )); //635x is the multiplier by which damage is scaled according to shields + get PRINT(shieldPower, dmg); + return (0); + } + if (shieldPower <= 40000000){ + return (100); //the return value is a percentage of the damage. 100 = 100% + } +} + AimFromPrimary(piecenum) { piecenum = torso; @@ -989,6 +987,7 @@ AimPrimary(heading, pitch) { start-script ResumeBuilding(); } + start-script RestorePosition(); return (1); } @@ -1023,6 +1022,7 @@ AimTertiary(heading, pitch) //turn ruparm to x-axis <0> speed <360>; wait-for-turn aimy1 around y-axis; //wait-for-turn biggun around x-axis; + start-script RestorePosition(); return (1); } @@ -1079,6 +1079,7 @@ AimSecondary(heading, pitch) { start-script ResumeBuilding(); } + start-script RestorePosition(); return (1); } @@ -1117,22 +1118,24 @@ QueryWeapon5(piecenum) } AimWeapon5(heading, pitch) - { - signal SIG_AIM2; - set-signal-mask SIG_AIM2; - bAiming = TRUE; - turn head to y-axis heading speed <300.000000>; - turn head to x-axis <-5.000000> - pitch speed <250.000000>; - if ( (get ABS(last_primary_heading - heading)>1800) OR (get ABS(last_primary_pitch - pitch)>1500) ) - { - wait-for-turn head around y-axis; - wait-for-turn head around x-axis; - } - last_primary_heading=heading; - last_primary_pitch=pitch; - gun_eye = eyeflare; - return (1); - } +{ +signal SIG_AIM2; +set-signal-mask SIG_AIM2; +bAiming = TRUE; +turn head to y-axis heading speed <300.000000>; +turn head to x-axis <-5.000000> - pitch speed <250.000000>; +if ( (get ABS(last_primary_heading - heading)>1800) OR (get ABS(last_primary_pitch - pitch)>1500) ) +{ + wait-for-turn head around y-axis; + wait-for-turn head around x-axis; +} +last_primary_heading=heading; +last_primary_pitch=pitch; +gun_eye = eyeflare; +start-script RestoreHeadPosition(); +return (1); +} + FireWeapon5() { sleep 100; @@ -1178,6 +1181,7 @@ AimWeapon6(heading, pitch) //turn ruparm to x-axis <0> speed <360>; wait-for-turn aimy1 around y-axis; //wait-for-turn biggun around x-axis; + start-script RestorePosition(); return (1); } diff --git a/scripts/Units/corcomhilvl.cob b/scripts/Units/corcomhilvl.cob index 8186964ea844f33d5332315eba7c8cc19926a774..526482dd9a1c90d984144a6452fc8b493317206e 100644 GIT binary patch delta 6182 zcmai&0Z`M|9moIwKrnwyYC=c@NcE!Jhxt%z8jQ+((& ziS{fLl~PV!+cF{B^kwllV_*t&WOJkfYyo?~VK50AjqLG)^oXh1gGLwD5%J*Wkax*^|0#AWM;1y7{vBv|}f)Owd zUIM4V!aR0Xfo)(6yZ}yunw>p9uo3JA2f%S~7If#cvj*%0d%;oA=CF&8^LctU2m9n2 zKH}hcg%LXoj(}G|%kAtf2ZP{Aa1fjT=fF}YI|E=B*axQ18jq1e*-^m03a|z20f)gP zXe?xp7pw=PU_Y1uXFyjGJJWM1;450h(?vYX^a%@Db#10jp0H`Ss}?)O+QocFRg1ZG z8yEvGfRmtB%(XtS5$pyBz;RHXHFnmxn4MrRI0{aIwk2Ha2SeZ~a45|McJbFGeBY|h zK3=VL`mL+=J)Q3x+a9$;OYEWm=M873gj z5$pyBz;SREbgy7%4cH0xf}`LRXe(onAH4P4#Z9{Q!I+$(`UUoSz*;Z@#=%SAG+5|i zXBF56#z20CzT@Hbx$zmgdL_@VVr7}d!td8gdO^`Uv_Zrjiz(i-l6!Nhx^}om-b)g( zFvY&HDJ%2#^R8lFJs1W1!2~!1x>mEN8VrM_LYM{@FX}0PJnY@=@;1<0K33G za12a=jy3F2{m%0bulaGdEuSaZlw;kPc@^dh+g(o8Ebqv?^@KN)H z%g?h&Arkbnr(&b79dWBzAiEeuYyzAEOTWyn0N4fgfn#6_bll4xJ|f%i&8I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