CabConModding
Facebook
Twitter
youtube
Discord
Contact us
RSS
Menu
CabConModding
Home
New
Top
Premium
Rules
FAQ - Frequently Asked Questions
Games
Fornite
Call of Duty: Black Ops 3
Clash of Clans
Grand Theft Auto 5
Apex Legends
Assassin’s Creed Origins
Forums
Premium
Latest posts
What's new
Latest posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Log in
Register
What's new
Premium
Latest posts
Menu
Log in
Register
Navigation
Install the app
Install
More options
Dark Theme
Contact us
Close Menu
Forums
Gaming
Call of Duty Classics
Call of Duty: Black Ops 2
Call of Duty: Black Ops 2 Mods and Scripts
Call of Duty: Black Ops 2 Scripts
BO2 Killcam Mod
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Cxwh" data-source="post: 39082" data-attributes="member: 22664"><p>Haven't seen this yet and decided to spent a few hours on making this (took me longer than it should have). This let's you rewatch your last kill and lets it look like the final killcam - the game obviously doesn't have to end for this.</p><p></p><p>A video so people know what I'm talking about</p><p>[MEDIA=youtube]lhjqdyMi1A4[/MEDIA]</p><p></p><p>Anyway so here's the source:[code]#include maps\mp\_utility;</p><p>#include common_scripts\utility;</p><p>#include maps\mp\gametypes\_hud_util;</p><p>#include maps\mp\gametypes\_hud_message;</p><p></p><p>//need to include these in order for it to work</p><p>#include maps\mp\gametypes\_killcam;</p><p>#include maps\mp\gametypes\_globallogic;</p><p>#include maps\mp\gametypes\_globallogic_spawn;</p><p></p><p>/*</p><p> Made using SeriousHD's GSX Studio</p><p>*/</p><p></p><p>init() {</p><p> //copy callback</p><p> level.alt = level.onplayerkilled;</p><p> level.onplayerkilled = ::onKilled;</p><p></p><p> level.debug = 1;</p><p> level thread onPlayerConnect();</p><p>}</p><p></p><p>onPlayerConnect() {</p><p> for(;;) {</p><p> level waittill("connected", player);</p><p> player thread onPlayerSpawned();</p><p> }</p><p>}</p><p></p><p>onPlayerSpawned() {</p><p> self endon("disconnect");</p><p></p><p> self thread monitor();</p><p> for(;;) {</p><p> self waittill("spawned_player");</p><p> </p><p> //don't want bots to have ghost perk</p><p> if(self.pers["isBot"])</p><p> self clearperks();</p><p> self freezecontrols(self.pers["isBot"]);</p><p> </p><p> //uav</p><p> self setclientuivisibilityflag("g_compassShowEnemies", 1);</p><p> }</p><p>}</p><p></p><p>monitor() {</p><p> self endon("disconnect");</p><p> level endon("game_ended");</p><p></p><p> for(timer = 7; true; timer -= 0.05) {</p><p> if(self ActionSlotTwoButtonPressed())</p><p> self watchLastKill();</p><p></p><p> if(self ActionSlotOneButtonPressed()) {</p><p> if(level.debug && self isHost())</p><p> exitLevel();</p><p> }</p><p> </p><p> //print controls</p><p> if(timer < 0) {</p><p> self iprintln("Exit Level - [{+actionslot 1}]");</p><p> self iprintln("Watch Last Kill - [{+actionslot 2}]");</p><p> timer = 14;</p><p> }</p><p> wait 0.05;</p><p> }</p><p>}</p><p></p><p>onKilled(einflictor, attacker, idamage, smeansofdeath, sweapon, vdir, shitloc, psoffsettime, deathanimduration) {</p><p> //doesn't change gamemode specific callbacks - so you can still score in tdm etc.</p><p> thread [[ level.alt ]](einflictor, attacker, idamage, smeansofdeath, sweapon, vdir, shitloc, psoffsettime, deathanimduration);</p><p></p><p> //ignore if kill was suicide</p><p> if(self == attacker)</p><p> return;</p><p></p><p> //info</p><p> attacker iprintln("Killed ^1" + self.name);</p><p> self iprintln("Killed by ^1" + attacker.name);</p><p></p><p> sweapon = updateweapon(einflictor, sweapon);</p><p> lpattacknum = attacker getentitynumber();</p><p> deathtimeoffset = 0;</p><p></p><p> killcamentity = self maps\mp\gametypes\_globallogic_player::getkillcamentity(attacker, einflictor, sweapon);</p><p> if(isDefined(killcamentity)) {</p><p> killcamentityindex = killcamentity getentitynumber();</p><p> if(isDefined(killcamentity.starttime))</p><p> killcamentitystarttime = killcamentity.starttime;</p><p> else</p><p> killcamentitystarttime = killcamentity.birthtime;</p><p> </p><p> if(!isDefined(killcamentitystarttime))</p><p> killcamentitystarttime = 0;</p><p> }</p><p></p><p> perks = [];</p><p> killstreaks = maps/mp/gametypes/_globallogic::getkillstreaks(attacker);</p><p></p><p> level.lastAttacker = attacker;</p><p> level thread maps/mp/gametypes/_killcam::recordkillcamsettings(lpattacknum, self getentitynumber(), sweapon, self.deathtime, deathtimeoffset, psoffsettime, killcamentityindex, killcamentitystarttime, perks, killstreaks, attacker);</p><p>}</p><p></p><p>finalkillcam(winner) {</p><p> self endon("disconnect");</p><p> level endon("game_ended");</p><p></p><p> setmatchflag("final_killcam", 0);</p><p> setmatchflag("round_end_killcam", 1);</p><p></p><p> if(level.console)</p><p> self maps/mp/gametypes/_globallogic_spawn::setthirdperson(0);</p><p></p><p> killcamsettings = level.finalkillcamsettings[winner];</p><p> postdeathdelay = (getTime() - killcamsettings.deathtime)/1000;</p><p> predelay = postdeathdelay + killcamsettings.deathtimeoffset;</p><p> camtime = maps/mp/gametypes/_killcam::calckillcamtime(killcamsettings.weapon, killcamsettings.entitystarttime, predelay, 0, undefined);</p><p> postdelay = maps/mp/gametypes/_killcam::calcpostdelay();</p><p></p><p> killcamoffset = camtime + predelay;</p><p> killcamlength = (camtime + postdelay) - 0.05;</p><p> killcamstarttime = getTime() - (killcamoffset * 1000);</p><p></p><p> self notify("begin_killcam");</p><p> self.sessionstate = "spectator";</p><p> self.spectatorclient = killcamsettings.spectatorclient;</p><p> self.killcamentity = -1;</p><p></p><p> if(killcamsettings.entityindex >= 0)</p><p> self thread maps/mp/gametypes/_killcam::setkillcamentity(killcamsettings.entityindex, killcamsettings.entitystarttime - killcamstarttime - 100);</p><p></p><p> self.killcamtargetentity = killcamsettings.targetentityindex;</p><p> self.archivetime = killcamoffset;</p><p> self.killcamlength = killcamlength;</p><p> self.psoffsettime = killcamsettings.offsettime;</p><p></p><p> team = getFirstArrayKey(level.teams);</p><p> while(isDefined(team)) {</p><p> _team = level.teams[team];</p><p> self allowspectateteam(_team, 1);</p><p> team = getNextArrayKey(level.teams, team);</p><p> }</p><p></p><p> self allowspectateteam("freelook", 1);</p><p> self allowspectateteam("none", 1);</p><p> self thread maps/mp/gametypes/_killcam::endedfinalkillcamcleanup();</p><p> wait 0.05;</p><p></p><p> if(self.archivetime <= predelay) {</p><p> self.sessionstate = "dead";</p><p> self.spectatorclient = -1;</p><p> self.killcamentity = -1;</p><p> self.archivetime = 0;</p><p> self.psoffsettime = 0;</p><p> self notify("end_killcam");</p><p> return;</p><p> }</p><p></p><p> self thread maps/mp/gametypes/_killcam::checkforabruptkillcamend();</p><p> self.killcam = 1;</p><p></p><p> //add kc timer if isn'splitscreen</p><p> if(!self issplitscreen())</p><p> self maps/mp/gametypes/_killcam::addkillcamtimer(camtime);</p><p></p><p> self thread maps/mp/gametypes/_killcam::waitkillcamtime();</p><p> self thread maps/mp/gametypes/_killcam::waitfinalkillcamslowdown(level.finalkillcamsettings[winner].deathtime, killcamstarttime);</p><p></p><p> self waittill("end_killcam");</p><p> self maps/mp/gametypes/_killcam::endkillcam(1);</p><p></p><p> //reset flags</p><p> setmatchflag("final_killcam", 0);</p><p> setmatchflag("round_end_killcam", 0);</p><p></p><p> //respawn</p><p> self [[ level.spawnplayer ]]();</p><p> self.sessionstate = "playing";</p><p></p><p> //reset timescale</p><p> setSlowMotion(1, 1, 0);</p><p> setDvar("Timescale", 1);</p><p>}</p><p></p><p>updateweapon(einflictor, sweapon) {</p><p> if(sweapon == "none" && isDefined(einflictor)) {</p><p> if(isDefined(einflictor.targetname) && einflictor.targetname == "explodable_barrel")</p><p> sweapon = "explodable_barrel_mp";</p><p> else {</p><p> if(isDefined(einflictor.destructible_type) && issubstr(einflictor.destructible_type, "vehicle_"))</p><p> sweapon = "destructible_car_mp";</p><p> }</p><p> }</p><p> return sweapon;</p><p>}</p><p></p><p>watchLastKill() {</p><p> if(!isDefined(level.lastAttacker))</p><p> return;</p><p></p><p> //save pos and angles</p><p> origin = self.origin;</p><p> angles = self.angles;</p><p></p><p> wait 0.1;</p><p> self finalkillcam(level.lastAttacker.team);</p><p> wait 0.1;</p><p></p><p> //respawn</p><p> self freezecontrols(false);</p><p> self setOrigin(origin);</p><p> self setPlayerAngles(angles);</p><p>}</p><p></p><p>/* Incase</p><p> //normal killcam instead of final killcam</p><p> attacker maps/mp/gametypes/_killcam::killcam(lpattacknum, self getentitynumber(), killcamentity, killcamentityindex, killcamentitystarttime, sweapon, self.deathtime, deathtimeoffset, psoffsettime, false, undefined, perks, killstreaks, attacker);</p><p>*/[/code]</p></blockquote><p></p>
[QUOTE="Cxwh, post: 39082, member: 22664"] Haven't seen this yet and decided to spent a few hours on making this (took me longer than it should have). This let's you rewatch your last kill and lets it look like the final killcam - the game obviously doesn't have to end for this. A video so people know what I'm talking about [MEDIA=youtube]lhjqdyMi1A4[/MEDIA] Anyway so here's the source:[code]#include maps\mp\_utility; #include common_scripts\utility; #include maps\mp\gametypes\_hud_util; #include maps\mp\gametypes\_hud_message; //need to include these in order for it to work #include maps\mp\gametypes\_killcam; #include maps\mp\gametypes\_globallogic; #include maps\mp\gametypes\_globallogic_spawn; /* Made using SeriousHD's GSX Studio */ init() { //copy callback level.alt = level.onplayerkilled; level.onplayerkilled = ::onKilled; level.debug = 1; level thread onPlayerConnect(); } onPlayerConnect() { for(;;) { level waittill("connected", player); player thread onPlayerSpawned(); } } onPlayerSpawned() { self endon("disconnect"); self thread monitor(); for(;;) { self waittill("spawned_player"); //don't want bots to have ghost perk if(self.pers["isBot"]) self clearperks(); self freezecontrols(self.pers["isBot"]); //uav self setclientuivisibilityflag("g_compassShowEnemies", 1); } } monitor() { self endon("disconnect"); level endon("game_ended"); for(timer = 7; true; timer -= 0.05) { if(self ActionSlotTwoButtonPressed()) self watchLastKill(); if(self ActionSlotOneButtonPressed()) { if(level.debug && self isHost()) exitLevel(); } //print controls if(timer < 0) { self iprintln("Exit Level - [{+actionslot 1}]"); self iprintln("Watch Last Kill - [{+actionslot 2}]"); timer = 14; } wait 0.05; } } onKilled(einflictor, attacker, idamage, smeansofdeath, sweapon, vdir, shitloc, psoffsettime, deathanimduration) { //doesn't change gamemode specific callbacks - so you can still score in tdm etc. thread [[ level.alt ]](einflictor, attacker, idamage, smeansofdeath, sweapon, vdir, shitloc, psoffsettime, deathanimduration); //ignore if kill was suicide if(self == attacker) return; //info attacker iprintln("Killed ^1" + self.name); self iprintln("Killed by ^1" + attacker.name); sweapon = updateweapon(einflictor, sweapon); lpattacknum = attacker getentitynumber(); deathtimeoffset = 0; killcamentity = self maps\mp\gametypes\_globallogic_player::getkillcamentity(attacker, einflictor, sweapon); if(isDefined(killcamentity)) { killcamentityindex = killcamentity getentitynumber(); if(isDefined(killcamentity.starttime)) killcamentitystarttime = killcamentity.starttime; else killcamentitystarttime = killcamentity.birthtime; if(!isDefined(killcamentitystarttime)) killcamentitystarttime = 0; } perks = []; killstreaks = maps/mp/gametypes/_globallogic::getkillstreaks(attacker); level.lastAttacker = attacker; level thread maps/mp/gametypes/_killcam::recordkillcamsettings(lpattacknum, self getentitynumber(), sweapon, self.deathtime, deathtimeoffset, psoffsettime, killcamentityindex, killcamentitystarttime, perks, killstreaks, attacker); } finalkillcam(winner) { self endon("disconnect"); level endon("game_ended"); setmatchflag("final_killcam", 0); setmatchflag("round_end_killcam", 1); if(level.console) self maps/mp/gametypes/_globallogic_spawn::setthirdperson(0); killcamsettings = level.finalkillcamsettings[winner]; postdeathdelay = (getTime() - killcamsettings.deathtime)/1000; predelay = postdeathdelay + killcamsettings.deathtimeoffset; camtime = maps/mp/gametypes/_killcam::calckillcamtime(killcamsettings.weapon, killcamsettings.entitystarttime, predelay, 0, undefined); postdelay = maps/mp/gametypes/_killcam::calcpostdelay(); killcamoffset = camtime + predelay; killcamlength = (camtime + postdelay) - 0.05; killcamstarttime = getTime() - (killcamoffset * 1000); self notify("begin_killcam"); self.sessionstate = "spectator"; self.spectatorclient = killcamsettings.spectatorclient; self.killcamentity = -1; if(killcamsettings.entityindex >= 0) self thread maps/mp/gametypes/_killcam::setkillcamentity(killcamsettings.entityindex, killcamsettings.entitystarttime - killcamstarttime - 100); self.killcamtargetentity = killcamsettings.targetentityindex; self.archivetime = killcamoffset; self.killcamlength = killcamlength; self.psoffsettime = killcamsettings.offsettime; team = getFirstArrayKey(level.teams); while(isDefined(team)) { _team = level.teams[team]; self allowspectateteam(_team, 1); team = getNextArrayKey(level.teams, team); } self allowspectateteam("freelook", 1); self allowspectateteam("none", 1); self thread maps/mp/gametypes/_killcam::endedfinalkillcamcleanup(); wait 0.05; if(self.archivetime <= predelay) { self.sessionstate = "dead"; self.spectatorclient = -1; self.killcamentity = -1; self.archivetime = 0; self.psoffsettime = 0; self notify("end_killcam"); return; } self thread maps/mp/gametypes/_killcam::checkforabruptkillcamend(); self.killcam = 1; //add kc timer if isn'splitscreen if(!self issplitscreen()) self maps/mp/gametypes/_killcam::addkillcamtimer(camtime); self thread maps/mp/gametypes/_killcam::waitkillcamtime(); self thread maps/mp/gametypes/_killcam::waitfinalkillcamslowdown(level.finalkillcamsettings[winner].deathtime, killcamstarttime); self waittill("end_killcam"); self maps/mp/gametypes/_killcam::endkillcam(1); //reset flags setmatchflag("final_killcam", 0); setmatchflag("round_end_killcam", 0); //respawn self [[ level.spawnplayer ]](); self.sessionstate = "playing"; //reset timescale setSlowMotion(1, 1, 0); setDvar("Timescale", 1); } updateweapon(einflictor, sweapon) { if(sweapon == "none" && isDefined(einflictor)) { if(isDefined(einflictor.targetname) && einflictor.targetname == "explodable_barrel") sweapon = "explodable_barrel_mp"; else { if(isDefined(einflictor.destructible_type) && issubstr(einflictor.destructible_type, "vehicle_")) sweapon = "destructible_car_mp"; } } return sweapon; } watchLastKill() { if(!isDefined(level.lastAttacker)) return; //save pos and angles origin = self.origin; angles = self.angles; wait 0.1; self finalkillcam(level.lastAttacker.team); wait 0.1; //respawn self freezecontrols(false); self setOrigin(origin); self setPlayerAngles(angles); } /* Incase //normal killcam instead of final killcam attacker maps/mp/gametypes/_killcam::killcam(lpattacknum, self getentitynumber(), killcamentity, killcamentityindex, killcamentitystarttime, sweapon, self.deathtime, deathtimeoffset, psoffsettime, false, undefined, perks, killstreaks, attacker); */[/code] [/QUOTE]
Verification
Post reply
Forums
Gaming
Call of Duty Classics
Call of Duty: Black Ops 2
Call of Duty: Black Ops 2 Mods and Scripts
Call of Duty: Black Ops 2 Scripts
BO2 Killcam Mod
CabConModding is now on facebook! Check the latest Updates, the Site Status and much more now!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top