Featured Replies
Сейчас на странице 0
- Нет пользователей, просматривающих эту страницу
A better way to browse. Learn more.
A full-screen app on your home screen with push notifications, badges and more.
Используя этот сайт, вы соглашаетесь Условия использования.
Hello guys,
I have made a new mod for MW2, it's the airdrop trap from MW3. The mod adds the airdrop trap to the possible contents of a care package.
Here is a video of it:
The code:
#include common_scripts\utility; #include maps\mp\_utility; #include maps\mp\gametypes\_hud_util; init() { precacheShader("cardicon_thebomb"); //Custom scripts are processed before built-in so we need to wait thread initType(); } initType() { while(!isDefined(level.lowSpawn)) wait 0.2; maps\mp\killstreaks\_airdrop::addCrateType("airdrop", "trap", 13/*Change this if you want to change the weight*/, ::TrapCrateThink); maps\mp\killstreaks\_airdrop::addCrateType("airdrop_mega", "trap", 12/*Change this if you want to change the weight*/, ::TrapCrateThink); //regenerate the max weighted value //not needed if editing _airdrop.gsc foreach (dropType, crateTypes in level.crateTypes) { level.crateMaxVal[dropType] = 0; foreach ( crateType, crateWeight in level.crateTypes[dropType] ) { if ( !crateWeight ) continue; level.crateMaxVal[dropType] += crateWeight; level.crateTypes[dropType][crateType] = level.crateMaxVal[dropType]; } } } TrapCrateThink(dropType) { self endon("death"); self.usedBy = []; if(!isDefined(dropType)) dropType = "airdrop"; random = randomInt(12); c = 0; fakeType = "ammo"; foreach(crateType,crateWeight in level.crateTypes[dropType]) { if(c==random) { fakeType = crateType; break; } c++; } if(!isDefined(game["strings"][fakeType + "_hint"])) fakeType = "ammo"; if (!level.teamBased) { maps\mp\killstreaks\_airdrop::crateSetupForUse(game["strings"][fakeType + "_hint"], "all", maps\mp\killstreaks\_killstreaks::getKillstreakCrateIcon(fakeType)); if(isDefined(self.owner)) { self maps\mp\_entityheadIcons::setHeadIcon(self.owner, "cardicon_thebomb", (0,0,24), 10, 10); self disablePlayerUse( self.owner ); } } else { maps\mp\killstreaks\_airdrop::crateSetupForUse(game["strings"][fakeType + "_hint"], "all", maps\mp\killstreaks\_killstreaks::getKillstreakCrateIcon(fakeType)); self maps\mp\killstreaks\_airdrop::setUsableByTeam(getOtherTeam(self.team)); self maps\mp\_entityheadIcons::setHeadIcon(self.team, "cardicon_thebomb", (0,0,24), 10, 10); } self thread crateEnemyCaptureThink(); self waittill("captured", player); self playsound("javelin_clu_lock"); wait 1; playfx(level.chopper_fx["explode"]["death"]["cobra"], self.origin, (0,0,1)); self playSound("cobra_helicopter_crash"); if(isDefined(self.owner) && isPlayer(self.owner)) self RadiusDamage(self.origin, 500, 200, 50, self.owner, "MOD_EXPLOSIVE", "bomb_site_mp"); else self RadiusDamage(self.origin, 500, 200, 50, undefined, "MOD_EXPLOSIVE", "bomb_site_mp"); self maps\mp\killstreaks\_airdrop::deleteCrate(); } crateEnemyCaptureThink() { while(isDefined(self)) { self waittill("trigger", player); if(isDefined(self.owner) && player==self.owner) continue; useEnt = self maps\mp\killstreaks\_airdrop::createUseEnt(); result = useEnt maps\mp\killstreaks\_airdrop::useHoldThink(player); if(isDefined(useEnt)) useEnt delete(); if(!result) continue; self notify("captured", player); } }Just paste the code in a custom gsc and load it. Alternatively you can add it to _airdrop.gsc.
Thanks to Rendflex for testing and helping.