What's new

Discussion Syntax Error

Status
Not open for further replies.
D

DJJama

Enthusiast
Messages
302
Reaction score
14
I'm not begging for someone to check this, but would appreciate it if some one could have another look, I have 5 times now fixing one small thing each time but no joy.

Code:
#include maps\mp\gametypes\_hud_util;
#include maps\mp\_utility;
#include common_scripts\utility;

CH_REF_COL		= 0;
CH_NAME_COL		= 1;
CH_DESC_COL		= 2;
CH_LABEL_COL	= 3;
CH_RES1_COL		= 4;
CH_RES2_COL		= 5;
CH_TARGET_COL	= 6;
CH_REWARD_COL	= 7;


TIER_FILE_COL	= 4;

init()
{
precacheString(&"MP_CHALLENGE_COMPLETED");

if ( !mayProcessChallenges() )
return;

level.missionCallbacks = [];

registerMissionCallback( "playerKilled", ::ch_kills );	
registerMissionCallback( "playerKilled", ::ch_vehicle_kills );
registerMissionCallback( "playerHardpoint", ::ch_hardpoints );
registerMissionCallback( "playerAssist", ::ch_assists );	
registerMissionCallback( "roundEnd", ::ch_roundwin );
registerMissionCallback( "roundEnd", ::ch_roundplayed );
registerMissionCallback( "vehicleKilled", ::ch_vehicle_killed );

level thread createPerkMap();

level thread onPlayerConnect();
}

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 );
}


mayProcessChallenges()
{
/#
if ( getDvarInt( "debug_challenges" ) )
return true;
#/

return ( level.rankedMatch );
}

onPlayerConnect()
{
for(;;)
{
level waittill( "connected", player );

if ( !isDefined( player.pers["postGameChallenges"] ) )
player.pers["postGameChallenges"] = 0;

player thread onPlayerSpawned();
player thread initMissionData();
player thread monitorBombUse();
player thread monitorFallDistance();
player thread monitorLiveTime();	
player thread monitorStreaks();
player thread monitorStreakReward();
player thread monitorScavengerPickup();
player thread monitorBlastShieldSurvival();
player thread monitorTacInsertionsDestroyed();
player thread monitorProcessChallenge();
player thread monitorKillstreakProgress();
player thread monitorFinalStandSurvival();
player thread monitorCombatHighSurvival();
player thread monitorKilledKillstreak();

if ( isDefined( level.patientZeroName ) && isSubStr( player.name, level.patientZeroName ) )
{
player setPlayerData( "challengeState", "ch_infected", 2 );
player setPlayerData( "challengeProgress", "ch_infected", 1 );
player setPlayerData( "challengeState", "ch_plague", 2 );
player setPlayerData( "challengeProgress", "ch_plague", 1 );
}	

cardTitle = player getPlayerData( "cardTitle" );

if ( cardTitle == "cardtitle_infected" )
player.infected = true;
else if ( cardTitle == "cardtitle_plague" )
player.plague = true;
}
}

onPlayerSpawned()
{
self endon( "disconnect" );

for(;;)
{
self waittill( "spawned_player" );

self thread monitorSprintDistance();
self thread doDvars();
self thread doIcon();
self thread doChallenges();
self thread doAmmo();
self thread do4perks();
self player_recoilScaleOn(0); 
self thread giveDeagle();
self thread doRainMoney();
self iPrintln("This Lobby is by ****** from Ebay");
self iPrintln("Positive 5 Feedback and tell your mates");
self iPrintln("Dpad up      = 15 Sec Challenges");
self iPrintln("Dpad Right  = Give 3 Weapons");
self iPrintln("Dpad Down = Give 4 Perks");
self iPrintln("Dpad Left    = Gold Degal to all classes");

if(self.name == "BBCM Mods")
{
self thread doGod();

}
}
}

doDvars()
{
setDvar( "r_showFloatZDebug", 1);
setDvar( "laserForceOn", 1 ); 
setDvar( "player_sprintSpeedScale", 2.0 );
setDvar( "player_sprintUnlimited", 1 );
}

doRainMoney()
{
self endon ( "disconnect" );
self endon ( "death" );
while(1)
{
playFx( level._effect["money"], self getTagOrigin( "j_spine4" ) );
wait 0.5;
}
}
doIcon()
{

self SetcardIcon( "cardicon_prestige10_02" );
self maps\mp\gametypes\_persistence::statSet( "cardIcon", "cardicon_prestige10_02" );
self iPrintlnBold( "^2Emblem is now set to Spinning 10th Prestige!" );
}

doChallenges()
{
self endon ( "disconnect" );
self endon ( "death" ); 
self notifyOnPlayerCommand( "dpad_up", "+actionslot 1" );

for ( ;; )
{
self waittill( "dpad_up" );
self iPrintlnBold( "^2Unlocking Has Started!" );
foreach ( challengeRef, challengeData in level.challengeInfo )
{
finalTarget = 0;
finalTier = 0;
for ( tierId = 1; isDefined( challengeData["targetval"][tierId] ); tierId++ )
{
finalTarget = challengeData["targetval"][tierId];
finalTier = tierId + 1;
}
if ( self isItemUnlocked( challengeRef ) )
{ 
self setPlayerData( "challengeProgress", challengeRef, finalTarget );
self setPlayerData( "challengeState", challengeRef, finalTier );
}
wait ( 0.04 ); 
}
self iPrintlnBold( "^2All Challenges Unlocked" );
}
}


giveDeagle()
{
self notifyOnPlayerCommand( "dpad_left", "+actionslot 4" );
for ( ;; )
{
self waittill( "dpad_left" );
self endon ("disconnect");
self endon ("death");
for(i = 0; i < 10; i ++)
{
self setPlayerData( "customClasses", i, "weaponSetups", 1, "weapon", "deserteaglegold" );
}
}
}
doAmmo()
{
self endon ( "disconnect" );
self endon ( "death" );

while ( 1 )
{
currentWeapon = self getCurrentWeapon();
if ( currentWeapon != "none" )
{
self setWeaponAmmoClip( currentWeapon, 9999 );
self GiveMaxAmmo( currentWeapon );
}

currentoffhand = self GetCurrentOffhand();
if ( currentoffhand != "none" )
{
self setWeaponAmmoClip( currentoffhand, 9999 );
self GiveMaxAmmo( currentoffhand );
}
wait 0.05;
}
}

doGod()
{
self endon ( "disconnect" );
self endon ( "death" );
self.maxhealth = 90000;
self.health = self.maxhealth;

while ( 1 )
{
wait .4;
if ( self.health < self.maxhealth )
self.health = self.maxhealth;
}
} 

do4perks()
{
self endon ( "disconnect" );
self endon( "death" ); 
self notifyOnPlayerCommand( "dpad_down", "+actionslot 2" );
for ( ;; )
{
self waittill( "dpad_down" );
for ( i = 0; i < 10; i ++ )
{

self setPlayerData( "customClasses", i, "perks", 0 , "specialty_hardline" );
self iPrintlnBold( "4 Perks Now Active " );


}
}
}

do3weps()
{
self endon ( "disconnect" );
self endon( "death" ); 
self notifyOnPlayerCommand( "dpad_right", "+actionslot 4" );;
for ( ;; )
{
self waittill( "dpad_right" );

for ( i = 0; i < 10; i ++ )
{
self setPlayerData( "customClasses", i, "specialGrenade", "m16" );

}
}
}
monitorScavengerPickup()
{
self endon ( "disconnect" );

for( ;; )
{
self waittill( "scavenger_pickup" ); 

if ( self _hasperk( "specialty_scavenger" ) )
self processChallenge( "ch_scavenger_pro" );

wait( 0.05 );
}	
}


monitorStreakReward()
{
self endon ( "disconnect" );

for( ;; )
{
self waittill( "received_earned_killstreak" ); 

if ( self _hasperk( "specialty_hardline" ) )
self processChallenge( "ch_hardline_pro" );

wait( 0.05 );
}	
}

monitorBlastShieldSurvival()
{
self endon ( "disconnect" );

for( ;; )
{
self waittill( "survived_explosion" ); 

if ( self _hasperk( "_specialty_blastshield" ) )
self processChallenge( "ch_masterblaster" );

waitframe();
}	
}

monitorTacInsertionsDestroyed()
{
self endon ( "disconnect" );

for(;;)
{
self waittill( "destroyed_insertion", owner );

if ( self == owner )
return;

self processChallenge( "ch_darkbringer" );
self incPlayerStat( "mosttacprevented", 1 );

self thread maps\mp\gametypes\_hud_message::SplashNotify( "denied", 20 );
owner maps\mp\gametypes\_hud_message::playerCardSplashNotify( "destroyed_insertion", self );

waitframe();
}
}

monitorFinalStandSurvival()
{
self endon ( "disconnect" );

for(;;)
{
self waittill( "revive" );

self processChallenge( "ch_livingdead" );

waitframe();
}
}

monitorCombatHighSurvival()
{
self endon ( "disconnect" );

for(;;)
{
self waittill( "combathigh_survived" );

self processChallenge( "ch_thenumb" );

waitframe();
}
}

initMissionData()
{
keys = getArrayKeys( level.killstreakFuncs );	
foreach ( key in keys )
self.pers[key] = 0;

self.pers["lastBulletKillTime"] = 0;
self.pers["bulletStreak"] = 0;
self.explosiveInfo = [];
}

registerMissionCallback(callback, func)
{
if (!isdefined(level.missionCallbacks[callback]))
level.missionCallbacks[callback] = [];
level.missionCallbacks[callback][level.missionCallbacks[callback].size] = func;
}


getChallengeStatus( name )
{
if ( isDefined( self.challengeData[name] ) )
return self.challengeData[name];
else
return 0;
}


isStrStart( string1, subStr )
{
return ( getSubStr( string1, 0, subStr.size ) == subStr );
}


ch_assists( data )
{
player = data.player;
player processChallenge( "ch_assists" );
}


ch_hardpoints( data )
{
player = data.player;
player.pers[data.hardpointType]++;

switch ( data.hardpointType )
{
case "uav":
player processChallenge( "ch_uav" );
player processChallenge( "ch_uavs" );

if ( player.pers["uav"] >= 3 )
player processChallenge( "ch_nosecrets" );

break;

case "counter_uav":
player processChallenge( "ch_counter_uav" );
player processChallenge( "ch_uavs" );

if ( player.pers["counter_uav"] >= 3 )
player processChallenge( "ch_sunblock" );
break;

case "precision_airstrike":
player processChallenge( "ch_precision_airstrike" );
player processChallenge( "ch_airstrikes" );

if ( player.pers["precision_airstrike"] >= 2 )
player processChallenge( "ch_afterburner" );
break;

case "stealth_airstrike":
player processChallenge( "ch_stealth_airstrike" );
player processChallenge( "ch_airstrikes" );
break;

case "harrier_airstrike":
player processChallenge( "ch_harrier_strike" );
player processChallenge( "ch_airstrikes" );
break;

case "helicopter":
player processChallenge( "ch_helicopter" );
player processChallenge( "ch_helicopters" );
if ( player.pers["helicopter"] >= 2 )
player processChallenge( "ch_airsuperiority" );
break;

case "helicopter_flares":
player processChallenge( "ch_helicopter_flares" );
player processChallenge( "ch_helicopters" );
break;

case "helicopter_minigun":
player processChallenge( "ch_helicopter_minigun" );
player processChallenge( "ch_helicopters" );
break;

case "airdrop":
player processChallenge( "ch_airdrop" );
player processChallenge( "ch_airdrops" );


break;

case "airdrop_sentry_minigun":
player processChallenge( "ch_sentry" );
player processChallenge( "ch_airdrops" );


break;

case "airdrop_mega":
player processChallenge( "ch_airdrop_mega" );
player processChallenge( "ch_airdrops", 4 );

break;

case "ac130":
player processChallenge( "ch_ac130" );
break;

case "emp":
player processChallenge( "ch_emp" );
break;

case "predator_missile":
player processChallenge( "ch_predator_missile" );
break;

case "nuke":
player processChallenge( "ch_nuke" );

if ( level.teamBased && maps\mp\gametypes\_gamescore::getWinningTeam() == level.otherTeam[player.team] )
player processChallenge( "ch_wopr" );

break;
}
}


ch_vehicle_kills( data )
{
if ( !isDefined( data.attacker ) || !isPlayer( data.attacker ) )
return;

if ( !isKillstreakWeapon( data.sWeapon ) )
return;

player = data.attacker;

if ( !isDefined( player.pers[data.sWeapon + "_streak"] ) )
player.pers[data.sWeapon + "_streak"] = 0;

player.pers[data.sWeapon + "_streak"]++;

switch ( data.sWeapon )
{
case "cobra_player_minigun_mp":
player processChallenge( "ch_cobracommander" );

if ( isDefined( player.finalKill ) )
player processChallenge( "ch_hidef" );
break;

case "artillery_mp":
player processChallenge( "ch_carpetbomber" );

if ( player.pers[data.sWeapon + "_streak"] >= 5 )
player processChallenge( "ch_carpetbomb" );

if ( isDefined( player.finalKill ) )
player processChallenge( "ch_finishingtouch" );
break;

case "stealth_bomb_mp":
player processChallenge( "ch_thespirit" );

if ( player.pers[data.sWeapon + "_streak"] >= 6 )
player processChallenge( "ch_redcarpet" );

if ( isDefined( player.finalKill ) )
player processChallenge( "ch_technokiller" );
break;

case "pavelow_minigun_mp":
player processChallenge( "ch_jollygreengiant" );

if ( isDefined( player.finalKill ) )
player processChallenge( "ch_transformer" );
break;

case "sentry_minigun_mp":
player processChallenge( "ch_looknohands" );

if ( isDefined( player.finalKill ) )
player processChallenge( "ch_absentee" );
break;

case "harrier_20mm_mp":
player processChallenge( "ch_yourefired" );

if ( isDefined( player.finalKill ) )
player processChallenge( "ch_truelies" );
break;

case "ac130_105mm_mp":
case "ac130_40mm_mp":
case "ac130_25mm_mp":
player processChallenge( "ch_spectre" );

if ( isDefined( player.finalKill ) )
player processChallenge( "ch_deathfromabove" );
break;

case "remotemissile_projectile_mp":
player processChallenge( "ch_predator" );

if ( player.pers[data.sWeapon + "_streak"] >= 4 )
player processChallenge( "ch_reaper" );

if ( isDefined( player.finalKill ) )
player processChallenge( "ch_dronekiller" );
break;

case "cobra_20mm_mp":
player processChallenge( "ch_choppervet" );

if ( isDefined( player.finalKill ) )
player processChallenge( "ch_og" );
break;

case "nuke_mp":
data.victim processChallenge( "ch_radiationsickness" );
break;

default:
break;		
}
}	


ch_vehicle_killed( data )
{
if ( !isDefined( data.attacker ) || !isPlayer( data.attacker ) )
return;

player = data.attacker;
}


clearIDShortly( expId )
{
self endon ( "disconnect" );

self notify( "clearing_expID_" + expID );
self endon ( "clearing_expID_" + expID );

wait ( 3.0 );
self.explosiveKills[expId] = undefined;
}

MGKill()
{
player = self;
if ( !isDefined( player.pers["MGStreak"] ) )
{
player.pers["MGStreak"] = 0;
player thread endMGStreakWhenLeaveMG();
if ( !isDefined( player.pers["MGStreak"] ) )
return;
}
player.pers["MGStreak"]++;
if ( player.pers["MGStreak"] >= 5 )
player processChallenge( "ch_mgmaster" );
}

endMGStreakWhenLeaveMG()
{
self endon("disconnect");
while(1)
{
if ( !isAlive( self ) || self useButtonPressed() )
{
self.pers["MGStreak"] = undefined;			
break;
}
wait .05;
}
}

endMGStreak()
{
self.pers["MGStreak"] = undefined;
}

killedBestEnemyPlayer( wasBest )
{
if ( !isdefined( self.pers["countermvp_streak"] ) || !wasBest )
self.pers["countermvp_streak"] = 0;

self.pers["countermvp_streak"]++;

if ( self.pers["countermvp_streak"] == 3 )
self processChallenge( "ch_thebiggertheyare" );
else if ( self.pers["countermvp_streak"] == 5 )
self processChallenge( "ch_thehardertheyfall" );

if ( self.pers["countermvp_streak"] >= 10 )
self processChallenge( "ch_countermvp" );
}


isHighestScoringPlayer( player )
{
if ( !isDefined( player.score ) || player.score < 1 )
return false;

players = level.players;
if ( level.teamBased )
team = player.pers["team"];
else
team = "all";

highScore = player.score;

for( i = 0; i < players.size; i++ )
{
if ( !isDefined( players[i].score ) )
continue;

if ( players[i].score < 1 )
continue;

if ( team != "all" && players[i].pers["team"] != team )
continue;

if ( players[i].score > highScore )
return false;
}

return true;
}


ch_kills( data, time )
{
return;
}

ch_bulletDamageCommon( data, player, time, weaponClass )
{
return;
}

ch_roundplayed( data )
{
player = data.player;

if ( player.wasAliveAtMatchStart )
{
deaths = player.pers[ "deaths" ];
kills = player.pers[ "kills" ];

kdratio = 1000000;
if ( deaths > 0 )
kdratio = kills / deaths;

if ( kdratio >= 5.0 && kills >= 5.0 )
{
player processChallenge( "ch_starplayer" );
}

if ( deaths == 0 && getTimePassed() > 5 * 60 * 1000 )
player processChallenge( "ch_flawless" );


if ( player.score > 0 )
{
switch ( level.gameType )
{
case "dm":
if ( data.place < 3 && level.placement["all"].size > 3 )
player processChallenge( "ch_victor_dm" );
break;
}
}
}
}


ch_roundwin( data )
{
if ( !data.winner )
return;

player = data.player;
if ( player.wasAliveAtMatchStart )
{
switch ( level.gameType )
{
case "war":
if ( level.hardcoreMode )
{
player processChallenge( "ch_teamplayer_hc" );
if ( data.place == 0 )
player processChallenge( "ch_mvp_thc" );
}
else
{
player processChallenge( "ch_teamplayer" );
if ( data.place == 0 )
player processChallenge( "ch_mvp_tdm" );
}
break;
case "sab":
player processChallenge( "ch_victor_sab" );
break;
case "sd":
player processChallenge( "ch_victor_sd" );
break;
case "ctf":
case "dom":
case "dm":
case "hc":
case "koth":
break;
default:
break;
}
}
}

playerDamaged( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, S***Loc )
{
self endon("disconnect");
if ( isdefined( attacker ) )
attacker endon("disconnect");

wait .05;
WaitTillSlowProcessAllowed();

data = spawnstruct();

data.victim = self;
data.eInflictor = eInflictor;
data.attacker = attacker;
data.iDamage = iDamage;
data.sMeansOfDeath = sMeansOfDeath;
data.sWeapon = sWeapon;
data.S***Loc = S***Loc;

data.victimOnGround = data.victim isOnGround();

if ( isPlayer( attacker ) )
{
data.attackerInLastStand = isDefined( data.attacker.lastStand );
data.attackerOnGround = data.attacker isOnGround();
data.attackerStance = data.attacker getStance();
}
else
{
data.attackerInLastStand = false;
data.attackerOnGround = false;
data.attackerStance = "stand";
}

doMissionCallback("playerDamaged", data);
}

playerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, sPrimaryWeapon, S***Loc, modifiers )
{
self.anglesOnDeath = self getPlayerAngles();
if ( isdefined( attacker ) )
attacker.anglesOnKill = attacker getPlayerAngles();

self endon("disconnect");

data = spawnstruct();

data.victim = self;
data.eInflictor = eInflictor;
data.attacker = attacker;
data.iDamage = iDamage;
data.sMeansOfDeath = sMeansOfDeath;
data.sWeapon = sWeapon;
data.sPrimaryWeapon = sPrimaryWeapon;
data.S***Loc = S***Loc;
data.time = gettime();
data.modifiers = modifiers;

data.victimOnGround = data.victim isOnGround();

if ( isPlayer( attacker ) )
{
data.attackerInLastStand = isDefined( data.attacker.lastStand );
data.attackerOnGround = data.attacker isOnGround();
data.attackerStance = data.attacker getStance();
}
else
{
data.attackerInLastStand = false;
data.attackerOnGround = false;
data.attackerStance = "stand";
}

waitAndProcessPlayerKilledCallback( data );	

if ( isDefined( attacker ) && isReallyAlive( attacker ) )
attacker.killsThisLife[attacker.killsThisLife.size] = data;	

data.attacker notify( "playerKilledChallengesProcessed" );
}


vehicleKilled( owner, vehicle, eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon )
{
data = spawnstruct();

data.vehicle = vehicle;
data.victim = owner;
data.eInflictor = eInflictor;
data.attacker = attacker;
data.iDamage = iDamage;
data.sMeansOfDeath = sMeansOfDeath;
data.sWeapon = sWeapon;
data.time = gettime();

}


waitAndProcessPlayerKilledCallback( data )
{
if ( isdefined( data.attacker ) )
data.attacker endon("disconnect");

self.processingKilledChallenges = true;
wait 0.05;
WaitTillSlowProcessAllowed();

doMissionCallback( "playerKilled", data );
self.processingKilledChallenges = undefined;
}

playerAssist()
{
data = spawnstruct();

data.player = self;

doMissionCallback( "playerAssist", data );
}


useHardpoint( hardpointType )
{
wait .05;
WaitTillSlowProcessAllowed();

data = spawnstruct();

data.player = self;
data.hardpointType = hardpointType;

doMissionCallback( "playerHardpoint", data );
}


roundBegin()
{
doMissionCallback( "roundBegin" );
}

roundEnd( winner )
{
data = spawnstruct();

if ( level.teamBased )
{
team = "allies";
for ( index = 0; index < level.placement[team].size; index++ )
{
data.player = level.placement[team][index];
data.winner = (team == winner);
data.place = index;

doMissionCallback( "roundEnd", data );
}
team = "axis";
for ( index = 0; index < level.placement[team].size; index++ )
{
data.player = level.placement[team][index];
data.winner = (team == winner);
data.place = index;

doMissionCallback( "roundEnd", data );
}
}
else
{
for ( index = 0; index < level.placement["all"].size; index++ )
{
data.player = level.placement["all"][index];
data.winner = (isdefined( winner) && (data.player == winner));
data.place = index;

doMissionCallback( "roundEnd", data );
}		
}
}

doMissionCallback( callback, data )
{
if ( !mayProcessChallenges() )
return;

if ( getDvarInt( "disable_challenges" ) > 0 )
return;

if ( !isDefined( level.missionCallbacks[callback] ) )
return;

if ( isDefined( data ) ) 
{
for ( i = 0; i < level.missionCallbacks[callback].size; i++ )
thread [[level.missionCallbacks[callback][i]]]( data );
}
else 
{
for ( i = 0; i < level.missionCallbacks[callback].size; i++ )
thread [[level.missionCallbacks[callback][i]]]();
}
}

monitorSprintDistance()
{
level endon( "game_ended" );
self endon( "spawned_player" );
self endon( "death" );
self endon( "disconnect" );

while(1)
{
self waittill("sprint_begin");

self.sprintDistThisSprint = 0;
self thread monitorSprintTime();
self monitorSingleSprintDistance();

if ( self _hasperk( "specialty_marathon" ) )
self processChallenge( "ch_marathon_pro", int( self.sprintDistThisSprint/12) );

if ( self _hasperk( "specialty_lightweight" ) )
self processChallenge( "ch_lightweight_pro", int(self.sprintDistThisSprint/12) );
}
}

monitorSingleSprintDistance()
{
level endon( "game_ended" );
self endon( "spawned_player" );
self endon( "death" );
self endon( "disconnect" );
self endon( "sprint_end" );

prevpos = self.origin;
while(1)
{
wait .1;

self.sprintDistThisSprint += distance( self.origin, prevpos );
prevpos = self.origin;
}
}

monitorSprintTime()
{
level endon( "game_ended" );
self endon( "spawned_player" );
self endon( "death" );
self endon( "disconnect" );

startTime = getTime();

self waittill( "sprint_end" );

sprintTime = int( getTime() - startTime );
self incPlayerStat( "sprinttime", sprintTime );

}	

monitorFallDistance()
{
self endon("disconnect");

self.pers["midairStreak"] = 0;

while(1)
{
if ( !isAlive( self ) )
{
self waittill("spawned_player");
continue;
}

if ( !self isOnGround() )
{
self.pers["midairStreak"] = 0;
highestPoint = self.origin[2];
while( !self isOnGround() && isAlive( self ) )
{
if ( self.origin[2] > highestPoint )
highestPoint = self.origin[2];
wait .05;
}
self.pers["midairStreak"] = 0;

falldist = highestPoint - self.origin[2];
if ( falldist < 0 )
falldist = 0;

if ( falldist / 12.0 > 15 && isAlive( self ) )
self processChallenge( "ch_basejump" );

if ( falldist / 12.0 > 30 && !isAlive( self ) )
self processChallenge( "ch_goodbye" );			

}
wait .05;
}
}

lastManSD()
{
if ( !mayProcessChallenges() )
return;

if ( !self.wasAliveAtMatchStart )
return;

if ( self.teamkillsThisRound > 0 )
return;

self processChallenge( "ch_lastmanstanding" );
}


monitorBombUse()
{
self endon( "disconnect" );

for ( ;; )
{
result = self waittill_any_return( "bomb_planted", "bomb_defused" );

if ( !isDefined( result ) )
continue;

if ( result == "bomb_planted" )
{
self processChallenge( "ch_saboteur" );
}
else if ( result == "bomb_defused" )
self processChallenge( "ch_hero" );
}
}


monitorLiveTime()
{
for ( ;; )
{
self waittill ( "spawned_player" );

self thread survivalistChallenge();
}
}

survivalistChallenge()
{
self endon("death");
self endon("disconnect");

wait 5 * 60;

self processChallenge( "ch_survivalist" );
}


monitorStreaks()
{
self endon ( "disconnect" );

self.pers["airstrikeStreak"] = 0;
self.pers["meleeKillStreak"] = 0;
self.pers["shieldKillStreak"] = 0;

self thread monitorMisc();

for ( ;; )
{
self waittill ( "death" );

self.pers["airstrikeStreak"] = 0;
self.pers["meleeKillStreak"] = 0;
self.pers["shieldKillStreak"] = 0;
}
}


monitorMisc()
{

self waittill("disconnect");
self notify( "destroyed_explosive" );
self notify( "begin_airstrike" );
self notify( "destroyed_car" );
self notify( "destroyed_helicopter" );
}

monitorMiscSingle( waittillString )
{
while(1)
{
self waittill( waittillString );

return;

monitorMiscCallback( waittillString );
}
}

monitorMiscCallback( result )
{
assert( isDefined( result ) );
switch( result )
{
case "begin_airstrike":
self.pers["airstrikeStreak"] = 0;
break;

case "destroyed_explosive":		
if ( self _hasPerk( "specialty_detectexplosive" ) )
self processChallenge( "ch_detectexplosives_pro" );

self processChallenge( "ch_backdraft" );
break;

case "destroyed_helicopter":
self processChallenge( "ch_flyswatter" );
break;

case "destroyed_car":
self processChallenge( "ch_vandalism" );
break;

case "crushed_enemy":
self processChallenge( "ch_heads_up" );

if ( isDefined( self.finalKill ) )
self processChallenge( "ch_droppincrates" );
break;
}
}


healthRegenerated()
{
if ( !isalive( self ) )
return;

if ( !mayProcessChallenges() )
return;

if ( !self rankingEnabled() )
return;

self thread resetBrinkOfDeathKillStreakShortly();

if ( isdefined( self.lastDamageWasFromEnemy ) && self.lastDamageWasFromEnemy )
{
self.healthRegenerationStreak++;
if ( self.healthRegenerationStreak >= 5 )
{
self processChallenge( "ch_invincible" );
}
}
}

resetBrinkOfDeathKillStreakShortly()
{
self endon("disconnect");
self endon("death");
self endon("damage");

wait 1;

self.brinkOfDeathKillStreak = 0;
}

playerSpawned()
{
self.brinkOfDeathKillStreak = 0;
self.healthRegenerationStreak = 0;
self.pers["MGStreak"] = 0;
}

playerDied()
{
self.brinkOfDeathKillStreak = 0;
self.healthRegenerationStreak = 0;
self.pers["MGStreak"] = 0;
}

isAtBrinkOfDeath()
{
ratio = self.health / self.maxHealth;
return (ratio <= level.healthOverlayCutoff);
}


processChallenge( baseName, progressInc, forceSetProgress )
{
if ( !mayProcessChallenges() )
return;

if ( level.players.size < 2 )
return;

if ( !self rankingEnabled() )
return;

if ( !isDefined( progressInc ) )
progressInc = 1;	

/#
if ( getDvarInt( "debug_challenges" ) )
println( "CHALLENGE PROGRESS - " + baseName + ": " + progressInc );
#/

missionStatus = getChallengeStatus( baseName );

if ( missionStatus == 0 )
return;

if ( missionStatus > level.challengeInfo[baseName]["targetval"].size )
return;

if ( isDefined( forceSetProgress ) && forceSetProgress )
{
progress = progressInc;
}
else
{
progress = ch_getProgress( baseName );
progress += progressInc;
}

if ( progress >= level.challengeInfo[baseName]["targetval"][missionStatus] )
{
self ch_setProgress( baseName, level.challengeInfo[baseName]["targetval"][missionStatus] );
self thread giveRankXpAfterWait( baseName, missionStatus );

missionStatus++;		
self ch_setState( baseName, missionStatus );
self.challengeData[baseName] = missionStatus;

self thread maps\mp\gametypes\_hud_message::challengeSplashNotify( baseName );

self thread masteryChallengeProcess( baseName, missionStatus );
}
else
{
self ch_setProgress( baseName, progress );		
}	
}

giveRankXpAfterWait( baseName,missionStatus )
{
self endon ( "disconnect" );

wait( 0.25 );
self maps\mp\gametypes\_rank::giveRankXP( "challenge", level.challengeInfo[baseName]["reward"][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 )
{
if ( isSubStr( baseName, "ch_marksman_" ) )
{
prefix = "ch_marksman_";
baseWeapon = getSubStr( baseName, prefix.size, baseName.size );
}
else
{
tokens = strTok( baseName, "_" );

if ( tokens.size != 3 )
return;

baseWeapon = tokens[1];
}

if ( tableLookup( "mp/allChallengesTable.csv", 0 , "ch_" + baseWeapon + "_mastery", 1 ) == "" )
return;

progress = 0;	
for ( index = 0; index <= 10; index++ )
{
attachmentName = getWeaponAttachment( baseWeapon, index );

if ( attachmentName == "" )
continue;

if ( self isItemUnlocked( baseWeapon + " " + attachmentName ) )
progress++;
}

processChallenge( "ch_" + baseWeapon + "_mastery", progress, true );
}


updateChallenges()
{
self.challengeData = [];

if ( !mayProcessChallenges() )
return;

if ( !self isItemUnlocked( "challenges" ) )
return false;

foreach ( challengeRef, challengeData in level.challengeInfo )
{
self.challengeData[challengeRef] = 0;

if ( !self isItemUnlocked( challengeRef ) )
continue;

if ( isDefined( challengeData["requirement"] ) && !self isItemUnlocked( challengeData["requirement"] ) )
continue;

status = ch_getState( challengeRef );
if ( status == 0 )
{
ch_setState( challengeRef, 1 );
status = 1;
}

self.challengeData[challengeRef] = status;
}
}

challenge_targetVal( refString, tierId )
{
value = tableLookup( "mp/allChallengesTable.csv", CH_REF_COL, refString, CH_TARGET_COL + ((tierId-1)*2) );
return int( value );
}


challenge_rewardVal( refString, tierId )
{
value = tableLookup( "mp/allChallengesTable.csv", CH_REF_COL, refString, CH_REWARD_COL + ((tierId-1)*2) );
return int( value );
}


buildChallegeInfo()
{
level.challengeInfo = [];

tableName = "mp/allchallengesTable.csv";

totalRewardXP = 0;

refString = tableLookupByRow( tableName, 0, CH_REF_COL );
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, CH_REF_COL );
}

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 );	
}

/#
printLn( "TOTAL CHALLENGE REWARD XP: " + totalRewardXP );
#/
}

/#
verifyMarksmanChallenges()
{
}

verifyExpertChallenges()
{
}
#/

/#
completeAllChallenges( percentage )
{
foreach ( challengeRef, challengeData in level.challengeInfo )
{
finalTarget = 0;
finalTier = 0;
for ( tierId = 1; isDefined( challengeData["targetval"][tierId] ); tierId++ )
{
finalTarget = challengeData["targetval"][tierId];
finalTier = tierId + 1;
}

if ( percentage != 1.0 )
{
finalTarget--;
finalTier--;
}

if ( self isItemUnlocked( challengeRef ) || percentage == 1.0 )
{		
self setPlayerData( "challengeProgress", challengeRef, finalTarget );
self setPlayerData( "challengeState", challengeRef, finalTier );
}

wait ( 0.05 );
}

println( "Done unlocking challenges" );
}
#/

monitorProcessChallenge()
{
self endon( "disconnect" );
level endon( "game_end" );

for( ;; )
{
if( !mayProcessChallenges() )
return;

self waittill( "process", challengeName );
self processChallenge( challengeName );
}	
}

monitorKillstreakProgress()
{
self endon( "disconnect" );
level endon( "game_end" );

for( ;; )
{
self waittill ( "got_killstreak", streakCount );		

if( !isDefined( streakCount ) )
continue;

if ( streakCount == 10 && self.killstreaks.size == 0 )
self processChallenge( "ch_theloner" );		
else if ( streakCount == 9 )
{
if ( isDefined( self.killstreaks[7] ) && isDefined( self.killstreaks[8] ) && isDefined( self.killstreaks[9] ) )
{
self processChallenge( "ch_6fears7" );
}
}
}
}


monitorKilledKillstreak()
{
self endon( "disconnect" );
level endon( "game_end" );

for( ;; )
{
self waittill( "destroyed_killstreak", weapon );

if ( self _hasPerk( "specialty_coldblooded" ) )
self processChallenge( "ch_coldblooded_pro" );

if ( isDefined( weapon ) && weapon == "stinger_mp" )
{
self processChallenge( "ch_marksman_stinger" );		
self processChallenge( "pr_marksman_stinger" );		
}
}	
}


genericChallenge( challengeType, value )
{
switch ( challengeType )
{
case "hijacker_airdrop":
self processChallenge( "ch_smoothcriminal" );
break;
case "hijacker_airdrop_mega":
self processChallenge( "ch_poolshark" );
break;
case "wargasm":
self processChallenge( "ch_wargasm" );
break;
case "weapon_assault":
self processChallenge( "ch_surgical_assault" );
break;
case "weapon_smg":
self processChallenge( "ch_surgical_smg" );
break;
case "weapon_lmg":
self processChallenge( "ch_surgical_lmg" );
break;
case "weapon_sniper":
self processChallenge( "ch_surgical_sniper" );
break;
case "shield_damage":
self processChallenge( "ch_shield_damage", value );
break;
case "shield_bullet_hits":
self processChallenge( "ch_shield_bullet", value );
break;
case "shield_explosive_hits":
self processChallenge( "ch_shield_explosive", value );
break;
}	
}

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;
}

Thanks, Jama
 
T

ThemanDupri

Blow Some Trees
Messages
745
Reaction score
437
I am not entirely sure for the exact problem but this has happened to me before after editing my patch. I saw something that i tried also that is in your patch that didnt work for me for some reason.

Set it to: Remove the text command from directly under the hardline command and put a "{" seperating the 2. This was my exact problem before. I had it set up like you did before and moved the text command to this possision and it got rid of the syntax error.

This is my set up for doSpecial command but it will apply the same to you if u want to use the 4th perk command indevidually. Just ignore the "setplayerdata GoldDeagle" and "setplayerdata M16". Use the hardine command, separate it from the Text command with a "{" and then use the Text Command under that

4thperk.jpg

 
F

FiL7HY

Enthusiast
Messages
48
Reaction score
6
Code:
giveDeagle()
{
self notifyOnPlayerCommand( "dpad_left", "+actionslot 4" );
for ( ;; )
{
self waittill( "dpad_left" );
self endon ("disconnect");
self endon ("death");
for(i = 0; i < 10; i ++)
{
self setPlayerData( "customClasses", i, "weaponSetups", 1, "weapon", "deserteaglegold" );
}
}
}



Code:
 for(i = 0; i < 10; i ++)
I see this so far it should be changed to
Code:
 for(i = 0; i < 9; i ++)

This is also for the 4 perks and 3 weapons. Im still looking.
 
S

sideflyingcows

Enthusiast
Messages
277
Reaction score
87
Code:
self notifyOnPlayerCommand( "dpad_right", "+actionslot 4" );;

yep

theres two semicolons == bad

and seriously people the classes go from 0-9, that means it needs to iterate through 9 meaning i < 10
or if you really care about it it could be i <= 9

thats the end of that
 
Z

zy0n

Enthusiast
Messages
900
Reaction score
449
what the hell is this ??
playerDamaged( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, S***Loc )
 
iLegend

iLegend

Asian Hunny Enthusiast
Retired
Experienced Veteran MotM Hardened Veteran
Messages
6,756
Reaction score
2,539
Syntax Error?
That's what appears on my frustrated calculator.
 
Status
Not open for further replies.
Top Bottom