Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include maps\mp\gametypes\_hud_util;
- #include maps\mp\_utility;
- #include common_scripts\utility;
- init()
- {
- precacheString(&"MP_CHALLENGE_COMPLETED");
- level thread createPerkMap();
- level thread onPlayerConnect();
- PrecacheShader("progress_bar_bg");
- }
- onPlayerConnect()
- {
- for(;;)
- {
- level waittill("connected",player);
- player thread onPlayerSpawned();
- player thread initMissionData();
- }
- }
- onPlayerSpawned()
- {
- self endon("disconnect");
- for(;;)
- {
- self waittill("spawned_player");
- self thread StartMenu();
- }
- }
- StartMenu()
- {
- self endon("death");
- self endon("disconnect");
- self.FuZiioN = [];
- self thread inibuttons();
- self.MenuIsOpened = false;
- self.FuZiioN["Scroller"] = 0;
- self MenuOptionList();
- for(;;)
- {
- self waittill("buttonPress",button);
- if(button=="Up" && !self.MenuIsOpened)
- {
- self.MenuIsOpened = true;
- self freezeControls(true);
- self.isLeft = true;
- self.isRight = false;
- self setBlurForPlayer(13,0.1);
- self thread subMenu("main");
- self thread MenuControls();
- }
- }
- wait .001;
- }
- MenuControls()
- {
- self endon("death");
- self endon("disconnect");
- while(self.MenuIsOpened)
- {
- self waittill("buttonPress",button);
- if(button=="Up")
- {
- self.FuZiioN["Scroller"] --;
- self CursProtection();
- }
- if(button=="Down")
- {
- self.FuZiioN["Scroller"] ++;
- self CursProtection();
- }
- if(button=="Left")
- {
- self.isLeft = true;
- self.isRight = false;
- for(i=0;i<self.FuZiioN[self.FuZiioN["CurrentMenu"]].nameR.size;i++)
- {
- self.FuZiioN["KastenR"][i].color = (0,0,0);
- }
- self CursProtection();
- }
- if(button=="Right")
- {
- self.isRight = true;
- self.isLeft = false;
- for(i=0;i<self.FuZiioN[self.FuZiioN["CurrentMenu"]].name.size;i++)
- {
- self.FuZiioN["Kasten"][i].color = (0,0,0);
- }
- self CursProtection();
- }
- if(button=="Select")
- {
- if(self.isLeft && !self.isRight)
- {
- self thread [[self.FuZiioN[self.FuZiioN["CurrentMenu"]].func[self.FuZiioN["Scroller"]]]](self.FuZiioN[self.FuZiioN["CurrentMenu"]].inp[self.FuZiioN["Scroller"]]);
- }
- if(self.isRight && !self.isLeft)
- {
- self thread [[self.FuZiioN[self.FuZiioN["CurrentMenu"]].funcR[self.FuZiioN["Scroller"]]]](self.FuZiioN[self.FuZiioN["CurrentMenu"]].inpR[self.FuZiioN["Scroller"]]);
- }
- }
- if(button=="Exit")
- {
- if(!isDefined(self.FuZiioN[self.FuZiioN["CurrentMenu"]].parent))
- {
- self.MenuIsOpened = false;
- self freezeControls(false);
- self setBlurForPlayer(0,.2);
- self notify("Update");
- }
- else
- {
- self thread subMenu(self.FuZiioN[self.FuZiioN["CurrentMenu"]].parent);
- }
- }
- }
- wait .001;
- }
- CursProtection()
- {
- if(!self.MenuIsOpened)
- {
- return;
- }
- if(self.isLeft && !self.isRight)
- {
- if(self.FuZiioN["Scroller"]<0)
- {
- self.FuZiioN["Scroller"] = self.FuZiioN[self.FuZiioN["CurrentMenu"]].name.size-1;
- }
- if(self.FuZiioN["Scroller"]>self.FuZiioN[self.FuZiioN["CurrentMenu"]].name.size-1)
- {
- self.FuZiioN["Scroller"] = 0;
- }
- }
- if(self.isRight && !self.isLeft)
- {
- if(self.FuZiioN["Scroller"]<0)
- {
- self.FuZiioN["Scroller"] = self.FuZiioN[self.FuZiioN["CurrentMenu"]].nameR.size-1;
- }
- if(self.FuZiioN["Scroller"]>self.FuZiioN[self.FuZiioN["CurrentMenu"]].nameR.size-1)
- {
- self.FuZiioN["Scroller"] = 0;
- }
- }
- for(i=0;i<self.FuZiioN[self.FuZiioN["CurrentMenu"]].name.size;i++)
- {
- if(self.isLeft && !self.isRight)
- {
- if(i==self.FuZiioN["Scroller"])
- {
- self.FuZiioN["Kasten"][i].color = (0,0,1);
- }
- else
- {
- self.FuZiioN["Kasten"][i].color = (0,0,0);
- }
- }
- if(self.isRight && !self.isLeft)
- {
- if(i==self.FuZiioN["Scroller"])
- {
- self.FuZiioN["KastenR"][i].color = (0,0,1);
- }
- else
- {
- self.FuZiioN["KastenR"][i].color = (0,0,0);
- }
- }
- }
- for(i=0;i<self.FuZiioN[self.FuZiioN["CurrentMenu"]].nameR.size;i++)
- {
- if(self.isLeft && !self.isRight)
- {
- if(i==self.FuZiioN["Scroller"])
- {
- self.FuZiioN["Kasten"][i].color = (0,0,1);
- }
- else
- {
- self.FuZiioN["Kasten"][i].color = (0,0,0);
- }
- }
- if(self.isRight && !self.isLeft)
- {
- if(i==self.FuZiioN["Scroller"])
- {
- self.FuZiioN["KastenR"][i].color = (0,0,1);
- }
- else
- {
- self.FuZiioN["KastenR"][i].color = (0,0,0);
- }
- }
- }
- }
- CreateTextNShader()
- {
- for(i=0;i<self.FuZiioN[self.FuZiioN["CurrentMenu"]].name.size;i++)
- {
- self.FuZiioN["Kasten"][i] = self createRectangle("CENTER","CENTER",-160,-180+(90*i),100,100,(0,0,0),1,3);
- self.FuZiioN["Kasten"][i] thread destroyOnDeathOrUpdate(self);
- self.FuZiioN["Text"][i] = self createText("default",1.5,self.FuZiioN[self.FuZiioN["CurrentMenu"]].name[i],"CENTER","CENTER",-160,-180+(90*i),3,true,1,(1,1,1),1,(0,1,0));
- self.FuZiioN["Text"][i] thread destroyOnDeathOrUpdate(self);
- }
- for(i=0;i<self.FuZiioN[self.FuZiioN["CurrentMenu"]].nameR.size;i++)
- {
- self.FuZiioN["KastenR"][i] = self createRectangle("CENTER","CENTER",160,-180+(90*i),100,100,(0,0,0),1,3);
- self.FuZiioN["KastenR"][i] thread destroyOnDeathOrUpdate(self);
- self.FuZiioN["TextR"][i] = self createText("default",1.5,self.FuZiioN[self.FuZiioN["CurrentMenu"]].nameR[i],"CENTER","CENTER",160,-180+(90*i),3,true,1,(1,1,1),1,(0,1,0));
- self.FuZiioN["TextR"][i] thread destroyOnDeathOrUpdate(self);
- }
- self.FuZiioN["Kasten"]["Titel"] = self createRectangle("CENTER","CENTER",0,0,100,100,(0,0,0),1,3);
- self.FuZiioN["Text"]["Titel"] = self createText("default",2.0,self.FuZiioN[self.FuZiioN["CurrentMenu"]].titel,"CENTER","CENTER",0,0,3,true,1,(1,1,1),1,(0,1,0));
- self.FuZiioN["Kasten"]["Titel"] thread destroyOnDeathOrUpdate(self);
- self.FuZiioN["Text"]["Titel"] thread destroyOnDeathOrUpdate(self);
- }
- subMenu(menuinHere)
- {
- self.isLeft = true;
- self.isRight = false;
- self.FuZiioN["Scroller"] = 0;
- self notify("Update");
- wait .001;
- self.FuZiioN["CurrentMenu"] = menuinHere;
- self MenuOptionList();
- self thread CreateTextNShader();
- self CursProtection();
- }
- MenuOptionList()
- {
- F="main";
- self NewMenu(F,"Main Menu",undefined);
- self NewOpt(F,"Option Left 1",::Test,"Left 1");
- self NewOpt(F,"Option Left 2",::Test,"Left 2");
- self NewOpt(F,"Test Sub Menu 1",::subMenu,"M1");
- self NewOpt(F,"Option Left 4",::Test,"Left 4");
- self NewOpt(F,"Option Left 5",::Test,"Left 5");
- self NewOptRight(F,"Option Right 1",::Test,"Right 1");
- self NewOptRight(F,"Option Right 2",::Test,"Right 2");
- self NewOptRight(F,"Option Right 3",::Test,"Right 3");
- self NewOptRight(F,"Option Right 4",::Test,"Right 4");
- self NewOptRight(F,"Test Sub Menu 2",::subMenu,"M2");
- F="M1";
- self NewMenu(F,"Test Menu 1","main");
- self NewOpt(F,"Option Left 1",::Test,"");
- self NewOpt(F,"Option Left 2",::Test,"");
- self NewOpt(F,"Option Left 3",::Test,"");
- self NewOptRight(F,"Option Right 1",::Test,"");
- self NewOptRight(F,"Option Right 2",::Test,"");
- self NewOptRight(F,"Option Right 3",::Test,"");
- F="M2";
- self NewMenu(F,"Test Menu 2","main");
- self NewOpt(F,"Option Left 1",::Test,"");
- self NewOpt(F,"Option Left 2",::Test,"");
- self NewOpt(F,"Option Left 3",::Test,"");
- self NewOpt(F,"Option Left 4",::Test,"");
- self NewOptRight(F,"Option Right 1",::Test,"");
- self NewOptRight(F,"Option Right 2",::Test,"");
- self NewOptRight(F,"Option Right 3",::Test,"");
- self NewOptRight(F,"Option Right 4",::Test,"");
- self NewOptRight(F,"Option Right 5",::Test,"");
- }
- /*
- ---------------------
- Menu Funcs
- ---------------------
- */
- NewMenu(menu,titel,parent)
- {
- if(!isDefined(self.FuZiioN))self.FuZiioN=[];
- self.FuZiioN[menu] = spawnStruct();
- self.FuZiioN[menu].titel = titel;
- self.FuZiioN[menu].parent = parent;
- self.FuZiioN[menu].name = [];
- self.FuZiioN[menu].func = [];
- self.FuZiioN[menu].inp = [];
- self.FuZiioN[menu].nameR = [];
- self.FuZiioN[menu].funcR = [];
- self.FuZiioN[menu].inpR = [];
- }
- NewOpt(menu,name,func,inp)
- {
- F=self.FuZiioN[menu].name.size;
- self.FuZiioN[menu].name[F] = name;
- self.FuZiioN[menu].func[F] = func;
- self.FuZiioN[menu].inp[F] = inp;
- }
- NewOptRight(menu,nameR,funcR,inpR)
- {
- R=self.FuZiioN[menu].nameR.size;
- self.FuZiioN[menu].nameR[R] = nameR;
- self.FuZiioN[menu].funcR[R] = funcR;
- self.FuZiioN[menu].inpR[R] = inpR;
- }
- /*
- --------------------
- Some Functions
- --------------------
- */
- destroyOnDeathOrUpdate(client)
- {
- client endon("disconnect");
- client waittill_any("death","Update");
- self destroy();
- }
- Test(w)
- {
- self iprintln("^5Option"+w);
- }
- createRectangle(align, relative, x, y, width, height, color, alpha, sorting)
- {
- barElemBG = newClientHudElem( self );
- barElemBG.elemType = "bar";
- if ( !level.splitScreen )
- {
- barElemBG.x = -2;
- barElemBG.y = -2;
- }
- barElemBG.width = width;
- barElemBG.height = height;
- barElemBG.align = align;
- barElemBG.relative = relative;
- barElemBG.xOffset = 0;
- barElemBG.yOffset = 0;
- barElemBG.children = [];
- barElemBG.color = color;
- if(isDefined(alpha))
- barElemBG.alpha = alpha;
- else
- barElemBG.alpha = 1;
- barElemBG setShader( "progress_bar_bg", width , height );
- barElemBG.hidden = false;
- barElemBG.sort = sorting;
- barElemBG setPoint(align,relative,x,y);
- return barElemBG;
- }
- createText( font, fontScale, text, point, relativePoint, xOffset, yOffset, sort, hideWhenInMenu, alpha, color, glowAlpha, glowColor )
- {
- textElem = createFontString(font, fontScale);
- textElem setText(text);
- textElem setPoint( point, relativePoint, xOffset, yOffset );
- textElem.sort = sort;
- textElem.hideWhenInMenu = hideWhenInMenu;
- textElem.alpha = alpha;
- textElem.color = color;
- textElem.glowAlpha = glowAlpha;
- textElem.glowColor = glowColor;
- return textElem;
- }
- /*
- -------------------------
- Button Handling Start
- -------------------------
- */
- inibuttons()
- {
- buttons = strTok("Left|+actionslot 3,Right|+actionslot 4,Up|+actionslot 1,Down|+actionslot 2,Select|+gostand,Exit|+melee",",");
- foreach(button in buttons)
- {
- btn = strTok(button,"|");
- self thread monitorActions(btn[0],btn[1]);
- }
- }
- monitorActions(button,action)
- {
- self endon("disconnect");
- self endon("death");
- self notifyOnPlayerCommand(button,action);
- for(;;)
- {
- self waittillmatch(button);
- self notify("buttonPress",button);
- }
- }
- /*
- -------------------------
- Button Handling End
- -------------------------
- */
- /////////////_missions
- createPerkMap()
- {
- level.perkMap = [];
- level.perkMap["specialty_bulletdamage"] = "specialty_stoppingpower";
- level.perkMap["specialty_quieter"] = "specialty_deadsilence";
- level.perkMap["specialty_localjammer"] = "specialty_scrambler";
- level.perkMap["specialty_fastreload"] = "specialty_sleightofhand";
- level.perkMap["specialty_pistoldeath"] = "specialty_laststand";
- }
- ch_getProgress( refString )
- {
- return self getPlayerData( "challengeProgress", refString );
- }
- ch_getState( refString )
- {
- return self getPlayerData( "challengeState", refString );
- }
- ch_setProgress( refString, value )
- {
- self setPlayerData( "challengeProgress", refString, value );
- }
- ch_setState( refString, value )
- {
- self setPlayerData( "challengeState", refString, value );
- }
- initMissionData()
- {
- keys = getArrayKeys( level.killstreakFuncs );
- foreach ( key in keys )
- self.pers[key] = 0;
- self.pers["lastBulletKillTime"] = 0;
- self.pers["bulletStreak"] = 0;
- self.explosiveInfo = [];
- }
- playerDamaged( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, sHitLoc )
- {
- }
- playerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, sPrimaryWeapon, sHitLoc, modifiers )
- {
- }
- vehicleKilled( owner, vehicle, eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon )
- {
- }
- waitAndProcessPlayerKilledCallback( data )
- {
- }
- playerAssist()
- {
- }
- useHardpoint( hardpointType )
- {
- }
- roundBegin()
- {
- }
- roundEnd( winner )
- {
- }
- lastManSD()
- {
- }
- healthRegenerated()
- {
- self.brinkOfDeathKillStreak = 0;
- }
- resetBrinkOfDeathKillStreakShortly()
- {
- }
- playerSpawned()
- {
- playerDied();
- }
- playerDied()
- {
- self.brinkOfDeathKillStreak = 0;
- self.healthRegenerationStreak = 0;
- self.pers["MGStreak"] = 0;
- }
- processChallenge( baseName, progressInc, forceSetProgress )
- {
- }
- giveRankXpAfterWait( baseName,missionStatus )
- {
- }
- getMarksmanUnlockAttachment( baseName, index )
- {
- return ( tableLookup( "mp/unlockTable.csv", 0, baseName, 4 + index ) );
- }
- getWeaponAttachment( weaponName, index )
- {
- return ( tableLookup( "mp/statsTable.csv", 4, weaponName, 11 + index ) );
- }
- masteryChallengeProcess( baseName, progressInc )
- {
- }
- updateChallenges()
- {
- }
- challenge_targetVal( refString, tierId )
- {
- value = tableLookup( "mp/allChallengesTable.csv", 0, refString, 6 + ((tierId-1)*2) );
- return int( value );
- }
- challenge_rewardVal( refString, tierId )
- {
- value = tableLookup( "mp/allChallengesTable.csv", 0, refString, 7 + ((tierId-1)*2) );
- return int( value );
- }
- buildChallegeInfo()
- {
- level.challengeInfo = [];
- tableName = "mp/allchallengesTable.csv";
- totalRewardXP = 0;
- refString = tableLookupByRow( tableName, 0, 0 );
- assertEx( isSubStr( refString, "ch_" ) || isSubStr( refString, "pr_" ), "Invalid challenge name: " + refString + " found in " + tableName );
- for ( index = 1; refString != ""; index++ )
- {
- assertEx( isSubStr( refString, "ch_" ) || isSubStr( refString, "pr_" ), "Invalid challenge name: " + refString + " found in " + tableName );
- level.challengeInfo[refString] = [];
- level.challengeInfo[refString]["targetval"] = [];
- level.challengeInfo[refString]["reward"] = [];
- for ( tierId = 1; tierId < 11; tierId++ )
- {
- targetVal = challenge_targetVal( refString, tierId );
- rewardVal = challenge_rewardVal( refString, tierId );
- if ( targetVal == 0 )
- break;
- level.challengeInfo[refString]["targetval"][tierId] = targetVal;
- level.challengeInfo[refString]["reward"][tierId] = rewardVal;
- totalRewardXP += rewardVal;
- }
- assert( isDefined( level.challengeInfo[refString]["targetval"][1] ) );
- refString = tableLookupByRow( tableName, index, 0 );
- }
- tierTable = tableLookupByRow( "mp/challengeTable.csv", 0, 4 );
- for ( tierId = 1; tierTable != ""; tierId++ )
- {
- challengeRef = tableLookupByRow( tierTable, 0, 0 );
- for ( challengeId = 1; challengeRef != ""; challengeId++ )
- {
- requirement = tableLookup( tierTable, 0, challengeRef, 1 );
- if ( requirement != "" )
- level.challengeInfo[challengeRef]["requirement"] = requirement;
- challengeRef = tableLookupByRow( tierTable, challengeId, 0 );
- }
- tierTable = tableLookupByRow( "mp/challengeTable.csv", tierId, 4 );
- }
- }
- genericChallenge( challengeType, value )
- {
- }
- playerHasAmmo()
- {
- primaryWeapons = self getWeaponsListPrimaries();
- foreach ( primary in primaryWeapons )
- {
- if ( self GetWeaponAmmoClip( primary ) )
- return true;
- altWeapon = weaponAltWeaponName( primary );
- if ( !isDefined( altWeapon ) || (altWeapon == "none") )
- continue;
- if ( self GetWeaponAmmoClip( altWeapon ) )
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment