SIGSTRM12GIS:/_pSignkey.EditorSignatureºŸ=4©{È;bU4xw=Y\Ò[Åó.’›Ÿ‰¦Ønõ¶³YWÛoo3ßêÓyF˜JŽa;¸Û”âAm½Ïd^ ª™ �™©­jÖ—Üà´|o\­êdÒH¥×§Ö]“rmB>Óš‰ y[ûñ¹%Cj¾¸y¯ ³"½ã¬NÚ¿&¨JZ˜Ya2\õGâvÐÛÄSÉSUÃÄBܯ}¸�¬›UAW¡âò\P*išV dü^Þ$ ”oúbbck!{ ”Å>ãf7‰1ë£Ñ3 H`ü‚BÇ <2ÒÔLݵÖà5l�Ã'‘«,Í’Î ¬Yu¡sB¿»3-PërX×4--[[ -- Change how player receives damage. -- Actors can now grab the player! -- -- player : CPlayerPuppetEntity -- dummy : CLeggedCharacterEntity -- scorpman : CLeggedCharacterEntity -- event : CReceiveDamageScriptEvent -- inflictor : CLeggedCharacterEntity -- spawnevent : CPlayerBornScriptEvent -- target : CLeggedCharacterEntity -- --]] local A_PLAYER_GIB_CUTHALF = "Default"; local A_PLAYER_GIB_CUTQUARTER = "Default"; local A_PLAYER_GIB_CLEAVE = "Default"; local A_PLAYER_GIB_RIPARMONE = "Default"; local A_PLAYER_GIB_RIPARMBOTH = "Default"; local A_PLAYER_GIB_RIPALL = "Default"; local A_PLAYER_GIB_DECAPITATE = "Default"; local A_PLAYER_GIB_HEAD = "Default"; local A_PLAYER_GIB_EXPLODE = "Default"; local A_PLAYER_GIB_STOMPSMEAR = "Default"; local A_PLAYER_GIB_STOMPHEAD = "Default"; local A_PLAYER_GIB_STOMPALL = "Default"; local A_PLAYER_GIB_EXPLODEFIRE = "Default"; local A_PLAYER_GIB_FIRE = "Default"; local A_PLAYER_GIB_DEVOURALL = "Default"; local A_PLAYER_GIB_DEVOURHALF = "Default"; local A_PLAYER_GIB_HEADELECTRICITY = "Default"; local A_PLAYER_GIB_ELECTRICITY = "Default"; worldGlobals.A_ARACHNOID_CRIT_ABLE = true; -- [[ Can scorpmen deal critical hits with their shots? --]] worldGlobals.A_ARACHNOID_CRIT_RADIUS = 0.1; -- [[ Collision sphere's radius on player's head --]] worldGlobals.A_ARACHNOID_CRIT_MULTIPLIER = 10; -- [[ Damage multiplier for the critical hit. --]] worldGlobals.A_ARACHNOID_GRAB_ABLE = true; -- [[ Can scorpmen grab the player when too close? --]] worldGlobals.A_ARACHNOID_GRAB_HPMAX = 100; -- [[ When the player has at least this amount of health, they can be grabbed. --]] worldGlobals.A_ARACHNOID_ADULT_GRAB_HPMAX = 175; worldGlobals.A_REPTILOID_GRAB_SPIN_DAMAGE = 2^10; worldGlobals.A_REPTILOID_CLAW_PUNCH_DAMAGE = 2^10; worldGlobals.A_REPTILOID_STOMP_DAMAGE = 2^10; worldGlobals.A_REPTILOID_GRAB_SPIN_ABLE = true; worldGlobals.A_REPTILOID_GRAB_STOMP_ABLE = true; worldGlobals.A_KHNUM_STOMP_ABLE = true; -- [[ Can khnum stomp the player? ]] worldGlobals.A_KHNUM_STOMPSMEAR_ABLE = true; -- [[ Can khnum stomp and smear the player? (Works even if regular stomp is disabled.) ]] worldGlobals.A_KHNUM_GRAB_ABLE = true; -- [[ Can khnum grab the player? ]] worldGlobals.A_KHNUM_GRAB_HPMAX = 100; -- [[ When the player has at least this amount of health, they can be grabbed. --]] worldGlobals.A_WALKERBLUE_CRIT_ABLE = true; worldGlobals.A_WALKERBLUE_CRIT_RADIUS = 0.1; worldGlobals.A_WALKERBLUE_CRIT_MULTIPLIER = 10; --[[ -- Check if a point is in sphere that is squished on Y axis. --]] local PointInEllipse = function(ax, ay, az, cx, cy, cz, radius, squish) local dx = ax-cx; local dy = ay-cy; local dz = az-cz; return ((dx*dx/squish + dy*dy/squish + dz*dz) < radius); end local PointInSphere = function(ax, ay, az, cx, cy, cz, radius) return PointInSphere(ax, ay, az, cx, cy, cz, radius, 1.0); end --[[ -- Return quaternion for the camera object so that it looks at the -- given target's attachment. -- Built-in LookAt function interpolates movement throughout time and -- is not immediate. -- -- Vector must be normalized! -- -- camera : CLeggedCharacterEntity -- target : CLeggedCharacterEntity --]] local LookAt = function(camera, target, target_attachment, invert) local camera_p = camera:GetPlacement(); local target_p = target:GetAttachmentAbsolutePlacement(target_attachment); local camera_v = camera_p:GetVect(); local target_v = target_p:GetVect(); local d, len; if (invert) then d = mthVector3f(camera_v.x-target_v.x, camera_v.y-target_v.y, camera_v.z-target_v.z); else d = mthVector3f(target_v.x-camera_v.x, target_v.y-camera_v.y, target_v.z-camera_v.z); end len = mthLenV3f(d); -- local alpha = mthACosF(mthDotV3f(camera_v, target_v)/(mthLenV3f(camera_v)*mthLenV3f(target_v))); return mthDirectionToQuaternion(mthVector3f(d.x/len, d.y/len, d.z/len)); end local DieAt = function(player, target, target_v, offset_y, keepnewposition) local player_p = player:GetPlacement(); local player_pold = mthCloneQuatVect(player_p); player_p:SetVect(mthVector3f(target_v.x, target_v.y+offset_y, target_v.z)); player:SetPlacement(player_p); target:InflictDamageToTarget(player, 2^10, 0, "None"); if (not keepnewposition) then player:SetPlacement(player_pold); end end --[[ -- For debugging purposes, print certain values. --]] local StringVector3 = function(name, v) return (name .. " = (" .. tostring(v.x) .. ", " .. tostring(v.y) .. ", " .. tostring(v.z) .. ")"); end local PrintVector3 = function(name, v) print(StringVector3(name, v)); end --[[ -- !Scorpman -- Tail is "Spike" for the juvenile and "Tail_04" for the adult. --]] local Scorpman_Grab = function(scorpman, bone, dummy, time, lookat, offset_y) dummy:RemoveAllWeapons(); RunHandled( function() print(":: Scorpman_Grab Grab!"); Wait(Delay(time)); print(":: Scorpman_Grab Release!"); end, OnEvery(CustomEvent("OnStep")), function() local tailtip_p = GetBonePlacementAbs(scorpman, bone); local tailtip_v = tailtip_p:GetVect(); local tailtip_r = tailtip_p:GetQuat(); local dummy_p = dummy:GetPlacement(); dummy:SetLinearVelocity(mthVector3f(0, 0, 0)); dummy_p:SetVect(mthVector3f(tailtip_v.x, tailtip_v.y+offset_y, tailtip_v.z)); --dummy_p:SetQuat(LookAt(dummy, scorpman, lookat, true)); -- Wonky for this one... dummy:SetPlacement(dummy_p); end ); end worldGlobals.PlayerHit_ScorpmanJuvenile = function(event, phead, random) local player = event:GetTarget(); local player_noarmour = (player:GetArmor() <= 0); local destruction = nil; local damagetype = event:GetDamageType(); local damageamount = event:GetDamageAmount(); local hit = event:GetDamagePoint(); local arachnoid_front_v = event:GetInflictor():GetAttachmentAbsolutePlacement("FiringFastLight"):GetVect(); local arachnoid_spike_v = event:GetInflictor():GetAttachmentAbsolutePlacement("Spike"):GetVect(); if (damagetype == "Cut") then if (random % 2) then destruction = A_PLAYER_GIB_CUTHALF; else destruction = A_PLAYER_GIB_CUTQUARTER; end if (worldGlobals.A_ARACHNOID_GRAB_ABLE and player_noarmour and player:GetHealth() <= worldGlobals.A_ARACHNOID_GRAB_HPMAX) then DieAt(player, event:GetInflictor(), arachnoid_spike_v, 0.75, false); Scorpman_Grab(event:GetInflictor(), "Spike", player, 5, "StickyBomb_01", -0.25); damageamount = worldGlobals.A_ARACHNOID_GRAB_HPMAX; end else if (worldGlobals.A_ARACHNOID_CRIT_ABLE and player_noarmour and PointInEllipse(hit.x, hit.y, hit.z, phead.x, phead.y, phead.z, worldGlobals.A_ARACHNOID_CRIT_RADIUS, 6)) then destruction = A_PLAYER_GIB_HEAD; damageamount = worldGlobals.A_ARACHNOID_CRIT_MULTIPLIER*damageamount; else if (random % 5 == 0) then destruction = A_PLAYER_GIB_HEAD; elseif (random % 5 == 1) then destruction = A_PLAYER_GIB_RIPARMBOTH; elseif (random % 5 == 2) then destruction = A_PLAYER_GIB_RIPARMONE; elseif (random % 5 == 3) then destruction = A_PLAYER_GIB_RIPALL; else destruction = nil; end end end return damageamount, damagetype, destruction; end worldGlobals.PlayerHit_ScorpmanAdult = function(event, phead, random) local player = event:GetTarget(); local player_noarmour = (player:GetArmor() <= 0); local destruction = nil; local damagetype = event:GetDamageType(); local damageamount = event:GetDamageAmount(); local hit = event:GetDamagePoint(); local arachnoid_center_v = event:GetInflictor():GetAttachmentAbsolutePlacement("Scorpman_COG"):GetVect(); local arachnoid_rclaw_v = event:GetInflictor():GetAttachmentAbsolutePlacement("Muzzle_R"):GetVect(); if (damagetype == "Cut") then destruction = A_PLAYER_GIB_CUTHALF; if (worldGlobals.A_ARACHNOID_GRAB_ABLE and player_noarmour and player:GetHealth() <= A_ARACHNOID_ADULT_GRAB_HPMAX) then DieAt(player, event:GetInflictor(), arachnoid_center_v, 1.75, false); Scorpman_Grab(event:GetInflictor(), "Tail_04", player, 10, "Scorpman_COG", 0.75); damageamount = worldGlobals.A_ARACHNOID_ADULT_GRAB_HPMAX; end elseif (damagetype == "Punch") then destruction = A_PLAYER_GIB_CUTHALF; if (worldGlobals.A_ARACHNOID_GRAB_ABLE and player:GetHealth() <= A_ARACHNOID_ADULT_GRAB_HPMAX) then Scorpman_Grab(event:GetInflictor(), "R_Claw_02", player, 2.5, "Scorpman_COG", -0.75); DieAt(player, event:GetInflictor(), arachnoid_rclaw_v, 2.75, false); damageamount = worldGlobals.A_ARACHNOID_ADULT_GRAB_HPMAX; end else if (worldGlobals.A_ARACHNOID_CRIT_ABLE and player_noarmour and PointInEllipse(hit.x, hit.y, hit.z, phead.x, phead.y, phead.z, worldGlobals.A_ARACHNOID_CRIT_RADIUS, 6)) then destruction = A_PLAYER_GIB_RIPALL; damageamount = worldGlobals.A_ARACHNOID_CRIT_MULTIPLIER*damageamount; else if (random % 4 == 0) then destruction = A_PLAYER_GIB_HEAD; elseif (random % 4 == 1) then destruction = A_PLAYER_GIB_RIPARMONE; elseif (random % 4 == 2) then destruction = A_PLAYER_GIB_RIPARMBOTH; else destruction = A_PLAYER_GIB_RIPALL; end end end return damageamount, damagetype, destruction; end --[[ -- !Khnum --]] local Khnum_Grab = function(khnum, bone, dummy, time, lookat, offset_y) RunHandled( function() print(":: Khnum_Grab Grab!"); dummy:RemoveAllWeapons(); Wait(Delay(time)); print(":: Khnum_Grab Release!"); end, OnEvery(CustomEvent("OnStep")), function() local tailtip_v = GetBonePlacementAbs(khnum, bone):GetVect(); local dummy_p = dummy:GetPlacement(); dummy_p:SetVect(mthVector3f(tailtip_v.x, tailtip_v.y+offset_y, tailtip_v.z)); dummy_p:SetQuat(LookAt(dummy, khnum, lookat, false)); dummy:SetPlacement(dummy_p); end ); end worldGlobals.PlayerHit_Khnum = function(event, phead, random) local player = event:GetTarget(); local destruction = nil; local damagetype = event:GetDamageType(); local damageamount = event:GetDamageAmount(); local khnum = event:GetInflictor(); local khnum_v = khnum:GetPlacement():GetVect(); local khnum_front_v = khnum:GetAttachmentAbsolutePlacement("GrapplingHookFront"):GetVect(); local khnum_back_v = khnum:GetAttachmentAbsolutePlacement("L_Foot"):GetVect(); local khnum_rhoof_v = khnum:GetAttachmentAbsolutePlacement("R_HoofStatic"):GetVect(); -- TODO: Rename attachment to L_Hoof. --[[ Hoof ]] if (damagetype == "Crushing") then if (worldGlobals.A_KHNUM_GRAB_ABLE) then local smear = true or (random % 2 == 1); if (smear and worldGlobals.A_KHNUM_STOMPSMEAR_ABLE) then DieAt(player, khnum, khnum_rhoof_v, 2.25, true); Khnum_Grab(khnum, "R_Hoof", player, 1.45, "GrapplingHookFront", -0.65); destruction = A_PLAYER_GIB_STOMPSMEAR; elseif (worldGlobals.A_KHNUM_STOMP_ABLE) then DieAt(player, khnum, khnum_front_v, 1.0, false); Khnum_Grab(khnum, "R_Hoof", player, 0.1, "GrapplingHookFront", -0.65); if (random % 2 == 1) then destruction = A_PLAYER_GIB_STOMPHEAD; else destruction = A_PLAYER_GIB_STOMPALL; end end end --[[ Right arm ]] elseif (damagetype == "Punch") then if (player:GetHealth() <= worldGlobals.A_KHNUM_GRAB_HPMAX) then local lookat; if (random % 2 == 0) then lookat = "GrapplingHookFront" else lookat = "R_HoofStatic"; end Khnum_Grab(khnum, "R_Pinky_Tip", player, 1.9, lookat, -0.1); end DieAt(player, khnum, khnum_front_v, 0.5, false); if (random % 2 == 0) then destruction = A_PLAYER_GIB_HEAD; else destruction = A_PLAYER_GIB_EXPLODE; end --[[ Left arm ]] elseif (damagetype == "Blunt") then if (player:GetHealth() <= worldGlobals.A_KHNUM_GRAB_HPMAX) then local lookat; if (random % 2 == 0) then lookat = "GrapplingHookFront" else lookat = "R_HoofStatic"; end Khnum_Grab(khnum, "L_Pinky_Tip", player, 1.9, lookat, -0.1); end DieAt(player, khnum, khnum_front_v, 0.5, false); if (random % 2 == 0) then destruction = A_PLAYER_GIB_HEAD; else destruction = A_PLAYER_GIB_EXPLODE; end --[[ Fireball direct ]] elseif (damagetype == "Impact") then destruction = A_PLAYER_GIB_EXPLODEFIRE; --[[ Fireball splash ]] elseif (damagetype == "Explosion") then destruction = A_PLAYER_GIB_FIRE; end return damageamount, damagetype, destruction; end --[[ -- !WalkerBlue !WB --]] worldGlobals.PlayerHit_WalkerBlue = function(event, phead, random) local player = event:GetTarget(); local destruction = nil; local damagetype = event:GetDamageType(); local damageamount = event:GetDamageAmount(); local hit = event:GetDamagePoint(); local walker = event:GetInflictor(); local player_noarmour = (player:GetArmor() <= 0); local walker_rclaw_v = walker:GetAttachmentAbsolutePlacement("Step_R"):GetVect(); if (damagetype == "Electricity") then if (worldGlobals.A_WALKERBLUE_CRIT_ABLE and player_noarmour and PointInEllipse(hit.x, hit.y, hit.z, phead.x, phead.y, phead.z, worldGlobals.A_WALKERBLUE_CRIT_RADIUS, 6)) then destruction = A_PLAYER_GIB_HEADELECTRICITY; damageamount = worldGlobals.A_WALKERBLUE_CRIT_MULTIPLIER*damageamount; else if (random % 3 == 0) then destruction = A_PLAYER_GIB_HEADELECTRICITY; elseif (random % 3 == 1) then destruction = A_PLAYER_GIB_ELECTRICITY; else destruction = nil; end end --[[ Assume everything else is simple melee... ]] --elseif (damagetype == "Crushing") --then else DieAt(player, walker, walker_rclaw_v, -1.15, true); if (random % 2 == 0) then destruction = A_PLAYER_GIB_STOMPALL; else destruction = A_PLAYER_GIB_STOMPHEAD; end end return damageamount, damagetype, destruction; end --[[ -- !Reptiloid --]] local Reptiloid_Grab = function(reptiloid, bone, dummy, time, lookat, offset_y) RunHandled( function() print(":: Khnum_Grab Grab!"); dummy:RemoveAllWeapons(); Wait(Delay(time)); print(":: Khnum_Grab Release!"); end, OnEvery(CustomEvent("OnStep")), function() local tailtip_v = GetBonePlacementAbs(reptiloid, bone):GetVect(); local dummy_p = dummy:GetPlacement(); dummy_p:SetVect(mthVector3f(tailtip_v.x, tailtip_v.y+offset_y, tailtip_v.z)); dummy_p:SetQuat(LookAt(dummy, reptiloid, lookat, false)); dummy:SetPlacement(dummy_p); end ); end worldGlobals.PlayerHit_Reptiloid = function(event, phead, random) local player = event:GetTarget(); local destruction = nil; local damagetype = event:GetDamageType(); local damageamount = event:GetDamageAmount(); local reptiloid = event:GetInflictor(); local reptiloid_front_v = reptiloid:GetAttachmentAbsolutePlacement("Netricsa.Reptiloid.01.Arms"):GetVect(); --[[ Stomping ]] if (damagetype == "Crushing") then -- TODO: Need to make one!!! damageamount = worldGlobals.A_REPTILOID_STOMP_DAMAGE; destruction = A_PLAYER_GIB_STOMPALL; --[[ Punching ]] elseif (damagetype == "Punch") then if (worldGlobals.A_REPTILOID_GRAB_SPIN_ABLE) then --[[ Spin around and destroy the dummy. ]] if (random % 3 ~= 0) then Reptiloid_Grab(reptiloid, "RightDHand", player, 1.25, "Netricsa.Reptiloid.01.Arms", -0.55); DieAt(player, reptiloid, reptiloid_front_v, -2.15, true); -- NOTE: Player can clip below the floor sometimes... damageamount = worldGlobals.A_REPTILOID_GRAB_SPIN_DAMAGE; if (random % 2 == 0) then destruction = A_PLAYER_GIB_EXPLODE; else destruction = A_PLAYER_GIB_HEAD; end --[[ Not actually grabbing! ]] else damageamount = worldGlobals.A_REPTILOID_CLAW_PUNCH_DAMAGE; if (random % 2 == 0) then destruction = A_PLAYER_GIB_HEAD; else destruction = A_PLAYER_GIB_DECAPITATE; end end --[[ If grabbing is disabled pick destruction prefix at random... ]] else if (random % 3 == 1) then destruction = A_PLAYER_GIB_HEAD; elseif (random % 3 == 2) then destruction = A_PLAYER_GIB_DECAPITATE; else destruction = nil; end end --[[ Ball splash ]] elseif (damagetype == "Explosion") then destruction = A_PLAYER_GIB_ACID; --[[ Ball direct impact ]] elseif (damagetype == "Acid") then destruction = A_PLAYER_GIB_EXPLODEACID; end return damageamount, damagetype, destruction; end local PlayerHitConfiguration = function(player, attribute) local random = 37252; player:EnableReceiveDamageScriptEvent(true); while (player:IsAlive()) do local event = Wait(Event(player.ReceiveDamage)); local inflictorname = event:GetInflictorCharacter(); local phead = player:GetPlacement():GetVect(); local actorfunction = worldGlobals.PlayerHit_Werebull; local damage, type, destruction; phead.y = phead.y+player:GetBoundingBoxSize().y+0.15; if (inflictorname == "WalkerBlue") then actorfunction = worldGlobals.PlayerHit_WalkerBlue; elseif (inflictorname == "WalkerRed") then actorfunction = worldGlobals.PlayerHit_WalkerRed; elseif (inflictorname == "Arachnoid_Soldier") then actorfunction = worldGlobals.PlayerHit_ScorpmanJuvenile; elseif (inflictorname == "Arachnoid_General") then actorfunction = worldGlobals.PlayerHit_ScorpmanAdult; elseif (inflictorname == "Arachnoid_General_Boss") then actorfunction = worldGlobals.PlayerHit_ScorpmanAdult; elseif (inflictorname == "Reptiloid") then actorfunction = worldGlobals.PlayerHit_Reptiloid; elseif (inflictorname == "Gnaar") then actorfunction = worldGlobals.PlayerHit_Gnaar; elseif (inflictorname == "Scrapjack_Rocketeer") then actorfunction = worldGlobals.PlayerHit_Scrapjack_Rocketeer; elseif (inflictorname == "Kleer") then actorfunction = worldGlobals.PlayerHit_Kleer; elseif (inflictorname == "Fish") then actorfunction = worldGlobals.PlayerHit_Fish; elseif (inflictorname == "Werebull") then actorfunction = worldGlobals.PlayerHit_Werebull; elseif (inflictorname == "Spider_Adult") then actorfunction = worldGlobals.PlayerHit_SpiderAdult; elseif (inflictorname == "Khnum") then actorfunction = worldGlobals.PlayerHit_Khnum; elseif (inflictorname == "Spider_Baby") then actorfunction = worldGlobals.PlayerHit_SpiderJuvenile; end random = mthRoundF(random+17+player:GetPlacement():GetVect().x+event:GetInflictor():GetPlacement():GetQuat().h); damage, type, destruction = actorfunction(event, phead, random); --[[ -- Deal the damage and execute the passed destruction prefix. -- The actor must "drop dead" first before exploding, -- otherwise the player will be teleported to (0, 0, 0) (wtf?). --]] event:SetDamageAmount(damage); event:SetDamageType(type); event:HandleDamage(); if (not player:IsAlive() and destruction ~= nil) then player:DropDead(0, 0, 0); player:Explode(destruction); print("Player destruction: " .. destruction); end end end --[[ -- Whenever player spawns, run an asynchronous function that indefinitely waits -- for new incoming damage to that player. --]] local PlayerSpawn = function(spawnevent) local SOUL = "/AeonCalcos/Lizardman"; local MODELPATH = "Content/SeriousSam3/Models/Player"; local player = spawnevent:GetBornPlayer(); local mymodel = string.sub(prjGetGameOptionMultiplayerModel(player), string.len(MODELPATH)+1, string.len(MODELPATH)+string.len(SOUL)); local attribute = (mymodel == SOUL); --[[ if (attribute) then if (player:GetArmor() < 25) then player:SetArmor(25); end player:SetArmor(2*player:GetArmor()); end --]] RunAsync( function() PlayerHitConfiguration(player, attribute); end ); end RunHandled( WaitForever, OnEvery(Event(worldInfo.PlayerBorn)), PlayerSpawn ); ¨¬5�“NÁ31ìû‰t¹™»œ„Ç”¢/@™å¶¡bØ »÷4‚ÞÿÞá î�I§Žöë0yr0óLªUÜriÛ©ˆ‹Ç‘sËm›@)® ³àz]¯nRôGT\óµUñ*ÞgZ§É_�¬¶æ7Œ jµ®â”‘Qbmà°ï}ëŸé3HZôÝ»1U›Ej™sPažÚ·ŠèˆÈ“ ¸žÐ28–Bš£e±z»Z=](Û%Ig©XÖ'„ŒOˆñ‹ÃLhi í@0(ø)×HÁÂýFš.²b|xT´—ú&>N bä…l4OjÊÚã·‡â. /LKOFJ†dq