diff -ur sourceold/scripts/JMGRenetBuster.h source/scripts/JMGRenetBuster.h --- sourceold/scripts/JMGRenetBuster.h 2018-11-17 10:23:57.017600000 +1000 +++ source/scripts/JMGRenetBuster.h 2019-08-20 10:11:06.799000100 +1000 @@ -540,6 +540,7 @@ unsigned long LevelsPlayedWithOutPerks; unsigned long LevelsPlayedWithPerksAsATeam; unsigned long LevelsPlayedWithOutPerksAsATeam; + JmgUtility::GenericDateTime LastPlayTime; CMTBHighScoresNode *next; CMTBHighScoresNode(void) { @@ -605,6 +606,7 @@ LevelsPlayedWithOutPerks = 0; LevelsPlayedWithPerksAsATeam = 0; LevelsPlayedWithOutPerksAsATeam = 0; + LastPlayTime = JmgUtility::GenericDateTime(); next = NULL; } }; @@ -793,7 +795,7 @@ { //CalculateKillToDeathRatio(Current); char EncryptString[2048]; - sprintf(EncryptString,"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu %lu %lu %lu 0",Current->PlayTime,Current->RoundsPlayed,Current->Deaths,Current->CometSmall,Current->CometMedium,Current->CometLarge,Current->CometHuge,Current->TheMoon,Current->UFO,Current->Mine,Current->OtherPlayers,Current->HighestScore,Current->TotalScore,Current->HighestLevel,Current->TotalComets,Current->HEWPowerups,Current->HEWUsed,Current->RoundsFired,Current->TeamHighestLevel,Current->GrantedOtherPlayersLives,Current->ReceivedOtherPlayersLives,Current->CargoShip,Current->NewLivesAcquired,Current->ObjectsRammed,Current->SOSBeacons,Current->PowerPowerups,Current->ExtraLifePowerups,Current->UsedSOSBeacons,Current->PointPowerups,Current->PowerupPoints,Current->PickedUpDrone,Current->UsedDrones,Current->DroneKills,Current->DronesKilled,Current->DronePoints,Current->RegenPowerups,Current->DoublePointsPowerups,Current->DoublePointsPoints,Current->DeerPowerups,Current->TimeCloaked,Current->ShipCloakedCount,Current->TimeShielded,Current->ShieldRaisedCount,Current->RanOutOfPowerCount,Current->CargoShipScore,Current->CargoShipKills,Current->JumpsUsed,Current->PickedUpDroneSwarm,Current->UsedDronesSwarm,Current->TimeDisrupted,Current->UpgadedWeaponPowerups,Current->UpgadedWeaponTime,Current->HighestCleanScore,Current->HighestCleanTeamScore,Current->HighestCleanLevel,Current->HighestCleanTeamLevel,Current->HighestTeamScore,Current->LevelsPlayedWithPerks,Current->LevelsPlayedWithOutPerks,Current->LevelsPlayedWithPerksAsATeam,Current->LevelsPlayedWithOutPerksAsATeam); + sprintf(EncryptString,"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu %lu %lu %lu %d %d %d %d %d %d %lu 0",Current->PlayTime,Current->RoundsPlayed,Current->Deaths,Current->CometSmall,Current->CometMedium,Current->CometLarge,Current->CometHuge,Current->TheMoon,Current->UFO,Current->Mine,Current->OtherPlayers,Current->HighestScore,Current->TotalScore,Current->HighestLevel,Current->TotalComets,Current->HEWPowerups,Current->HEWUsed,Current->RoundsFired,Current->TeamHighestLevel,Current->GrantedOtherPlayersLives,Current->ReceivedOtherPlayersLives,Current->CargoShip,Current->NewLivesAcquired,Current->ObjectsRammed,Current->SOSBeacons,Current->PowerPowerups,Current->ExtraLifePowerups,Current->UsedSOSBeacons,Current->PointPowerups,Current->PowerupPoints,Current->PickedUpDrone,Current->UsedDrones,Current->DroneKills,Current->DronesKilled,Current->DronePoints,Current->RegenPowerups,Current->DoublePointsPowerups,Current->DoublePointsPoints,Current->DeerPowerups,Current->TimeCloaked,Current->ShipCloakedCount,Current->TimeShielded,Current->ShieldRaisedCount,Current->RanOutOfPowerCount,Current->CargoShipScore,Current->CargoShipKills,Current->JumpsUsed,Current->PickedUpDroneSwarm,Current->UsedDronesSwarm,Current->TimeDisrupted,Current->UpgadedWeaponPowerups,Current->UpgadedWeaponTime,Current->HighestCleanScore,Current->HighestCleanTeamScore,Current->HighestCleanLevel,Current->HighestCleanTeamLevel,Current->HighestTeamScore,Current->LevelsPlayedWithPerks,Current->LevelsPlayedWithOutPerks,Current->LevelsPlayedWithPerksAsATeam,Current->LevelsPlayedWithOutPerksAsATeam,Current->LastPlayTime.day,Current->LastPlayTime.month,Current->LastPlayTime.year,Current->LastPlayTime.second,Current->LastPlayTime.minute,Current->LastPlayTime.hour,Current->LastPlayTime.lTime); fprintf(SaveScores2,"%s\n%s\n",Current->PlayerName,EncryptString); fprintf(SaveScores,"%s\n%s",JmgUtility::Rp2Encrypt(Current->PlayerName,25,5),JmgUtility::Rp2Encrypt2(EncryptString,Current->PlayerName[0],Current->PlayerName[1])); if (Current->next) @@ -846,7 +848,7 @@ CMTBHighScoresNode *Current = FindOrAddPlayerMAHighScoreNode(JmgUtility::Rp2Decrypt(PlayerName,25,5)); char DecryptString[2048]; fgets(DecryptString,2048,LoadScores); - sscanf(JmgUtility::Rp2Decrypt(DecryptString,Current->PlayerName[0],Current->PlayerName[1]),"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu %lu %lu %lu",&Current->PlayTime,&Current->RoundsPlayed,&Current->Deaths,&Current->CometSmall,&Current->CometMedium,&Current->CometLarge,&Current->CometHuge,&Current->TheMoon,&Current->UFO,&Current->Mine,&Current->OtherPlayers,&Current->HighestScore,&Current->TotalScore,&Current->HighestLevel,&Current->TotalComets,&Current->HEWPowerups,&Current->HEWUsed,&Current->RoundsFired,&Current->TeamHighestLevel,&Current->GrantedOtherPlayersLives,&Current->ReceivedOtherPlayersLives,&Current->CargoShip,&Current->NewLivesAcquired,&Current->ObjectsRammed,&Current->SOSBeacons,&Current->PowerPowerups,&Current->ExtraLifePowerups,&Current->UsedSOSBeacons,&Current->PointPowerups,&Current->PowerupPoints,&Current->PickedUpDrone,&Current->UsedDrones,&Current->DroneKills,&Current->DronesKilled,&Current->DronePoints,&Current->RegenPowerups,&Current->DoublePointsPowerups,&Current->DoublePointsPoints,&Current->DeerPowerups,&Current->TimeCloaked,&Current->ShipCloakedCount,&Current->TimeShielded,&Current->ShieldRaisedCount,&Current->RanOutOfPowerCount,&Current->CargoShipScore,&Current->CargoShipKills,&Current->JumpsUsed,&Current->PickedUpDroneSwarm,&Current->UsedDronesSwarm,&Current->TimeDisrupted,&Current->UpgadedWeaponPowerups,&Current->UpgadedWeaponTime,&Current->HighestCleanScore,&Current->HighestCleanTeamScore,&Current->HighestCleanLevel,&Current->HighestCleanTeamLevel,&Current->HighestTeamScore,&Current->LevelsPlayedWithPerks,&Current->LevelsPlayedWithOutPerks,&Current->LevelsPlayedWithPerksAsATeam,&Current->LevelsPlayedWithOutPerksAsATeam); + sscanf(JmgUtility::Rp2Decrypt(DecryptString,Current->PlayerName[0],Current->PlayerName[1]),"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu %lu %lu %lu %d %d %d %d %d %d %lu",&Current->PlayTime,&Current->RoundsPlayed,&Current->Deaths,&Current->CometSmall,&Current->CometMedium,&Current->CometLarge,&Current->CometHuge,&Current->TheMoon,&Current->UFO,&Current->Mine,&Current->OtherPlayers,&Current->HighestScore,&Current->TotalScore,&Current->HighestLevel,&Current->TotalComets,&Current->HEWPowerups,&Current->HEWUsed,&Current->RoundsFired,&Current->TeamHighestLevel,&Current->GrantedOtherPlayersLives,&Current->ReceivedOtherPlayersLives,&Current->CargoShip,&Current->NewLivesAcquired,&Current->ObjectsRammed,&Current->SOSBeacons,&Current->PowerPowerups,&Current->ExtraLifePowerups,&Current->UsedSOSBeacons,&Current->PointPowerups,&Current->PowerupPoints,&Current->PickedUpDrone,&Current->UsedDrones,&Current->DroneKills,&Current->DronesKilled,&Current->DronePoints,&Current->RegenPowerups,&Current->DoublePointsPowerups,&Current->DoublePointsPoints,&Current->DeerPowerups,&Current->TimeCloaked,&Current->ShipCloakedCount,&Current->TimeShielded,&Current->ShieldRaisedCount,&Current->RanOutOfPowerCount,&Current->CargoShipScore,&Current->CargoShipKills,&Current->JumpsUsed,&Current->PickedUpDroneSwarm,&Current->UsedDronesSwarm,&Current->TimeDisrupted,&Current->UpgadedWeaponPowerups,&Current->UpgadedWeaponTime,&Current->HighestCleanScore,&Current->HighestCleanTeamScore,&Current->HighestCleanLevel,&Current->HighestCleanTeamLevel,&Current->HighestTeamScore,&Current->LevelsPlayedWithPerks,&Current->LevelsPlayedWithOutPerks,&Current->LevelsPlayedWithPerksAsATeam,&Current->LevelsPlayedWithOutPerksAsATeam,&Current->LastPlayTime.day,&Current->LastPlayTime.month,&Current->LastPlayTime.year,&Current->LastPlayTime.second,&Current->LastPlayTime.minute,&Current->LastPlayTime.hour,&Current->LastPlayTime.lTime); } fclose(LoadScores); } diff -ur sourceold/scripts/JMGRenetBusters.cpp source/scripts/JMGRenetBusters.cpp --- sourceold/scripts/JMGRenetBusters.cpp 2018-11-17 10:23:57.019600000 +1000 +++ source/scripts/JMGRenetBusters.cpp 2019-08-20 10:11:06.801000100 +1000 @@ -836,11 +836,13 @@ JMG_CMTB_Main_Game_Control::PlayerSOSBeaconID = 0; } } + JmgUtility::GenericDateTime currentTime = JmgUtility::GenericDateTime(); for (int x = 0;x < MaxGamePlayerCount;x++) { if (!MiniGamePlayerControlSystem[x].GamePlayerID) continue; RenCometBustersScoreControl.Get_Current_Player_Score_Node(MiniGamePlayerControlSystem[x].PlayerID)->PlayTime++; + RenCometBustersScoreControl.Get_Current_Player_Score_Node(MiniGamePlayerControlSystem[x].PlayerID)->LastPlayTime = currentTime; if (MiniGamePlayerControlSystem[x].ShipObject) switch(MiniGamePlayerControlSystem[x].ShipObject->Type) { diff -ur sourceold/scripts/PhysicalGameObj.h source/scripts/PhysicalGameObj.h --- sourceold/scripts/PhysicalGameObj.h 2018-11-17 10:23:57.047600000 +1000 +++ source/scripts/PhysicalGameObj.h 2019-08-20 10:11:06.802000100 +1000 @@ -113,6 +113,7 @@ void Clear_Animation() {if (AnimControl) {AnimControl->Set_Animation((const char*)NULL, 0, 0);AnimControl->Set_Mode(ANIM_MODE_STOP,0);ClearAnimation = true;Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE,true);}} void Set_Team_Visibility(TeamVisibilitySetting setting) {TeamVisibility = (char)setting;Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE,true);} void Set_Player_Visible(bool visible) {PlayerVisible = visible;} + GameObject * Get_Parent_Object(){return HostGameObj;} protected: ActiveConversationClass *ActiveConversation; private: diff -ur sourceold/scripts/jmgBearHunter.cpp source/scripts/jmgBearHunter.cpp --- sourceold/scripts/jmgBearHunter.cpp 2019-06-22 07:43:44.237400000 +1000 +++ source/scripts/jmgBearHunter.cpp 2019-08-20 10:11:06.805000100 +1000 @@ -49,6 +49,23 @@ { Set_Background_Music_Player(obj,JMG_Bear_Hunter_Game_Control::currentSong); Commands->Start_Timer(obj,this,1.0f,6); + for (SLNode *current = GameObjManager::SmartGameObjList.Head();current;current = current->Next()) + { + SmartGameObj* o = current->Data(); + if (o && Is_Script_Attached(o,"JMG_Bear_Hunter_Armored_Car")) + { + JMG_Bear_Hunter_Armored_Car *script = (JMG_Bear_Hunter_Armored_Car*)Find_Script_On_Object(o,"JMG_Bear_Hunter_Armored_Car"); + if (!script || script->effectRangeId) + { + GameObject *effect = Commands->Find_Object(script->effectRangeId); + if (effect) + { + Set_Object_Visibility_For_Player(obj,script->effectRangeId,false); + Update_Network_Object_Player(effect,playerId); + } + } + } + } } } PlayerData.players[playerId]->displayedKillMessage = false; @@ -68,9 +85,9 @@ clipBullets = 0; if (!PlayerData.players[playerId]->hasGotIntro) { - Commands->Start_Timer(obj,this,10.0f,2); - Commands->Start_Timer(obj,this,16.0f,3); - Commands->Start_Timer(obj,this,22.0f,4); + Commands->Start_Timer(obj,this,14.0f,2); + Commands->Start_Timer(obj,this,24.0f,3); + Commands->Start_Timer(obj,this,34.0f,4); PlayerData.players[playerId]->killsWithoutGettingHurt = 0; } if (PlayerData.players[playerId]->firstJoin) @@ -142,25 +159,43 @@ LastTime = CurrentTime; Vector3 Pos = Commands->Get_Position(obj); if (TimeDiff) - JMG_Bear_Hunter_Player_Soldier::speed[playerId] = Commands->Get_Distance(Pos,LastPosition) * (1000.0f/TimeDiff); + JMG_Bear_Hunter_Player_Soldier::speed[playerId] = Commands->Get_Distance(Pos,LastPosition)*(1000.0f/TimeDiff); LastPosition = Pos; + if (lastDamaged) + lastDamaged--; + if (armoredCarWeapon.lastFireTime) + armoredCarWeapon.lastFireTime--; Commands->Start_Timer(obj,this,0.1f,1); } if (number == 2) switch (JMG_Bear_Hunter_Game_Control::gameState) { - case JMG_Bear_Hunter_Game_Control::LeaveBase:case JMG_Bear_Hunter_Game_Control::HuntBears:JmgUtility::DisplayChatMessage(obj,127,127,255,"San Casina Rug Co: Hello, you must be here for the money, as I'm sure you've heard, San Casina Rug Co. is in desperate need for bear rugs, and we are willing to pay 30 dollars a pelt.");return; - case JMG_Bear_Hunter_Game_Control::MutationStart:JmgUtility::DisplayChatMessage(obj,127,127,255,"San Casina Rug Co: Hello, I'm sure you came down to make some money killing bears, got some good news for you: a tiberium meteorite hit, and mutated the wildlife, mutant bear pelts are far more valuable, head north and join in the fun!");return; - case JMG_Bear_Hunter_Game_Control::FallBack:case JMG_Bear_Hunter_Game_Control::DefendPrez:JmgUtility::DisplayChatMessage(obj,127,127,255,"San Casina Rug Co: Welcome, its a bad time for you to have joined us, a tiberium meteorite hit, and now we're under attack by mutant wildlife, grab a gun and help us defend the President of Corporate America!");return; - case JMG_Bear_Hunter_Game_Control::SecureBase:JmgUtility::DisplayChatMessage(obj,127,127,255,"San Casina Rug Co: Greetings, victory is at hand, all we need to do is kill the remaining mutants inside the base!");return; - case JMG_Bear_Hunter_Game_Control::BossArrive:JmgUtility::DisplayChatMessage(obj,127,127,255,"San Casina Rug Co: Greetings, Kill the boss and this will be all over!");return; + case JMG_Bear_Hunter_Game_Control::LeaveBase:case JMG_Bear_Hunter_Game_Control::HuntBears: + JmgUtility::DisplayChatMessage(obj,127,127,255,"Bear Rug Co: Hello, you must be here for the money, as I'm sure you've heard, Bear Rug Co. is in desperate need for bear rugs, and we are willing to pay 30 dollars a pelt."); + Create_2D_Wave_Sound_Dialog_Player(obj,"BH1.mp3");return; + case JMG_Bear_Hunter_Game_Control::MutationStart: + JmgUtility::DisplayChatMessage(obj,127,127,255,"Bear Rug Co: Hello, I'm sure you came down to make some money killing bears, got some good news for you: a tiberium meteorite hit, and mutated the wildlife, mutant bear pelts are far more valuable, head north and join in the fun!"); + Create_2D_Wave_Sound_Dialog_Player(obj,"BH2.mp3");return; + case JMG_Bear_Hunter_Game_Control::FallBack:case JMG_Bear_Hunter_Game_Control::DefendPrez: + JmgUtility::DisplayChatMessage(obj,127,127,255,"Bear Rug Co: Welcome, its a bad time for you to have joined us, a tiberium meteorite hit, and now we're under attack by mutant wildlife, grab a gun and help us defend the President of Corporate America!"); + Create_2D_Wave_Sound_Dialog_Player(obj,"BH3.mp3");return; + case JMG_Bear_Hunter_Game_Control::SecureBase: + JmgUtility::DisplayChatMessage(obj,127,127,255,"Bear Rug Co: Greetings, victory is at hand, all we need to do is kill the remaining mutants inside the base!"); + Create_2D_Wave_Sound_Dialog_Player(obj,"BH4.mp3");return; + case JMG_Bear_Hunter_Game_Control::BossArrive: + JmgUtility::DisplayChatMessage(obj,127,127,255,"Bear Rug Co: Greetings, Kill the boss and this will be all over!"); + Create_2D_Wave_Sound_Dialog_Player(obj,"BH5.mp3");return; } if (number == 3) - JmgUtility::DisplayChatMessage(obj,127,127,255,"San Casina Rug Co: Feel free to buy weapons at your nearest PCT, and once your ready, head north into the swamp and start making some money!"); + { + JmgUtility::DisplayChatMessage(obj,127,127,255,"Bear Rug Co: Feel free to buy weapons at your nearest PCT, and once your ready, head north into the swamp and start making some money!"); + Create_2D_Wave_Sound_Dialog_Player(obj,"BH6.mp3"); + } if (number == 4) { PlayerData.players[playerId]->hasGotIntro = true; - JmgUtility::DisplayChatMessage(obj,127,127,255,"San Casina Rug Co: Oh, and as a tempory promotion, we are giving out an extra $50.00 every time someone kills 10 in a row without getting hurt! And we'll give out $1,000.00 to anyone that can kill 250!"); + JmgUtility::DisplayChatMessage(obj,127,127,255,"Bear Rug Co: Oh, and as a tempory promotion, we are giving out an extra $50.00 every time someone kills 10 in a row without getting hurt! And we'll give out $1,000.00 to anyone that can kill 250!"); + Create_2D_Wave_Sound_Dialog_Player(obj,"BH7.mp3"); } if (number == 5) { @@ -199,7 +234,10 @@ void JMG_Bear_Hunter_Player_Soldier::Damaged(GameObject *obj,GameObject *damager,float damage) { if (damage > 0) + { + lastDamaged = 150; PlayerData.players[playerId]->killsWithoutGettingHurt = 0; + } } void JMG_Bear_Hunter_Player_Soldier::Killed(GameObject *obj,GameObject *killer) { @@ -209,8 +247,6 @@ PlayerData.players[playerId]->deaths++; scoreNode->Deaths++; } - if (playerId && !JMG_Bear_Hunter_Game_Control::remainingLives[playerId]) - JMG_Bear_Hunter_Game_Control::playerAlive[playerId] = false; char deathMsg[500]; unsigned int killerWarheadId = Get_Damage_Warhead(); if (!killer) @@ -251,6 +287,8 @@ } void JMG_Bear_Hunter_Player_Soldier::Destroyed(GameObject *obj) { + if (playerId && !JMG_Bear_Hunter_Game_Control::remainingLives[playerId]) + JMG_Bear_Hunter_Game_Control::playerAlive[playerId] = false; if (!PlayerData.players[playerId]) return; PlayerData.players[playerId]->destroyTime = clock(); @@ -425,6 +463,7 @@ } void JMG_Bear_Hunter_Game_Control::Created(GameObject *obj) { + bonusObjectiveCount = 0; hasBeenInjured = false; spawnKarma = 0; smoothFade = false; @@ -446,6 +485,7 @@ aiIgnorePlayers[x] = 0; remainingLives[x] = 0; playerAlive[x] = true; + wanderingAiIgnorePlayers[x] = 0; } bossRabitDead = 0; bearTransition = 0; @@ -501,6 +541,9 @@ engineerSpawnedOnce[x] = false; } engineerScanTime = 0; + for (int x = 0;x < 8;x++) + wildMountainLionIds[x] = 0; + wildMountainLionsPet = 0; for (int x = 0;x < 6;x++) { weaponsFound[x] = false; @@ -538,14 +581,23 @@ Commands->Attach_Script(obj,"JMG_Bear_Hunter_Wolf_Pack_Definition","3,Wild_Wolf_Twiddler,3,-400.0 230.0 -0.11,50.0,120,30,60.0,15.0,1.5,1"); Commands->Attach_Script(obj,"JMG_Bear_Hunter_Wolf_Pack_Controller",""); Commands->Attach_Script(obj,"JMG_Utility_Dynamic_Clock_Control",""); + Commands->Attach_Script(obj,"JMG_Bear_Hunter_Armored_Car_Controller",""); + Commands->Attach_Script(obj,"JMG_Utility_Basic_Spawner_In_Radius","Skittish_Animal_Wander_Point,0.1,0.0,500,0.0,450.0,0.0,500.0,0.0 0.0 -1000.0,1.0,1.0,1,5,0.25,-1,-1,-1,1,1,0.0 0.0 1.0,0.0,1,5.0,1,0,0,0.0 0.0 0.0,-1,0.0"); } void JMG_Bear_Hunter_Game_Control::Timer_Expired(GameObject *obj,int number) { if (number == 1) { for (int x = 0;x < 128;x++) + { if (aiIgnorePlayers[x] > 0) aiIgnorePlayers[x]--; + if (wanderingAiIgnorePlayers[x]) + wanderingAiIgnorePlayers[x]--; + GameObject *player = Get_GameObj(x); + if (player && !Is_Script_Attached(player,"JMG_Rp2_Dedicated_Server_Sound_Emulator")) + Commands->Attach_Script(player,"JMG_Rp2_Dedicated_Server_Sound_Emulator",""); + } bearHunterScoreSystem.IncreasePlayerTimeScores(); if (The_Game()->Is_Game_Over()) { @@ -594,21 +646,6 @@ for (int x = 0;x < 5;x++) Commands->Create_Sound("Mission_Failed",Commands->Get_Position(obj),obj); } - if (JMG_Bear_Hunter_Game_Control::gameState == JMG_Bear_Hunter_Game_Control::BossArrive && !playersDead) - { - bool playersAlive = false; - for (int x = 0;x < 128;x++) - { - GameObject *player = Get_GameObj(x); - if (!player || Get_Player_Type(player) == -4) - continue; - if (!playerAlive[x]) - continue; - playersAlive = true; - } - if (!playersAlive) - playersDead = true; - } if (bossRabitDead) { bossRabitDead--; @@ -679,15 +716,16 @@ Commands->Set_Objective_HUD_Info_Position(3,2,"POGCabin.tga",7387,Vector3(15.593f,-93.453f,-0.166f)); if (NewObjectiveSystemControl.Get_Objective_Status(13) == NewObjectiveSystem::NotDefined) { - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: There is an alert system placed at the cabin, activating it would defintly attact attention of the bears."); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: There is an alert system placed at the cabin, activating it would defintly attract attention of the bears."); NewObjectiveSystemControl.Add_Objective(13,NewObjectiveSystem::Secondary,NewObjectiveSystem::Pending,12739,"",12739); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH8.mp3"); } } if (!atCabin) { if (gameState < MutationStart && !alarmSwitchActive) { - sprintf(currentSong,"SpecForce_Sneak_02.mp3");//04-ambient industrial + sprintf(currentSong,"SpecForce_Sneak_02.mp3"); Commands->Fade_Background_Music("SpecForce_Sneak_02.mp3",5000,5000); } NewObjectiveSystemControl.Set_Objective_Mission(11,12729,12729); @@ -697,7 +735,8 @@ if (JMG_Bear_Hunter_Player_Assist_AI::maxWait > 0) JMG_Bear_Hunter_Player_Assist_AI::maxWait--; for (int x = 0;x < 6;x++) - randomSelectableSpawnPoints[x].DecreaseValue(); + if (x != 4) + randomSelectableSpawnPoints[x].DecreaseValue(); for (int x = 0;x < 2;x++) if (easTowers[x].activeTime) { @@ -754,6 +793,7 @@ if (!player || Get_Player_Type(player) == -4 || JmgUtility::SimpleDistance(Commands->Get_Position(switchObj),Commands->Get_Position(player)) >= 22500) continue; JmgUtility::DisplayChatMessage(player,127,127,255,"Bear Rug Co: Great work holding those bears off, here is a small bonus!"); + Create_2D_Wave_Sound_Dialog_Player(player,"BH9.mp3"); Commands->Give_Money(player,250.0f,0); BearHunterScoreSystem::BHScoreNode *node = bearHunterScoreSystem.Get_Current_Player_Score_Node(x); if (node) @@ -783,6 +823,7 @@ JMG_Bear_Hunter_Player_Assist_AI::maxWait = 0; NewObjectiveSystemControl.Set_Objective_Status(1,NewObjectiveSystem::Accomplished); JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: We need more rugs, get out there and kill us some bears!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH10.mp3"); NewObjectiveSystemControl.Add_Objective(2,NewObjectiveSystem::Primary,NewObjectiveSystem::Pending,12694,"",12694); sprintf(currentSong,"SpecForce_Sneak_02.mp3"); Commands->Fade_Background_Music("SpecForce_Sneak_02.mp3",10000,10000); @@ -790,6 +831,31 @@ JmgUtility::SetHUDHelpText(objective,Vector3(0,1,0)); Commands->Set_Objective_HUD_Info_Position(2,1,"PogBear.tga",12700,Vector3(15.593f,-93.453f,-0.166f)); Commands->Start_Timer(obj,this,0.1f,16); + for (int x = 0;x < 8;x++) + { + Rp2SimplePositionSystem::SimplePositionNode *node = JMG_Wandering_AI_Controller::wanderPoints.GetRandomFromGroup(256); + if (!node) + continue; + GameObject *mlion = Commands->Create_Object("Normal_Mountain_Lion_Twiddler",node->position); + Vector3 pos = node->position; + MoveablePhysClass *mphys = mlion->As_PhysicalGameObj() ? mlion->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : NULL; + if (mphys) + mphys->Find_Teleport_Location(pos,2.0f,&pos); + Commands->Enable_HUD_Pokable_Indicator(mlion,true); + Commands->Set_Position(mlion,pos); + mlion->As_SoldierGameObj()->Set_Override_Muzzle_Direction(true); + char params[256]; + sprintf(params,"%d,268427,0,0.0,1",Commands->Get_ID(obj)); + Commands->Attach_Script(mlion,"JMG_Utility_Player_Seen_Send_Custom",params); + sprintf(params,"%d,2684270,%d,0.0,1,2",Commands->Get_ID(obj),x); + Commands->Attach_Script(mlion,"JMG_Utility_Poke_Send_Custom_From_Poker",params); + Commands->Attach_Script(mlion,"JMG_Utility_AI_Guardian_Infantry","256,0.15,-1,1,0,0"); + sprintf(params,"%d,268427,1,0.0",Commands->Get_ID(obj)); + Commands->Attach_Script(mlion,"JMG_Utility_Destroy_Send_Custom",params); + Commands->Attach_Script(mlion,"JMG_Utility_Killed_Send_Custom_From_Killer",params); + Attach_Script_Once(mlion,"JMG_Security_Camera_Behavior_Ignore",""); + wildMountainLionIds[x] = Commands->Get_ID(mlion); + } return; } } @@ -807,34 +873,46 @@ if (gameTime == 1780) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: There is a little cabin up north with some supplies, if you head up there you'll have easy hunting."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH11.mp3"); NewObjectiveSystemControl.Add_Objective(11,NewObjectiveSystem::Secondary,NewObjectiveSystem::Pending,12729,"",12729,Vector3(15.593f,-93.453f,-0.166f)); } if (gameTime == 1770) { - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Oh also, we'll pay everyone big bucks if you can deliver the turret supplies from the warehouse to the North East."); - NewObjectiveSystemControl.Add_Objective(9,NewObjectiveSystem::Tertiary,NewObjectiveSystem::Pending,12727,"",12727,Vector3(434.101f,539.071f,1.142f)); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: 3 Pump Jacks have fallen into disrepair in the East, repair them for additional profit."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH12.mp3"); + IncreaseBonusObjectiveCount(17); + NewObjectiveSystemControl.Add_Objective(17,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12748,"",12748,bonusObjectiveCount); } if (gameTime == 1760) { - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: One last thing, we had a helicopter go down in the swamp to the North West there are 5 surviving engineers that could use an escort back to base; we will of course pay for their safe return."); - NewObjectiveSystemControl.Add_Objective(15,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12741,"",12741,3); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: 7 of our oil rigs to the north have gone off-line, if you head up there and activate them we'll give you a cut of the profits."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH13.mp3"); + IncreaseBonusObjectiveCount(16); + NewObjectiveSystemControl.Add_Objective(16,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12758,"",12758,bonusObjectiveCount); } if (gameTime == 1730) { - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: 7 of our oil rigs to the north have gone off-line, if you head up there and activate them we'll give you a cut of the profits."); - NewObjectiveSystemControl.Add_Objective(16,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12758,"",12758,4); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Oh also, we'll pay everyone big bucks if you can deliver the turret supplies from the warehouse in the North East."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH14.mp3"); + NewObjectiveSystemControl.Add_Objective(9,NewObjectiveSystem::Tertiary,NewObjectiveSystem::Pending,12727,"",12727,Vector3(434.101f,539.071f,1.142f)); } if (gameTime == 1700) { - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: 3 other Pump Jacks have fallen into disrepair in the East, repair them for additional profit."); - NewObjectiveSystemControl.Add_Objective(17,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12748,"",12748,5); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: One last thing, we had a helicopter go down in the swamp to the North West there are 5 surviving engineers that could use an escort back to base; we will of course pay for their safe return."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH15.mp3"); + IncreaseBonusObjectiveCount(15); + NewObjectiveSystemControl.Add_Objective(15,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12741,"",12741,bonusObjectiveCount); } if (gameTime == 1500) + { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Half way there, you guys better get those bears while you can, because they won't be worth much when we hit our quota!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH16.mp3"); + } if (gameTime == 1196) { gameState = MutationStart; JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Wow! Was that a Tiberium meteorite that just hit?"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH17.mp3"); BearHunterWolfHivemindSystem::BearHunterWolfHivemindNode *node = bearHunterWolfHivemindControl.find(2); if (node) node->maxPackSize = 5; @@ -881,6 +959,7 @@ { char successMsg[220]; sprintf(successMsg,"Bear Rug Co: There are %d inactive pumpjacks to the North that survied that meteor impact, hurry up and activate them.",inactivePumpjackCount); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH18.mp3"); JmgUtility::MessageAllPlayers(127,127,255,successMsg); unsigned int textId = (7-inactivePumpjackCount == 1) ? 12752 : (7-inactivePumpjackCount == 2) ? 12753 : (7-inactivePumpjackCount == 3) ? 12754 : (7-inactivePumpjackCount == 4) ? 12755 : 12756; NewObjectiveSystemControl.Set_Objective_Mission(16,textId,textId); @@ -888,16 +967,23 @@ if (!livingPumpjacks) { if (!inactivePumpjackCount) + { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: All of the pump jacks to the North were destroyed by that meteor, guess we should have repaired them!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH19.mp3"); + } else + { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Looks like that meteor impact also wiped out all the pumpjacks to the North!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH20.mp3"); + } NewObjectiveSystemControl.Set_Objective_Status(16,NewObjectiveSystem::Failed); } } } if (gameTime == 1180) { - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Looks like it was, and mutation has already spread to the local bears, I bet those pelts would be worth way more than a normal bears'... You should head north, there is a little house with supplies."); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Looks like it was, and mutation has already spread to the local bears, I bet those pelts would be worth way more than a normal bears'... You should head North, there is a little house with supplies."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH21.mp3"); objective = 12696; JmgUtility::SetHUDHelpText(objective,Vector3(0,1,0)); NewObjectiveSystemControl.Set_Objective_Status(2,NewObjectiveSystem::Accomplished); @@ -916,6 +1002,7 @@ if (node) node->maxPackSize = 0; JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Local deer have begun to show effects of mutation, we're locking the base down for the President of Corporate America's safety!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH22.mp3"); Commands->Static_Anim_Phys_Goto_Last_Frame(650184,"BH_GATE_1.BH_GATE_1"); Commands->Static_Anim_Phys_Goto_Last_Frame(650183,"BH_GATE_1.BH_GATE_1"); Commands->Static_Anim_Phys_Goto_Last_Frame(650190,"BH_GATE_1.BH_GATE_1"); @@ -924,6 +1011,7 @@ if (gameTime == 875) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Shit! Looks like there has been a failure in the gate control mainframe, fall back and defend the President of Corporate America!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH23.mp3"); sprintf(currentSong,"SpecForce_Moments02.mp3"); Commands->Fade_Background_Music("SpecForce_Moments02.mp3",10000,10000); objective = 12697; @@ -939,7 +1027,10 @@ NewObjectiveSystemControl.Set_Objective_Status(13,NewObjectiveSystem::Failed); } if (gameTime == 835 && !JMG_Bear_Hunter_Game_Control::hasGotTurrets && NewObjectiveSystemControl.Get_Objective_Status(10) == NewObjectiveSystem::Pending) - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Our engineers report if the truck isn't back in the next 60 seconds they won't be able to get them set up!"); + { + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Our engineers report if the truck isn't back in the next minute they won't be able to get them set up!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH24.mp3"); + } if (gameTime == 775) { gameState = FallBack; @@ -950,10 +1041,12 @@ { truckTimeExtended = true; JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: We see the truck is getting close, the engineers are going to give you another 45 seconds! Everyone else fall back to base!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH25.mp3"); } else { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Forget about the turret parts there isn't enough time! Fall back to base!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH26.mp3"); if (NewObjectiveSystemControl.Get_Objective_Status(10) != NewObjectiveSystem::Accomplished) { NewObjectiveSystemControl.Remove_Objective(9); @@ -961,7 +1054,10 @@ } } else + { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Everyone fall back to base!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH27.mp3"); + } Commands->Enable_Spawner(600536,false); if (NewObjectiveSystemControl.Get_Objective_Status(14) == NewObjectiveSystem::Pending) NewObjectiveSystemControl.Remove_Objective(14); @@ -972,13 +1068,17 @@ { Vector3 truckPos; if (NewObjectiveSystemControl.Get_Objective_Status(10) == NewObjectiveSystem::Pending && NewObjectiveSystemControl.Get_Radar_Blip_Position(10,&truckPos) && JmgUtility::SimpleFlatDistance(JMG_Bear_Hunter_Game_Control::centerOfBase,truckPos) <= 10000) + { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: We're giving you another 15 seconds to get those turret parts inside DERP Industries beings your so close!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH28.mp3"); + } else { truckTimeExtended = false; if (NewObjectiveSystemControl.Get_Objective_Status(10) != NewObjectiveSystem::Accomplished) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: We need all the engineers back to work on the gates, there is no more time for the turret parts!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH29.mp3"); NewObjectiveSystemControl.Remove_Objective(9); NewObjectiveSystemControl.Remove_Objective(10); } @@ -990,22 +1090,26 @@ if (NewObjectiveSystemControl.Get_Objective_Status(10) != NewObjectiveSystem::Accomplished) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Forget the turret parts and fall back to base, there isn't any more time to set them up!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH30.mp3"); NewObjectiveSystemControl.Remove_Objective(9); NewObjectiveSystemControl.Remove_Objective(10); } } if (gameTime == 700) { - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: This could get pretty intense, if you have a chance try to head west, you will find a radio tower, if you can activate it we can call for backup."); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: This could get pretty intense, if you have a chance try to head West, you will find a radio tower, if you can activate it we can call for backup."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH31.mp3"); NewObjectiveSystemControl.Add_Objective(21,NewObjectiveSystem::Secondary,NewObjectiveSystem::Pending,12789,"",12789,Vector3(-512.0f,-270.705f,76.11f)); } if (gameTime == 624) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Watch your backs, there are mutant dogs out there now!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH32.mp3"); } if (gameTime == 400 && objective != 12698) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Mutant squirrels incoming, this is just getting to be too much, fall back and defend the President of Corporate America!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH33.mp3"); NewObjectiveSystemControl.Remove_Objective(5); JmgUtility::SetHUDHelpText(objective,Vector3(0,1,0)); objective = 12698; @@ -1018,6 +1122,7 @@ if (gameTime == 320) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Looks like cats are infected now too, I think I'll just be leaving..."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH34.mp3"); sprintf(currentSong,"304824_Goliath__Club_Remix_.mp3"); Commands->Fade_Background_Music("304824_Goliath__Club_Remix_.mp3",10000,10000); } @@ -1030,19 +1135,31 @@ if (gameTime == 240) { if (NewObjectiveSystemControl.Get_Objective_Status(21) == NewObjectiveSystem::Pending && NewObjectiveSystemControl.Get_Mission_Text_Id(21) != 12790) - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: The gate will be back on-line in the next 4 minutes, if you can get the signal sent within the next minute don't bother!"); + { + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: The gate will be back on-line in the next 4 minutes, if you can't get the signal sent within the next minute don't bother!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH35.mp3"); + } gameState = DefendPrez; } if (gameTime == 180) { if (NewObjectiveSystemControl.Get_Objective_Status(21) == NewObjectiveSystem::Pending && NewObjectiveSystemControl.Get_Mission_Text_Id(21) != 12790) { - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Forget about the communications tower, there isn't enough time anymore focus all resources on defending the president!"); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Forget about the communications tower, there isn't enough time anymore; focus all resources on defending the president!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH36.mp3"); NewObjectiveSystemControl.Remove_Objective(21); } } if (gameTime == 150) - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Oh god, is that a moose? What are they doing out here… Never mind, defend the President of Corperate America!"); + { + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Oh god, is that a moose? What are they doing out here... Never mind, defend the President of Corperate America!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH37.mp3"); + } + if (gameTime == 60) + { + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: And... Here comes the cougars... looks like everything is going straight for the President of Corperate America!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH38.mp3"); + } if ((gameTime == 600 || gameTime == 300) || (!(gameTime % 60) && gameTime > 0 && gameTime < 300)) { char timeMsg[220]; @@ -1064,6 +1181,7 @@ if (gameTime == 0) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Mainframe back on-line, gates are closing!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH39.mp3"); Commands->Static_Anim_Phys_Goto_Last_Frame(650185,"BH_GATE_1.BH_GATE_1"); Commands->Static_Anim_Phys_Goto_Last_Frame(650186,"BH_GATE_1.BH_GATE_1"); Commands->Static_Anim_Phys_Goto_Last_Frame(650187,"BH_GATE_1.BH_GATE_1"); @@ -1084,13 +1202,21 @@ int normalBears = (int)(!bearTransition ? maxTotalEnemies : (bearTransition == 100 ? 0 : maxTotalEnemies*(1-bearTransition/100.0f))); if ((int)(normalBears * 0.25f) > JMG_Bear_Hunter_AI_Avoid_Enemies::wildAnimalCount) { + bool deer = Commands->Get_Random(0.0f,1.0f) < 0.5f; Vector3 pos = BearHunterGameControlSystem.LookupNearestPosition(Vector2(Commands->Get_Random(-500.0f,500.0f),Commands->Get_Random(-350.0f,500.0f))); - GameObject *ai = Commands->Get_Random(0.0f,1.0f) < 0.5f ? Commands->Create_Object("Normal_Squirrel_Twiddler",pos) : Commands->Create_Object("Normal_Buck_Twiddler",pos); + GameObject *ai = deer ? Commands->Create_Object("Normal_Buck_Twiddler",pos) : Commands->Create_Object("Normal_Squirrel_Twiddler",pos); Commands->Set_Facing(ai,Commands->Get_Random(-180,180)); MoveablePhysClass *mphys = ai->As_PhysicalGameObj() ? ai->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : NULL; if (mphys) mphys->Find_Teleport_Location(pos,2.0f,&pos); - Attach_Script_Once(ai,"JMG_Bear_Hunter_AI_Avoid_Enemies",""); + Commands->Set_Position(ai,pos); + if (deer) + { + Attach_Script_Once(ai,"JMG_Utility_AI_Skittish_Herd_Animal","0,4,511,25.0,30.0,50.0,200.0,6.0,24.0,10.0,25.0,0.1,0.125"); + Commands->Set_Model(ai,Commands->Get_Random(0.0f,1.0f) < 0.25f ? "BUCK_" : "DOE_"); + } + else + Attach_Script_Once(ai,"JMG_Bear_Hunter_AI_Avoid_Enemies",""); Attach_Script_Once(ai,"JMG_Security_Camera_Behavior_Ignore",""); } if (!normalBears && JMG_Bear_Hunter_AI_Avoid_Enemies::wildAnimalCount) @@ -1114,6 +1240,7 @@ pos.Z += 0.1f; Commands->Set_Position(ai,pos); Commands->Set_Loiters_Allowed(ai,true); + ai->As_SoldierGameObj()->Set_Override_Muzzle_Direction(true); bearObjectListControl += ai; Attach_Script_Once(ai,"JMG_Rp2_Hostile_Mutant_AI",""); Attach_Script_Once(ai,"JMG_Bear_Hunter_Bear_Tracker",""); @@ -1142,6 +1269,7 @@ mphys->Find_Teleport_Location(playerPos,1.5f,&playerPos); Commands->Set_Position(tinyDeer,playerPos); } + tinyDeer->As_SoldierGameObj()->Set_Override_Muzzle_Direction(true); Commands->Attach_Script(tinyDeer,"JMG_Utility_AI_Goto_Player","-1.0,1.0,1.0,0.0,0,1.0,-1.0,0.0,0,1.0,-1,1.0,1,0,0.0"); Commands->Attach_Script(tinyDeer,"JMG_Bear_Hunter_Kill_Score_Tracker",""); JMG_Bear_Hunter_Golden_Deer_Statue::tinyDeerIds[x] = Commands->Get_ID(tinyDeer); @@ -1163,6 +1291,7 @@ { gameState = SecureBase; JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Kill all remaining mutants inside the walls!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH40.mp3"); objective = 12699; JmgUtility::SetHUDHelpText(objective,Vector3(0,1,0)); NewObjectiveSystemControl.Set_Objective_Status(6,NewObjectiveSystem::Accomplished); @@ -1193,6 +1322,7 @@ Commands->Start_Timer(obj,this,1.0f,5); Commands->Start_Timer(obj,this,1.0f,15); Commands->Start_Timer(obj,this,2.0f,15); + Commands->Start_Timer(obj,this,0.25f,19); } if (number == 5) { @@ -1204,11 +1334,14 @@ for (int x = 0;x < 128;x++) { GameObject *player = Get_GameObj(x); - if (JMG_Bear_Hunter_Game_Control::remainingLives[x] && (!player || Get_Player_Type(player) != -4)) + if (player && Commands->Get_Player_Type(player) == 1 && Commands->Get_Position(player).Z < 50.0f && _stricmp(Commands->Get_Preset_Name(player),"CNC_Spectator")) isOver = false; } if (isOver && gameState == JMG_Bear_Hunter_Game_Control::BossArrive) + { NewObjectiveSystemControl.Set_Objective_Status(12,NewObjectiveSystem::Failed); + playersDead = true; + } winWait++; if (winWait == 3) { @@ -1221,9 +1354,15 @@ if (!JMG_Bear_Hunter_Game_Control::hasBeenInjured) spawnKarma += 2; if (!JMG_Bear_Hunter_Game_Control::hasBeenInjured) + { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: I cannot believe it; the president did not even get hurt once, if I did not know better, I would think you were cheating!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH41.mp3"); + } else + { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Great work guys, I think thats all of them!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH42.mp3"); + } } if (winWait == 13) { @@ -1243,7 +1382,10 @@ else turretState = 2; if (turretState) + { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Just in time too, looks like the turret control computer was about to burn up. Shutting it down now..."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH43.mp3"); + } if (0.7f < (1.0f*NewObjectiveSystemControl.Get_Objective_Priority_Count(NewObjectiveSystem::Secondary,NewObjectiveSystem::Accomplished)+NewObjectiveSystemControl.Get_Objective_Priority_Count(NewObjectiveSystem::Tertiary,NewObjectiveSystem::Accomplished)+NewObjectiveSystemControl.Get_Objective_Priority_Count(NewObjectiveSystem::Quaternary,NewObjectiveSystem::Accomplished))/(1.0f*NewObjectiveSystemControl.Get_Objective_Priority_Count(NewObjectiveSystem::Secondary)+NewObjectiveSystemControl.Get_Objective_Priority_Count(NewObjectiveSystem::Tertiary)+NewObjectiveSystemControl.Get_Objective_Priority_Count(NewObjectiveSystem::Quaternary))) spawnKarma++; if (JMG_Bear_Hunter_Power_Transformer::online && !JMG_Bear_Hunter_Game_Control::turretsDestroyed) @@ -1307,11 +1449,20 @@ if (winWait == 23) { if (spawnKarma <= 1) + { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Haha, its a good thing this isn't a video game, otherwise I'd have expected some sort of super mutant boss."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH44.mp3"); + } else if (spawnKarma <= 3) + { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Haha, its a good thing this isn't a video game, otherwise I'd have expected some sort of super mutant boss, with maybe some support bosses because you did so well."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH45.mp3"); + } else + { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: However, it is a good thing you people are not cheaters, otherwise karma would try to find a way to balance the odds."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH46.mp3"); + } Commands->Set_Lightning(1.0f,0.0f,0.25f,0.0f,1.0f,20.0f); sprintf(currentSong,"304557_Goliath.mp3"); } @@ -1320,6 +1471,7 @@ if (winWait == 43) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Well, we should have seen this coming, hurry guys, kill it and we'll call it a day!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH47.mp3"); Commands->Create_Object("Mutant_Rabbit_Boss",Vector3(0.0f,0.0f,0.0f)); if (spawnKarma >= 2) for (int x = 0;x < spawnKarma;x++) @@ -1373,6 +1525,7 @@ if (CheckIfPlayerInRange(switchPos,22500)) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: By the way, there is an active security system in the complex, you might want to deactivate it before you take the truck."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH48.mp3"); NewObjectiveSystemControl.Add_Objective(14,NewObjectiveSystem::Quaternary,NewObjectiveSystem::Pending,12740,"",12740); return; } @@ -1463,6 +1616,7 @@ if (entineersReturned == 5) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Thats all of them, great work guys!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH49.mp3"); NewObjectiveSystemControl.Set_Objective_Status(15,NewObjectiveSystem::Accomplished); } else @@ -1472,12 +1626,14 @@ if (totalEngineers == 5) { sprintf(successMsg,"Bear Rug Co: Looks like we saved %d of the 5 engineers, it's good to see some of them back.",entineersReturned); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH50.mp3"); JmgUtility::MessageAllPlayers(127,127,255,successMsg); NewObjectiveSystemControl.Remove_Objective(15); } else { sprintf(successMsg,"Bear Rug Co: Good work bringing another engineer home, %d more to go.",5-totalEngineers); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH51.mp3"); JmgUtility::MessageAllPlayers(127,127,255,successMsg); unsigned int textId = (totalEngineers == 1) ? 12743 : (totalEngineers == 2) ? 12744 : (totalEngineers == 3) ? 12745 : 12746; NewObjectiveSystemControl.Set_Objective_Mission(15,textId,textId); @@ -1491,11 +1647,16 @@ lastUpdateEngineersDead = JMG_Bear_Hunter_Engineer_AI::engineersDead; switch (JMG_Bear_Hunter_Engineer_AI::engineersDead) { - case 1:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Looks like we lost an engineer.");break; - case 2:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Another engineer has died.");break; - case 3:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: We've lost another engineer! Be more careful, these people have families!");break; - case 4:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Four engineers dead, maybe you should just let the last one hide.");break; - case 5:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: We've lost all the engineers, I understand you guys didn't have training in fighting killer animals, but we still expected better.");break; + case 1:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Looks like we lost an engineer."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH52.mp3");break; + case 2:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Another engineer has died."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH53.mp3");break; + case 3:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: We've lost another engineer! Be more careful, these people have families!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH54.mp3");break; + case 4:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Four engineers dead, maybe you should just let the last one hide."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH55.mp3");break; + case 5:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: We've lost all the engineers, I understand you guys didn't have training in fighting killer animals, but we still expected better."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH56.mp3");break; } int totalEngineers = entineersReturned+JMG_Bear_Hunter_Engineer_AI::engineersDead; if (JMG_Bear_Hunter_Engineer_AI::engineersDead == 5) @@ -1504,6 +1665,7 @@ { char engineerMsg[220]; sprintf(engineerMsg,"Bear Rug Co: Looks like we saved %d of the 5 engineers, it's good to see some of them back.",entineersReturned); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH50.mp3"); JmgUtility::MessageAllPlayers(127,127,255,engineerMsg); NewObjectiveSystemControl.Remove_Objective(15); } @@ -1525,7 +1687,9 @@ if (JmgUtility::SimpleFlatDistance(Vector3(50.0f,-685.0f,0),Commands->Get_Position(player)) > 2500.0f) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: While you are hunting for bears keep an eye out for weapons containers, 6 of them have been misplaced and we will let you use the weapons if you bring them back to base."); - NewObjectiveSystemControl.Add_Objective(18,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12772,"",12772,1); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH57.mp3"); + IncreaseBonusObjectiveCount(18); + NewObjectiveSystemControl.Add_Objective(18,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12772,"",12772,bonusObjectiveCount); return; } } @@ -1640,6 +1804,7 @@ Vector3 createPosition = posNode->position; tinyDeer = Commands->Create_Object("Friendly_Tiny_Deer_Twiddler",createPosition); Commands->Set_Player_Type(tinyDeer,1); + tinyDeer->As_SoldierGameObj()->Set_Override_Muzzle_Direction(true); Commands->Attach_Script(tinyDeer,"JMG_Utility_AI_Goto_Enemy","75.0,1.5,1.0,0.0,1,1.5,-1.0,0.0,0,1.0,1,1.0,1,0,1,75.0"); Commands->Attach_Script(tinyDeer,"JMG_Bear_Hunter_Kill_Score_Tracker",""); MoveablePhysClass *mphys = tinyDeer->As_PhysicalGameObj() ? tinyDeer->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : NULL; @@ -1649,8 +1814,53 @@ JMG_Bear_Hunter_Game_Control::friendlyTinyDeerIds[x] = Commands->Get_ID(tinyDeer); JMG_Bear_Hunter_Game_Control::friendlyTinyDeerRespawnTime[x] = 40; } + if (gameTime && NewObjectiveSystemControl.Get_Objective_Status(25) == NewObjectiveSystem::Accomplished) + for (int x = 0;x < 8;x++) + { + if (wildMountainLionRespawn[x]) + wildMountainLionRespawn[x]--; + if (wildMountainLionIds[x] && !Commands->Find_Object(wildMountainLionIds[x])) + { + wildMountainLionIds[x] = 0; + wildMountainLionRespawn[x] = 40; + continue; + } + if (wildMountainLionRespawn[x] || wildMountainLionIds[x]) + continue; + Rp2SimplePositionSystem::SimplePositionNode *node = JMG_Wandering_AI_Controller::wanderPoints.GetRandomFromGroup(256); + if (!node) + continue; + GameObject *mlion = Commands->Create_Object("Normal_Mountain_Lion_Twiddler",node->position); + Vector3 pos = node->position; + MoveablePhysClass *mphys = mlion->As_PhysicalGameObj() ? mlion->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : NULL; + if (mphys) + mphys->Find_Teleport_Location(pos,2.0f,&pos); + Commands->Set_Position(mlion,pos); + mlion->As_SoldierGameObj()->Set_Override_Muzzle_Direction(true); + Commands->Set_Player_Type(mlion,1); + Commands->Attach_Script(mlion,"JMG_Bear_Hunter_Friendly_Cougar","1.0,10.0,1.0,1.5,3.0,0.0,3,6,5.0"); + wildMountainLionIds[x] = Commands->Get_ID(mlion); + } Commands->Start_Timer(obj,this,0.25f,18); } + if (number == 19) + { + Vector3 centerOfBase = Vector3(-0.532f,-705.389f,0.0f); + for (SLNode *current = GameObjManager::SmartGameObjList.Head();current;current = current->Next()) + { + SmartGameObj* o = current->Data(); + Vector3 objectPos = Commands->Get_Position(o); + if (!o || Commands->Get_Player_Type(o) != 1 || !Commands->Get_Health(o) || Get_Vehicle(o)) + continue; + float dist = JmgUtility::SimpleFlatDistance(objectPos,centerOfBase); + if ((dist > 27225.0f && objectPos.Z < 11.898f) || dist > 40000.0f) + { + bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(o))->DiedTryingToEscapeBase++; + Commands->Apply_Damage(o,1000.0f,"None",o); + } + } + Commands->Start_Timer(obj,this,0.25f,19); + } } void JMG_Bear_Hunter_Game_Control::Custom(GameObject *obj,int message,int param,GameObject *sender) { @@ -1710,6 +1920,13 @@ GameObject *deerStatue = Commands->Find_Object(JMG_Bear_Hunter_Golden_Deer_Statue::statueId); if (deerStatue) Commands->Destroy_Object(deerStatue); + if (NewObjectiveSystemControl.Get_Objective_Status(25) != NewObjectiveSystem::Failed && NewObjectiveSystemControl.Get_Objective_Status(25) != NewObjectiveSystem::Accomplished) + for (int x = 0;x < 8;x++) + { + GameObject *mlion = Commands->Find_Object(wildMountainLionIds[x]); + if (mlion) + Commands->Destroy_Object(mlion); + } GameObject *deerPlayer = Get_GameObj(JMG_Bear_Hunter_Golden_Deer_Statue::playerWithTheStatue); if (deerPlayer) { @@ -1721,10 +1938,91 @@ } if (NewObjectiveSystemControl.Get_Objective_Status(24) != NewObjectiveSystem::NotDefined && NewObjectiveSystemControl.Get_Objective_Status(24) != NewObjectiveSystem::Accomplished) { - JmgUtility::MessageAllPlayers(127,127,255,"San Casina Rug Co: The statue has vanished, forget about it."); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: The statue has vanished, forget about it."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH58.mp3"); NewObjectiveSystemControl.Set_Objective_Status(24,NewObjectiveSystem::Failed); } } + if (message == 268427) + { + if (param == 0) + { + if (NewObjectiveSystemControl.Get_Objective_Status(25) != NewObjectiveSystem::NotDefined) + return; + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Oh look, a pride of cougars... The boys bet that you guys can't pet them all, $50.00 per cat if you can!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH59.mp3"); + IncreaseBonusObjectiveCount(25); + NewObjectiveSystemControl.Add_Objective(25,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12832,"",12832,bonusObjectiveCount); + } + else if (param == 1) + { + for (int x = 0;x < 8;x++) + { + GameObject *mlion = Commands->Find_Object(wildMountainLionIds[x]); + if (!mlion) + continue; + Remove_All_Scripts(mlion); + Commands->Set_Player_Type(mlion,0); + Commands->Attach_Script(mlion,"JMG_Utility_AI_Goto_Player","-1.0,1.0,1.0,0.0,0,1.0,-1.0,0.0,1,1.0,256,1.0,1,0,1,0.0,0.0,0,0,0,0,0,0,0,0.66"); + } + if (NewObjectiveSystemControl.Get_Objective_Status(25) != NewObjectiveSystem::Pending) + { + bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(sender))->FailedPettingCougars++; + NewObjectiveSystemControl.Add_Objective(25,NewObjectiveSystem::Unknown,NewObjectiveSystem::Hidden,12832,"",12832,obj); + NewObjectiveSystemControl.Set_Objective_Status(25,NewObjectiveSystem::Failed); + return; + } + else if (NewObjectiveSystemControl.Get_Objective_Status(25) != NewObjectiveSystem::Failed) + { + bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(sender))->FailedPettingCougars++; + NewObjectiveSystemControl.Set_Objective_Status(25,NewObjectiveSystem::Failed); + } + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Looks like one died, now the bet is off!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH60.mp3"); + } + } + if (message == 2684270) + { + if (NewObjectiveSystemControl.Get_Objective_Status(25) != NewObjectiveSystem::Pending) + return; + int pokerId = JmgUtility::JMG_Get_Player_ID(sender); + BearHunterScoreSystem::BHScoreNode *node = bearHunterScoreSystem.Get_Current_Player_Score_Node(pokerId); + node->PettedCougars++; + node->tmpPettedCougars++; + wildMountainLionsPet++; + GameObject *mlion = Commands->Find_Object(wildMountainLionIds[param]); + if (mlion) + Commands->Set_Player_Type(mlion,-2); + if (wildMountainLionsPet == 8) + { + for (int x = 0;x < 8;x++) + { + GameObject *mlion = Commands->Find_Object(wildMountainLionIds[x]); + if (!mlion) + continue; + Remove_All_Scripts(mlion); + Commands->Set_Player_Type(mlion,1); + Commands->Attach_Script(mlion,"JMG_Bear_Hunter_Friendly_Cougar","1.0,10.0,1.0,1.5,3.0,0.0,3,6,5.0"); + } + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: I don't believe it! Those cougars look like they're your best friends now!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH61.mp3"); + NewObjectiveSystemControl.Set_Objective_Status(25,NewObjectiveSystem::Accomplished); + for (int x = 1;x < 128;x++) + { + GameObject *player = Get_GameObj(x); + if (!player) + continue; + BearHunterScoreSystem::BHScoreNode *node = bearHunterScoreSystem.Get_Current_Player_Score_Node(x); + if (node->tmpPettedCougars) + { + Commands->Give_Points(player,50.0f*node->tmpPettedCougars,false); + node->BonusObjectivesCompleted++; + } + } + } + else + NewObjectiveSystemControl.Set_Objective_Mission(25,wildMountainLionsPet+12832,wildMountainLionsPet+12832); + } } void JMG_Bear_Hunter_Game_Control::Destroyed(GameObject *obj) { @@ -1789,6 +2087,7 @@ } weaponsUnlocked[6] = false; aiPtLocations.Empty_List(); + bossSpawnProtectionPoints.Empty_List(); if (saveData) bearHunterScoreSystem.SaveData(); bearHunterScoreSystem.Cleanup(); @@ -1817,8 +2116,10 @@ preset = (Commands->Get_Random(0.0f,1.0f)<0.25) ? ((Commands->Get_Random(0.0,1.0f)<0.5f) ? (Commands->Get_Random(0.0f,1.0f) < 0.5f ? "Mutant_Squirrel_Twiddler" : "Mutant_Bear_Twiddler") : ((Commands->Get_Random(0.0,1.0f)<0.6) ? "Mutant_Cat" : "Mutant_Cat_Blue")) : ((Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Deer_Twiddler" : "Mutant_Dog_Twiddler"); else if (gameTime > 150)// nuke cats preset = (Commands->Get_Random(0.0f,1.0f)<0.25) ? ((Commands->Get_Random(0.0,1.0f)<0.5f) ? (Commands->Get_Random(0.0f,1.0f) < 0.5f ? "Mutant_Squirrel_Twiddler" : "Mutant_Bear_Twiddler") : ((Commands->Get_Random(0.0,1.0f)<0.6) ? "Mutant_Cat" : (Commands->Get_Random(0.0,1.0)<0.8) ? "Mutant_Cat_Blue" : "Mutant_Cat_Crazy")) : ((Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Deer_Twiddler" : "Mutant_Dog_Twiddler"); + else if (gameTime > 60) + preset = ((Commands->Get_Random(0.0,1.0f)<0.075f) ? "Mutant_Moose_Twiddler" : (Commands->Get_Random(0.0f,1.0f)<0.25) ? ((Commands->Get_Random(0.0,1.0f)<0.5f) ? (Commands->Get_Random(0.0f,1.0f) < 0.5f ? "Mutant_Squirrel_Twiddler" : "Mutant_Bear_Twiddler") : ((Commands->Get_Random(0.0,1.0f)<0.6) ? "Mutant_Cat" : (Commands->Get_Random(0.0,1.0)<0.8) ? "Mutant_Cat_Blue" : "Mutant_Cat_Crazy")) : ((Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Deer_Twiddler" : "Mutant_Dog_Twiddler")); else - preset = ((Commands->Get_Random(0.0,1.0f)<0.05f) ? "Mutant_Moose_Twiddler" : (Commands->Get_Random(0.0f,1.0f)<0.25) ? ((Commands->Get_Random(0.0,1.0f)<0.5f) ? (Commands->Get_Random(0.0f,1.0f) < 0.5f ? "Mutant_Squirrel_Twiddler" : "Mutant_Bear_Twiddler") : ((Commands->Get_Random(0.0,1.0f)<0.6) ? "Mutant_Cat" : (Commands->Get_Random(0.0,1.0)<0.8) ? "Mutant_Cat_Blue" : "Mutant_Cat_Crazy")) : ((Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Deer_Twiddler" : "Mutant_Dog_Twiddler")); + preset = ((Commands->Get_Random(0.0,1.0f)<0.15f) ? (Commands->Get_Random(0.0f,1.0f)<0.5 ? "Mutant_Moose_Twiddler" : "Mutant_Mountain_Lion_Twiddler") : (Commands->Get_Random(0.0f,1.0f)<0.25) ? ((Commands->Get_Random(0.0,1.0f)<0.5f) ? (Commands->Get_Random(0.0f,1.0f) < 0.25f ? "Mutant_Squirrel_Twiddler" : "Mutant_Bear_Twiddler") : ((Commands->Get_Random(0.0,1.0f)<0.6) ? "Mutant_Cat" : (Commands->Get_Random(0.0,1.0)<0.8) ? "Mutant_Cat_Blue" : "Mutant_Cat_Crazy")) : ((Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Deer_Twiddler" : "Mutant_Dog_Twiddler")); Vector3 pos = BearHunterGameControlSystem.LookupNearestPosition(Vector2(Commands->Get_Random(-500.0f,500.0f),Commands->Get_Random(JmgUtility::MathClamp(CreatePositionZ-250,-600,500),CreatePositionZ))); GameObject *ai = Commands->Create_Object(preset,pos); Commands->Set_Facing(ai,Commands->Get_Random(-180,180)); @@ -1834,12 +2135,18 @@ mutantObjectListControl += ai; char params[512]; sprintf(params,"%.2f",JmgUtility::MathClamp(JmgUtility::MathClamp(GamePercent*0.95f,0.35f,999.9f)+Commands->Get_Random(-0.1f,0.1f),0.35f,0.9f+Get_Player_Count()*0.0225f)); + ai->As_SoldierGameObj()->Set_Override_Muzzle_Direction(true); Attach_Script_Once(ai,"JMG_Bear_Hunt_Mutant_Attacker",params); Attach_Script_Once(ai,"JMG_Bear_Hunter_Mutant_Tracker",""); Attach_Script_Once(ai,"JMG_Bear_Hunter_Animal_Control",""); Attach_Script_Once(ai,"JMG_Bear_Hunter_Mutant_Respawn_Tracker",""); return ai; } +void JMG_Bear_Hunter_Game_Control::IncreaseBonusObjectiveCount(int objectiveId) +{ + if (NewObjectiveSystemControl.Get_Objective_Status(objectiveId) == NewObjectiveSystem::Undefined) + bonusObjectiveCount++; +} void JMG_Rp2_Hostile_Mutant_AI::Created(GameObject *obj) { damaged = false; @@ -2415,13 +2722,15 @@ if (!(PlayerData.players[playerId]->killsWithoutGettingHurt % 10)) { Commands->Give_Money(killer,50.0f,false); - JmgUtility::DisplayChatMessage(killer,11,194,255,"San Casina Rug Co: Congrats, here's your $50.00 for 10 in a row without being hurt!"); + JmgUtility::DisplayChatMessage(killer,11,194,255,"Bear Rug Co: Congrats, here's your $50.00 for 10 in a row without being hurt!"); + Create_2D_Wave_Sound_Dialog_Player(killer,"BH62.mp3"); } PlayerData.players[playerId]->totalKills++; if (!(PlayerData.players[playerId]->totalKills % 250)) { Commands->Give_Money(killer,1000.0f,false); - JmgUtility::DisplayChatMessage(killer,11,194,255,"San Casina Rug Co: $1,000.00 for the 250 pelts!"); + JmgUtility::DisplayChatMessage(killer,11,194,255,"Bear Rug Co: $1,000.00 for the 250 pelts!"); + Create_2D_Wave_Sound_Dialog_Player(killer,"BH63.mp3"); } if (Commands->Get_Random(0.0f,1.0f) < (1.0f-JMG_Bear_Hunter_Game_Control::gameTime/2000.0f)*0.25f) { @@ -2743,12 +3052,13 @@ playerScoreNode->ReturnedMedicalNeedle++; JmgUtility::DisplayChatMessage(poker,200,127,255,"President of Corporate America: Thanks!"); JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Good work, he'll feel better in no time!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH64.mp3"); for (int x = 1;x < 128;x++) { GameObject *player = Get_GameObj(x); if (!player) continue; - Commands->Give_Money(player,1000.0f,0); + Commands->Give_Money(player,100.0f,0); } const char *weap = Get_Current_Weapon(poker); if (weap && !_stricmp(weap,"Weapon_Needle")) @@ -2835,6 +3145,8 @@ Commands->Fade_Background_Music("Unreal2_awakening_Hell_Ending.mp3",1000,1000); for (int x = 0;x < 5;x++) Commands->Create_Sound("Mission_Failed",Commands->Get_Position(obj),obj); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: We lost the President of Corporate America, our company is screwed!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH96.mp3"); } void JMG_Bear_Hunter_President_Controller::damagedEvent(GameObject *obj,bool announce,bool palyinjured) { @@ -2990,6 +3302,7 @@ if (JMG_Bear_Hunter_Game_Control::gameTime && JMG_Bear_Hunter_Game_Control::gameTime <= 700 && JMG_Bear_Hunter_Game_Control::objective != 12698 && JMG_Bear_Hunter_Game_Control::turretsDestroyed >= 5) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: This is just getting to be too much, fall back and defend the President of Corporate America!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH65.mp3"); NewObjectiveSystemControl.Remove_Objective(5); JmgUtility::SetHUDHelpText(JMG_Bear_Hunter_Game_Control::objective,Vector3(0,1,0)); JMG_Bear_Hunter_Game_Control::objective = 12698; @@ -3000,6 +3313,7 @@ float compassDegree = atan2(turretPos.Y,turretPos.X)* (180.0f / PI); char turretMsg[220]; sprintf(turretMsg,"Bear Rug Co: The %s Cannon Emplacement was destroyed!",JmgUtility::JMG_Get_Compass_Directions(compassDegree)); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH66.mp3"); JmgUtility::MessageAllPlayers(127,127,255,turretMsg); } void JMG_Powerup_Grant_Cash::Custom(GameObject *obj,int message,int param,GameObject *sender) @@ -3061,15 +3375,15 @@ posNode = randomSelectableSpawnPoints[(PlayerData.players[JmgUtility::JMG_Get_Player_ID(obj)] && PlayerData.players[JmgUtility::JMG_Get_Player_ID(obj)]->deaths >= 5 && JMG_Bear_Hunter_Game_Control::spawnGroup == 1) ? 0 : JMG_Bear_Hunter_Game_Control::spawnGroup].GetRandomLowestValue(); else { - float ranges[7] = {2500.0f,625.0f,625.0f,625.0f,625.0f,625.0f,625.0f}; + float ranges[7] = {5625.0f,625.0f,625.0f,625.0f,625.0f,625.0f,625.0f}; float weight[7] = {1.0f,2.0f,2.0f,2.0f,2.0f,2.0f,2.0f}; Vector3 pos[7]; pos[0] = JMG_Bear_Hunt_Final_Boss::bossPos; for (int x = 0;x < 6;x++) pos[x+1] = Commands->Get_Position(Commands->Find_Object(JMG_Bear_Hunter_Game_Control::karmaDeerIds[x])); - posNode = randomSelectableSpawnPoints[JMG_Bear_Hunter_Game_Control::spawnGroup].GetSpotNotVisibileFromSpots(7,pos,ranges); + posNode = GetSpotNotVisibileFromSpots(7,pos,ranges); if (!posNode) - posNode = randomSelectableSpawnPoints[JMG_Bear_Hunter_Game_Control::spawnGroup].GetFurthestSpotFromSpots(7,pos,weight); + posNode = GetFurthestSpotFromSpots(7,pos,weight); } if (!posNode) { @@ -3082,6 +3396,9 @@ if (mphys) mphys->Find_Teleport_Location(pos,1.0f,&pos); Commands->Set_Position(obj,pos); + char params[220]; + sprintf(params,"0.1,%.2f",posNode->facing); + Commands->Attach_Script(obj,"JMG_Utility_Delay_Then_Rotate_Camera",params); } void JMG_Bear_Hunter_Player_Spawn::Timer_Expired(GameObject *obj,int number) { @@ -3090,6 +3407,99 @@ Created(obj); } } +Rp2SimplePositionSystem::SimplePositionNode *JMG_Bear_Hunter_Player_Spawn::GetSpotNotVisibileFromSpots(int points,Vector3 pos[],float ranges[]) +{ + for (int x = 0;x < points;x++) + pos[x].Z += 2; + Rp2SimplePositionSystem::SimplePositionNode *current = randomSelectableSpawnPoints[4].SimplePositionNodeList; + int random = Commands->Get_Random_Int(0,randomSelectableSpawnPoints[4].ObjectCount*2)+1; + int originalRandom = random; + while (current) + { + Vector3 targetpos = current->position; + targetpos.Z += 2.0f; + bool clear = true; + for (int x = 0;x < points;x++) + { + float dist = JmgUtility::SimpleDistance(pos[x],current->position); + if (dist < ranges[x]) + { + clear = false; + break; + } + if ((!x || dist <= 14400.0f) && !TestRay(pos[x],targetpos)) + { + clear = false; + break; + } + for (Rp2SimplePositionSystem::SimplePositionNode *currentSightNode = bossSpawnProtectionPoints.SimplePositionNodeList;currentSightNode;currentSightNode = currentSightNode->next) + { + if (currentSightNode->value != current->value) + continue; + if (!TestRay(pos[x],currentSightNode->position)) + { + clear = false; + break; + } + } + } + if (clear) + { + if (random) + random--; + if (!random) + return current; + } + current = current->next; + if (!current && originalRandom != random) + current = randomSelectableSpawnPoints[4].SimplePositionNodeList; + } + return NULL; +} +Rp2SimplePositionSystem::SimplePositionNode *JMG_Bear_Hunter_Player_Spawn::GetFurthestSpotFromSpots(int points,Vector3 pos[],float weight[]) +{ + float furthestDistance = 0; + Rp2SimplePositionSystem::SimplePositionNode *current = randomSelectableSpawnPoints[4].SimplePositionNodeList,*furthest = NULL; + while (current) + { + float tempBest = -1; + for (int x = 0;x < points;x++) + { + float tempDistance = JmgUtility::SimpleDistance(pos[x],current->position)*weight[x]; + if (tempBest == -1 || tempDistance < tempBest) + tempBest = tempDistance; + } + if (furthestDistance < tempBest) + { + furthest = current; + furthestDistance = tempBest; + } + current = current->next; + } + return furthest; +} +bool JMG_Bear_Hunter_Player_Spawn::TestRay(Vector3 pos,Vector3 targetPos) +{ + CastResultStruct res; + LineSegClass ray(pos,targetPos); + PhysRayCollisionTestClass coltest(ray,&res,SOLDIER_GHOST_COLLISION_GROUP); + PhysicsSceneClass::Get_Instance()->Cast_Ray(coltest,false); + return coltest.CollidedRenderObj != NULL; +} +void JMG_Bear_Hunter_Player_Vehicle::Created(GameObject *obj) +{ + lastDamaged = 0; + Commands->Start_Timer(obj,this,0.1f,1); +} +void JMG_Bear_Hunter_Player_Vehicle::Timer_Expired(GameObject *obj,int number) +{ + if (number == 1) + { + if (lastDamaged) + lastDamaged--; + Commands->Start_Timer(obj,this,0.1f,1); + } +} void JMG_Bear_Hunter_Player_Vehicle::Custom(GameObject *obj,int message,int param,GameObject *sender) { if (message == CUSTOM_EVENT_VEHICLE_EXITED) @@ -3102,6 +3512,11 @@ Commands->Set_Player_Type(obj,1); } } +void JMG_Bear_Hunter_Player_Vehicle::Damaged(GameObject *obj,GameObject *damager,float damage) +{ + if (damage > 0.0f) + lastDamaged = 150; +} void JMG_Bear_Hunter_Player_Vehicle::Killed(GameObject *obj,GameObject *killer) { bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(killer))->VehiclesDestroyed++; @@ -3164,16 +3579,21 @@ { NewObjectiveSystemControl.Set_Radar_Blip(10,obj); JmgUtility::DisplayChatMessage(sender,127,127,255,"Bear Rug Co: Get back in that truck, it must make it back to base!"); + Create_2D_Wave_Sound_Dialog_Player(sender,"BH67.mp3"); } if (message == CUSTOM_EVENT_VEHICLE_ENTERED && (JMG_Bear_Hunter_Game_Control::gameTime > 775 || JMG_Bear_Hunter_Game_Control::truckTimeExtended) && !JMG_Bear_Hunter_Game_Control::hasGotTurrets) { if (NewObjectiveSystemControl.Get_Objective_Status(14) == NewObjectiveSystem::Pending) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Looks like you forgot to deactivate the alarm, get out of there while you can, we're tracking lots of movement in the swamp!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH68.mp3"); NewObjectiveSystemControl.Set_Objective_Status(14,NewObjectiveSystem::Failed); } else + { JmgUtility::DisplayChatMessage(sender,127,127,255,"Bear Rug Co: Now all you have to do is return the truck to base."); + Create_2D_Wave_Sound_Dialog_Player(sender,"BH69.mp3"); + } if (firstTime) { firstTime = false; @@ -3194,7 +3614,10 @@ NewObjectiveSystemControl.Remove_Objective(9); NewObjectiveSystemControl.Remove_Objective(10); if (JMG_Bear_Hunter_Game_Control::gameTime > 775) + { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: The truck was lost, GMax will pull another one out of the storage area for you shortly."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH70.mp3"); + } } } void JMG_Bear_Hunter_Security_Turret_Truck_Zone::Entered(GameObject *obj,GameObject *enterer) @@ -3215,6 +3638,7 @@ if (JMG_Bear_Hunter_Game_Control::gameTime <= 775 && !JMG_Bear_Hunter_Game_Control::truckTimeExtended) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Thanks for the turret parts, its too late for us to set up the turrets, but here is your payment!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH71.mp3"); return; } GameObject *driver = Get_Vehicle_Driver(obj); @@ -3239,9 +3663,11 @@ Commands->Set_Facing(turret,90.0f); Commands->Attach_Script(turret,"JMG_AI_Ignore_Object",""); JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Thanks for the turret parts, we'll get these up right away, and here is your payment!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH72.mp3"); } void JMG_Bear_Hunt_Final_Boss::Created(GameObject *obj) { + targetIsMine = false; moveSpeed = 0.5; rabbitSize = 1.0f; bossPos = Commands->Get_Position(obj); @@ -3251,6 +3677,7 @@ JMG_Bear_Hunter_Game_Control::spawnGroup = 4; actionUpdate = 0; attackingPlayer = false; + enemyId = 0; Set_Skin(obj,"Blamo"); Commands->Set_Shield_Type(obj,"Blamo"); int finalMultiplier = JMG_Bear_Hunter_Game_Control::spawnKarma > 5 ? 2 : 1; @@ -3287,7 +3714,10 @@ Commands->Set_Animation(jump,"rabbitJump.rabbitJump",false,0,0.0f,90.0f,false); Commands->Attach_To_Object_Bone(obj,jump,"Bunny"); jumperId = Commands->Get_ID(jump); - obj->As_SoldierGameObj()->Set_Scale_Across_Network(1.5f); + SoldierGameObj *soldierGameObj = obj->As_SoldierGameObj(); + soldierGameObj->Set_Scale_Across_Network(1.5f); + soldierGameObj->Set_Override_Muzzle_Direction(true); + soldierGameObj->Set_Can_Play_Damage_Animations(false); Commands->Start_Timer(obj,this,3.0f,1); } void JMG_Bear_Hunt_Final_Boss::Enemy_Seen(GameObject *obj,GameObject *seen) @@ -3304,19 +3734,21 @@ return; if (JMG_Bear_Hunter_Game_Control::aiIgnorePlayers[JmgUtility::JMG_Get_Player_ID(seen)]) return; - enemyId = Commands->Get_ID(seen); - if (!JMG_Bear_Hunter_Game_Control::playersDead && enemyId == JMG_Bear_Hunter_Game_Control::mutantTargetId) - return; - if (Commands->Is_A_Star(seen)) - { + int seenId = Commands->Get_ID(seen); + if (seenId == JMG_Bear_Hunter_Game_Control::mutantTargetId) + return; + targetIsMine = false; + enemyId = seenId; + if (Commands->Is_A_Star(seen)) + { attackingPlayer = true;; targetUpdate = 40; - } - else - { + } + else + { attackingPlayer = false; targetUpdate = 0; - } + } } void JMG_Bear_Hunt_Final_Boss::Timer_Expired(GameObject *obj,int number) { @@ -3365,6 +3797,12 @@ return; Vector3 pos = Commands->Get_Position(obj); GameObject *target = enemyId ? Commands->Find_Object(enemyId) : NULL; + if (Get_C4_Attached(target) == obj) + { + enemyId = 0; + target = NULL; + } + MineHunt(obj,pos,target); ChooseTarget(obj,pos,target); if (targetUpdate) targetUpdate--; @@ -3398,7 +3836,7 @@ if (JmgUtility::SimpleDistance(Commands->Get_Position(o),bossPos) <= 4.0f) SnackTime(obj,o); } - Commands->Start_Timer(obj,this,0.25f,2); + Commands->Start_Timer(obj,this,0.1f,2); } } void JMG_Bear_Hunt_Final_Boss::Damaged(GameObject *obj,GameObject *damager,float damage) @@ -3432,23 +3870,25 @@ } lastHealth = Commands->Get_Health(obj); lastArmor = Commands->Get_Shield_Strength(obj); - if (damage <= 0 || !damager || obj == damager || (enemyId && targetUpdate) || enemyId == Commands->Get_ID(damager) || Commands->Get_Player_Type(damager) == Commands->Get_Player_Type(obj)) + int damagerId = Commands->Get_ID(damager); + if (damage <= 0 || !damager || obj == damager || (enemyId && targetUpdate) || enemyId == damagerId || Commands->Get_Player_Type(damager) == Commands->Get_Player_Type(obj)) return; if (JMG_Bear_Hunter_Game_Control::aiIgnorePlayers[JmgUtility::JMG_Get_Player_ID(damager)]) return; if (enemyId && JmgUtility::SimpleDistance(Commands->Get_Position(damager),Commands->Get_Position(obj)) > targetDistance) return; - enemyId = Commands->Get_ID(damager); - if (Commands->Is_A_Star(damager)) - { + targetIsMine = false; + enemyId = damagerId; + if (Commands->Is_A_Star(damager)) + { attackingPlayer = true; targetUpdate = 40; - } - else - { + } + else + { attackingPlayer = false; targetUpdate = 0; - } + } } void JMG_Bear_Hunt_Final_Boss::Action_Complete(GameObject *obj,int action_id,ActionCompleteReason reason) { @@ -3482,6 +3922,7 @@ sprintf(deathMsg,"A %s killed the giant Mutant Rabbit!",Get_Translated_Preset_Name(killer)); JmgUtility::MessageAllPlayers(255,255,0,deathMsg); JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: We did it, the President of Corporate America has been saved!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH73.mp3"); NewObjectiveSystemControl.Set_Objective_Status(8,NewObjectiveSystem::Accomplished); } void JMG_Bear_Hunt_Final_Boss::AttackTarget(GameObject *obj,GameObject *target,float distance) @@ -3489,11 +3930,11 @@ int tempId = Commands->Get_ID(target); if (targetedId == tempId && actionUpdate) return; - actionUpdate = 10; + actionUpdate = 40; Commands->Action_Reset(obj,10); targetedId = tempId; ActionParamsStruct params; - params.Set_Movement(target,moveSpeed,target->As_SoldierGameObj() ? 0.0f : 5.0f,false); + params.Set_Movement(target,moveSpeed,targetIsMine ? 5.0f : (target->As_SoldierGameObj() ? 0.0f : 5.0f),false); params.MovePathfind = true; Commands->Action_Goto(obj,params); if ((distance < 40000.0f && JMG_Bear_Hunter_Game_Control::mutantTargetId != targetedId) || distance < 625) @@ -3501,7 +3942,10 @@ else params.AttackForceFire = false; params.Set_Basic(this,100,10,AI_STATE_COMBAT); - params.Set_Attack(target,200.0f,0.0f,Get_Player_Count() <= 10 ? true : false); + if (JMG_Bear_Hunter_Game_Control::mutantTargetId == targetedId) + params.Set_Attack(Commands->Get_Bone_Position(target,"c pelvis"),200.0f,0.0f,Get_Player_Count() <= 10 ? true : false); + else + params.Set_Attack(target,200.0f,0.0f,Get_Player_Count() <= 10 ? true : false); Commands->Action_Attack(obj,params); } void JMG_Bear_Hunt_Final_Boss::Respawn(GameObject *obj) @@ -3534,6 +3978,7 @@ closestDist = tempDist; target = aiPlayer; enemyId = Commands->Get_ID(aiPlayer); + targetIsMine = false; attackingPlayer = true; } } @@ -3554,6 +3999,7 @@ closestDist = tempDist; target = player; enemyId = Commands->Get_ID(player); + targetIsMine = false; attackingPlayer = true; } } @@ -3611,6 +4057,35 @@ node->EatenByRabbit++; } } +void JMG_Bear_Hunt_Final_Boss::MineHunt(GameObject *obj,Vector3 myPos,GameObject *enemy) +{ + float nearest = 0.0f; + GameObject *c4 = NULL; + Vector3 headPos = Commands->Get_Bone_Position(obj,"c headt"); + for (SLNode *current = GameObjManager::C4GameObjList.Head();current;current = current->Next()) + { + GameObject *object = (SmartGameObj *)current->Data(); + if (Get_C4_Attached(object) == obj) + continue; + Vector3 targetPos = Commands->Get_Position(object); + float dist = JmgUtility::SimpleDistance(targetPos,myPos); + targetPos.Z += 0.1f; + CastResultStruct res; + LineSegClass ray(headPos,targetPos); + PhysRayCollisionTestClass coltest(ray,&res,SOLDIER_GHOST_COLLISION_GROUP); + PhysicsSceneClass::Get_Instance()->Cast_Ray(coltest,false); + if ((!c4 || dist < nearest) && coltest.CollidedRenderObj) + { + c4 = object; + nearest = dist; + } + } + if ((c4 && Commands->Get_ID(c4) != enemyId && nearest < JmgUtility::SimpleDistance(myPos,Commands->Get_Position(enemy))) || (!enemy && c4)) + { + targetIsMine = true; + enemyId = Commands->Get_ID(c4); + } +} void JMG_Bear_Hunter_Spectator::Created(GameObject *obj) { Commands->Set_Player_Type(obj,-4); @@ -3633,6 +4108,9 @@ if (mphys) mphys->Find_Teleport_Location(pos,1.0f,&pos); Commands->Set_Position(obj,pos); + char params[220]; + sprintf(params,"0.1,%.2f",posNode->facing); + Commands->Attach_Script(obj,"JMG_Utility_Delay_Then_Rotate_Camera",params); } void JMG_Bear_Hunter_Spectator::Destroyed(GameObject *obj) { @@ -3715,7 +4193,7 @@ SetAIState(obj,MoveToCabin,Vector3(),5.0f,0.85f,aiDefensePoints[1].GetRandom(0)); if (aiState == NoAction && !enemyId) ChooseAction(obj); - if ((aiState == AccessPT || aiState == PTReload) && JmgUtility::SimpleDistance(Commands->Get_Position(obj),targetDestination) <= requiredDestinationRange) + if ((aiState == AccessPT || aiState == PTReload) && JmgUtility::SimpleFlatDistance(Commands->Get_Position(obj),targetDestination) <= requiredDestinationRange) { if (aiState == PTReload) { @@ -4110,6 +4588,10 @@ Commands->Attach_Script(obj,"JMG_RP2_Set_Object_Team_On_Timer","14.3,68541,-3"); Commands->Attach_Script(obj,"JMG_RP2_Set_Physical_Collisions_On_Timer","17.5,68541,1 1 1"); CreateAObject(obj,NULL,"Daves Arrow","XG_HD_Harness","XG_HD_Harness.XG_HD_Harness",createLocation,origFacing,0,"none",437,1000); + createLocation.Z -= 1.25f; + GameObject *flare = Commands->Create_Object("Vehicle_Signal_Flare",createLocation); + flare->As_PhysicalGameObj()->Peek_Physical_Object()->Set_Collision_Group(Collision_Group_Type::TERRAIN_AND_BULLET_COLLISION_GROUP); + flareId = Commands->Get_ID(flare); Commands->Send_Custom_Event(obj,obj,92562142,0,15.0f); Commands->Send_Custom_Event(obj,obj,92562143,0,25.0f); } @@ -4148,6 +4630,9 @@ } if (message == 92562142) { + GameObject *flare = Commands->Find_Object(flareId); + if (flare) + Commands->Destroy_Object(flare); Commands->Enable_Collisions(obj); Commands->Set_Position(obj,origPos); GameObject *Zone = Commands->Find_Object(Get_Int_Parameter("DeathZoneID")); @@ -4763,7 +5248,10 @@ return; if (JMG_Bear_Hunter_Game_Control::aiIgnorePlayers[JmgUtility::JMG_Get_Player_ID(seen)]) return; - targetId = Commands->Get_ID(seen); + int seenId = Commands->Get_ID(seen); + if (seenId == JMG_Bear_Hunter_Game_Control::mutantTargetId) + return; + targetId = seenId; targetUpdate = 20; } void JMG_Bear_Hunter_Engineer_AI::Timer_Expired(GameObject *obj,int number) @@ -4952,6 +5440,8 @@ return false; if (target->As_SoldierGameObj() && Get_Hitpoints(target) > Get_Max_Hitpoints(target)*repairSoldierVehicleTurret.X) return false; + if (target->As_VehicleGameObj() && Get_Vehicle_Mode(target) != VEHICLE_TYPE_TURRET && !Get_Vehicle_Occupant_Count(target)) + return false; if (target->As_VehicleGameObj() && Get_Vehicle_Mode(target) != VEHICLE_TYPE_TURRET && Get_Hitpoints(target) > Get_Max_Hitpoints(target)*repairSoldierVehicleTurret.Y) return false; if (target->As_VehicleGameObj() && Get_Vehicle_Mode(target) == VEHICLE_TYPE_TURRET && (Get_Hitpoints(target) > Get_Max_Hitpoints(target)*repairSoldierVehicleTurret.Z || !JMG_Bear_Hunter_Power_Transformer::online)) @@ -5022,13 +5512,15 @@ oilRigCount++; if (oilRigCount == 7) { - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Thats all of them, great work guys!"); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: That's all of the pump jacks in the North East, great work guys!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH74.mp3"); NewObjectiveSystemControl.Set_Objective_Status(16,NewObjectiveSystem::Accomplished); } else { char successMsg[220]; sprintf(successMsg,"Bear Rug Co: Oil rig on-line, %d more to go.",7-oilRigCount); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH75.mp3"); JmgUtility::MessageAllPlayers(127,127,255,successMsg); unsigned int textId = (oilRigCount == 1) ? 12752 : (oilRigCount == 2) ? 12753 : (oilRigCount == 3) ? 12754 : (oilRigCount == 4) ? 12755 : 12756; NewObjectiveSystemControl.Set_Objective_Mission(16,textId,textId); @@ -5067,10 +5559,10 @@ char params[256]; sprintf(params,"%s,%.2f,%.2f,1",Get_Parameter("RepairAnimation"),Get_Float_Parameter("StartFrame"),Get_Float_Parameter("EndFrame")); Commands->Attach_Script(rig,"JMG_Bear_Hunter_Oil_Rig",params); + BearHunterScoreSystem::BHScoreNode *node = bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(obj)); if (NewObjectiveSystemControl.Set_Objective_Status(17,NewObjectiveSystem::Accomplished)) { Commands->Give_Points(damager,250.0f,false); - BearHunterScoreSystem::BHScoreNode *node = bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(obj)); node->BonusObjectivesCompleted++; node->totalObjectivesCompleted++; node->ObjectiveOilRigsRepaired++; @@ -5136,7 +5628,10 @@ if (JMG_Bear_Hunter_Game_Control::weaponsReturned[x]) count++; if (count == 1) - NewObjectiveSystemControl.Add_Objective(19,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12784,"",12784,2); + { + JMG_Bear_Hunter_Game_Control::IncreaseBonusObjectiveCount(19); + NewObjectiveSystemControl.Add_Objective(19,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12784,"",12784,JMG_Bear_Hunter_Game_Control::bonusObjectiveCount); + } else NewObjectiveSystemControl.Set_Objective_Mission(19,12785-count,12785-count); } @@ -5165,13 +5660,27 @@ JMG_Bear_Hunter_Game_Control::weaponsUnlocked[Get_Int_Parameter("WeaponType")] = true; switch (Get_Int_Parameter("WeaponType")) { - case 0:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Good work, all infantry classes now have a Twin Bow.");break; - case 1:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Great work, basic infantry now have a 10 gauge shotgun.");break; - case 2:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Due to your hard work, tier 1 infantry now have a FAMAS F1.");break; - case 3:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Excellent work, tier 2 infantry now have the PPSh-41!");break; - case 4:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Enjoy the AA12 with your tier 3 infantry!");break; - case 5:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Engineers can now use the Beretta 93R.");break; - case 6:JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Wow, looks like that bear had blueprints for a plasma rifle, all classes now have a plasma rifle!");break; + case 0: + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Good work, all infantry classes now have a Twin Bow."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH76.mp3");break; + case 1: + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Great work, basic infantry now have a 10 gauge shotgun."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH77.mp3");break; + case 2: + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Due to your hard work, tier 1 infantry now have a FAMAS F1."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH78.mp3");break; + case 3: + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Excellent work, tier 2 infantry now have the PPSh-41!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH79.mp3");break; + case 4: + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Enjoy the AA12 with your tier 3 infantry!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH80.mp3");break; + case 5: + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Engineers can now use the Beretta 93R."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH81.mp3");break; + case 6: + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Wow, looks like that deer had blueprints for a plasma rifle, all classes now have a plasma rifle!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH82.mp3");break; } if (Get_Int_Parameter("WeaponType") < 6) { @@ -5277,8 +5786,10 @@ } if (NewObjectiveSystemControl.Get_Objective_Status(20) == NewObjectiveSystem::NotDefined) { - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: That deer looks real exotic, kill it so we can stuff it and sell it for big bucks!!"); - NewObjectiveSystemControl.Add_Objective(20,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12786,"",12786,6); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: That deer looks real exotic, kill it so we can stuff it and sell it for big bucks!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH83.mp3"); + JMG_Bear_Hunter_Game_Control::IncreaseBonusObjectiveCount(20); + NewObjectiveSystemControl.Add_Objective(20,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12786,"",12786,JMG_Bear_Hunter_Game_Control::bonusObjectiveCount); } } void JMG_Bear_Hunter_Giant_Deer_Boss::Custom(GameObject *obj,int message,int param,GameObject *sender) @@ -5401,12 +5912,15 @@ if (NewObjectiveSystemControl.Get_Objective_Status(20) == NewObjectiveSystem::NotDefined) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: That deer looks real exotic, kill it so we can stuff it and sell it for big bucks!"); - NewObjectiveSystemControl.Add_Objective(20,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12786,"",12786,6); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH83.mp3"); + JMG_Bear_Hunter_Game_Control::IncreaseBonusObjectiveCount(20); + NewObjectiveSystemControl.Add_Objective(20,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12786,"",12786,JMG_Bear_Hunter_Game_Control::bonusObjectiveCount); } } void JMG_Bear_Hunter_Giant_Deer_Boss::Killed(GameObject *obj,GameObject *killer) { - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Good work killing that exotic deer, grab its carcass and return it to base and we’ll swap it out for a new weapon prototype we’re working on."); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Good work killing that exotic deer, grab its carcass and return it to base and we'll swap it out for a new weapon prototype we're working on."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH84.mp3"); NewObjectiveSystemControl.Set_Objective_Mission(20,12787,12787); Commands->Give_Points(killer,250.0f,false); Vector3 pos = Commands->Get_Position(obj); @@ -5478,6 +5992,8 @@ case 1000003566:case 1000003569:case 1000003571:node->WildDeerKilled++;break; case 1000003573:case 1000003575:case 1000003577:node->WildSquirrelsKilled++;break; case 1000003643:case 1000003647:case 1000003649:node->FriendlyTinyDeerKilled++;break; + case 1000000024:case 1000000026:case 1000000028:Commands->Get_Player_Type(obj) == 1 ? node->KilledFriendlyCougars++ : node->KilledCougars++;break; + case 1000000036:case 1000000038:case 1000000040:node->KilledMutantCougars++;break; default:node->KilledHumanAi++;break; } } @@ -5593,17 +6109,20 @@ if (NewObjectiveSystemControl.Get_Objective_Status(21) == NewObjectiveSystem::NotDefined) { JmgUtility::DisplayChatMessage(poker,127,127,255,"Bear Rug Co: We have the Communications Tower turned off right now because it was scaring off the wild life, leave it off!"); + Create_2D_Wave_Sound_Dialog_Player(poker,"BH85.mp3"); return; } if (NewObjectiveSystemControl.Get_Objective_Status(21) == NewObjectiveSystem::Removed) { JmgUtility::DisplayChatMessage(poker,127,127,255,"Bear Rug Co: Sorry, its too late to activate the tower now."); + Create_2D_Wave_Sound_Dialog_Player(poker,"BH86.mp3"); return; } Commands->Enable_HUD_Pokable_Indicator(obj,false); Commands->Give_Points(obj,250.0f,false); activated = true; JmgUtility::MessageAllPlayers(127,127,255,"Distress Signal Transmission In Progress: We are under attack by mutants on Bear Island and we need help!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH87.mp3"); NewObjectiveSystemControl.Set_Objective_Mission(21,12790,12790); Commands->Set_Animation(obj,"RdoTwrSwtch.RdoTwrSwtch",false,0,2.0f,2.0f,false); GameObject *radioTower = Commands->Find_Object(JMG_Bear_Hunter_Radio_Tower_Control::radioTowerId); @@ -5627,6 +6146,7 @@ if (NewObjectiveSystemControl.Get_Objective_Status(21) != NewObjectiveSystem::Accomplished) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: The communications tower was destroyed before anyone could answer our distress call!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH88.mp3"); NewObjectiveSystemControl.Set_Objective_Status(21,NewObjectiveSystem::Failed); } JMG_Bear_Hunter_Radio_Tower_Control::destroyed = true; @@ -5668,6 +6188,7 @@ Set_Screen_Fade_Color_Player(enterer,0.102f,0.086f,0.098f,0.0f); Set_Screen_Fade_Opacity_Player(enterer,0.9f,0.0f); JMG_Bear_Hunter_Game_Control::diedInWater[JmgUtility::JMG_Get_Player_ID(enterer)] = true; + Commands->Attach_Script(enterer,"JMG_Utility_Apply_Damage_While_In_Zone_Attached","0.1f,99999.0f,None,0"); } VehicleGameObj *vehicle = enterer->As_VehicleGameObj(); if (vehicle) @@ -6231,7 +6752,8 @@ { if (NewObjectiveSystemControl.Get_Objective_Status(22) == NewObjectiveSystem::NotDefined) { - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: President of Corporate America had some painkillers called in, they airdropped them outside of DERP, we'll pay everyone $1,000.00 if you can return it to the him."); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: The President of Corporate America had some painkillers called in, they airdropped them outside of DERP, we'll pay everyone $100.00 if you can return it to him."); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH89.mp3"); NewObjectiveSystemControl.Add_Objective(22,NewObjectiveSystem::Tertiary,NewObjectiveSystem::Pending,12795,"",12795,obj); } else @@ -6299,6 +6821,7 @@ if (Commands->Get_Shield_Strength(obj) < 490.0f) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: The power substation is under attack, defend it or else we'll lose power to the turrets!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH90.mp3"); NewObjectiveSystemControl.Add_Objective(23,NewObjectiveSystem::Secondary,NewObjectiveSystem::Pending,12798,"",12798,obj); objectiveActive = true; } @@ -6307,6 +6830,7 @@ else if (difftime(clock(),announceTime) > 10000.0f) { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: The power substation is still under attack!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH91.mp3"); announceTime = clock(); } if (JMG_Bear_Hunter_Power_Transformer::online && !Commands->Get_Shield_Strength(obj)) @@ -6318,6 +6842,7 @@ playerScoreNode->RepairedSubstation--; Commands->Set_Player_Type(obj,-2); JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: The power substation has been critically damaged, all turrets are down, get out there and repair it!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH92.mp3"); Commands->Create_Explosion("Explosion_IonCannonBeacon",Vector3(187.902f,-721.522f,1.852f),0); NewObjectiveSystemControl.Set_Objective_Mission(23,12799,12799); Commands->Set_Animation(obj,"transformer.transformer",false,0,1.0,1.0,true); @@ -6333,6 +6858,7 @@ playerScoreNode->RepairedSubstation++; Commands->Set_Player_Type(obj,1); JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: The power substation has been repaired, turrets back on-line, try to defend it this time!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH93.mp3"); NewObjectiveSystemControl.Set_Objective_Mission(23,12798,12798); Commands->Set_Animation(obj,"transformer.transformer",false,0,0,0,true); ToggleTurrets(true); @@ -6449,7 +6975,7 @@ return; if (Is_Script_Attached(seen,"JMG_AI_Ignore_Object")) return; - if (Commands->Is_A_Star(seen) && JMG_Wandering_AI_Controller::aiIgnorePlayers[JmgUtility::JMG_Get_Player_ID(seen)]) + if (Commands->Is_A_Star(seen) && JMG_Bear_Hunter_Game_Control::wanderingAiIgnorePlayers[JmgUtility::JMG_Get_Player_ID(seen)]) return; if (vehicleChaseTimeReset && (seen->As_VehicleGameObj() || Get_Vehicle(seen)) && JmgUtility::SimpleDistance(Commands->Get_Position(obj),Commands->Get_Position(seen)) > 225) return; @@ -6648,7 +7174,7 @@ return; if (!damaged && damage > 0) damaged = true; - if (Commands->Is_A_Star(damager) && JMG_Wandering_AI_Controller::aiIgnorePlayers[JmgUtility::JMG_Get_Player_ID(damager)]) + if (Commands->Is_A_Star(damager) && JMG_Bear_Hunter_Game_Control::wanderingAiIgnorePlayers[JmgUtility::JMG_Get_Player_ID(damager)]) return; if (Is_Script_Attached(damager,"JMG_AI_Ignore_Object")) return; @@ -6677,7 +7203,7 @@ GameObject *target = Commands->Find_Object(currentTargetID); int playerId = JmgUtility::JMG_Get_Player_ID(target); if (playerId && Commands->Get_Health(target)) - JMG_Wandering_AI_Controller::aiIgnorePlayers[playerId] = 30; + JMG_Bear_Hunter_Game_Control::wanderingAiIgnorePlayers[playerId] = 30; } } void JMG_Wandering_AI::SoundDHeard(GameObject *obj,const CombatSound &sound) @@ -6692,7 +7218,7 @@ bool Success = false;//(dist > 225 && Commands->Get_Random(0.00f,1.00f) > 0.015)fail if (dist < 144)// Sound is near, must investigate Success = true; - else if (sound.sound == 6 && dist < 250000 && Commands->Get_Random(0.00f,1.00f) < JMG_Wandering_AI_Controller::soundAttentionWhoreNotify)//player just wants to be noticed + else if (sound.sound == 6 && dist < 250000 && Commands->Get_Random(0.00f,1.00f) < JMG_Bear_Hunter_Game_Control::soundAttentionWhoreNotify)//player just wants to be noticed Success = true; else if (Commands->Get_Random(0.00f,1.00f) < 0.00025 && sound.sound != 5)// Bad Luck Success = true; @@ -6732,27 +7258,6 @@ } return node->position; } -void JMG_Wandering_AI_Controller::Created(GameObject *obj) -{ - for (int x = 0;x < 128;x++) - aiIgnorePlayers[x] = 0; - Commands->Start_Timer(obj,this,1.0f,1); -} -void JMG_Wandering_AI_Controller::Timer_Expired(GameObject *obj,int number) -{ - if (number == 1) - { - for (int x = 0;x < 128;x++) - { - if (aiIgnorePlayers[x] > 0) - aiIgnorePlayers[x]--; - GameObject *player = Get_GameObj(x); - if (player && !Is_Script_Attached(player,"JMG_Rp2_Dedicated_Server_Sound_Emulator")) - Commands->Attach_Script(player,"JMG_Rp2_Dedicated_Server_Sound_Emulator",""); - } - Commands->Start_Timer(obj,this,1.0f,1); - } -} void JMG_Wandering_AI_Controller::Destroyed(GameObject *obj) { JMG_Wandering_AI_Controller::setup = false; @@ -7412,9 +7917,14 @@ } void JMG_Bear_Hunter_Armored_Car::Created(GameObject *obj) { + GameObject *effect = Commands->Create_Object("Armored_Car_Effect",Commands->Get_Position(obj)); + Commands->Attach_To_Object_Bone(effect,obj,"origin"); + effectRangeId = Commands->Get_ID(effect); lightsOn = false; Commands->Set_Animation(obj,"ArmoredCar.ArmoredCar",false,0,0,0,true); Commands->Start_Timer(obj,this,0.1f,1); + Commands->Start_Timer(obj,this,1.0f,2); + Commands->Start_Timer(obj,this,0.1f,3); } void JMG_Bear_Hunter_Armored_Car::Timer_Expired(GameObject *obj,int number) { @@ -7428,15 +7938,202 @@ { Remove_Script(obj,"JMG_Bear_Hunter_AI_Ignore_Up_To_75_Meters"); Commands->Set_Animation(obj,"ArmoredCar.ArmoredCar",false,0,1,1,true); + GameObject *driver = Get_Vehicle_Driver(obj); + if (driver) + Set_Object_Visibility_For_Player(driver,effectRangeId,true); } else { Attach_Script_Once(obj,"JMG_Bear_Hunter_AI_Ignore_Up_To_75_Meters",""); Commands->Set_Animation(obj,"ArmoredCar.ArmoredCar",false,0,0,0,true); + GameObject *driver = Get_Vehicle_Driver(obj); + if (driver) + Set_Object_Visibility_For_Player(driver,effectRangeId,false); } } Commands->Start_Timer(obj,this,0.1f,1); } + if (number == 2) + { + GameObject *owner = Get_Vehicle_Owner(obj); + if (owner) + ownerNode = bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(owner)); + } + if (number == 3) + { + for (int x = 1;x < 128;x++) + { + GameObject *player = Get_GameObj(x); + if (player) + Set_Object_Visibility_For_Player(player,effectRangeId,false); + } + } +} +void JMG_Bear_Hunter_Armored_Car::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == CUSTOM_EVENT_VEHICLE_ENTERED) + { + GameObject *driver = Get_Vehicle_Driver(obj); + if (driver && sender == driver && lightsOn) + Set_Object_Visibility_For_Player(driver,effectRangeId,true); + } + if (message == CUSTOM_EVENT_VEHICLE_EXITED) + { + if (lightsOn) + Set_Object_Visibility_For_Player(sender,effectRangeId,false); + } +} +void JMG_Bear_Hunter_Armored_Car::Destroyed(GameObject *obj) +{ + GameObject *effect = Commands->Find_Object(effectRangeId); + if (effect) + Commands->Destroy_Object(effect); +} +void JMG_Bear_Hunter_Armored_Car_Controller::Created(GameObject *obj) +{ + Commands->Start_Timer(obj,this,0.1f,1); +} +void JMG_Bear_Hunter_Armored_Car_Controller::Timer_Expired(GameObject *obj,int number) +{ + if (number == 1 && !The_Game()->Is_Game_Over()) + { + for (SLNode *current = GameObjManager::SmartGameObjList.Head();current;current = current->Next()) + { + SmartGameObj *armoredCar = current->Data(); + if (!armoredCar || !Is_Script_Attached(armoredCar,"JMG_Bear_Hunter_Armored_Car")) + continue; + JMG_Bear_Hunter_Armored_Car *script = (JMG_Bear_Hunter_Armored_Car*)Find_Script_On_Object(armoredCar,"JMG_Bear_Hunter_Armored_Car"); + if (!script || !script->lightsOn) + continue; + ArmoredCarSupport(armoredCar,script->ownerNode); + } + Commands->Start_Timer(obj,this,0.1f,1); + } +} +void JMG_Bear_Hunter_Armored_Car_Controller::ArmoredCarSupport(GameObject *obj,BearHunterScoreSystem::BHScoreNode *ownerNode) +{ + Vector3 myPos = Commands->Get_Position(obj); + for (SLNode *current = GameObjManager::SmartGameObjList.Head();current;current = current->Next()) + { + SmartGameObj *o = current->Data(); + if (!o || Is_Script_Attached(o,"JMG_Bear_Hunter_Armored_Car") || Commands->Get_Player_Type(o) != 1) + continue; + if (JmgUtility::SimpleDistance(Commands->Get_Position(o),myPos) > 5625.0f) + continue; + if (o->As_SoldierGameObj()) + { + if (Get_Vehicle(o)) + continue; + JMG_Bear_Hunter_Player_Soldier *script = (JMG_Bear_Hunter_Player_Soldier*)Find_Script_On_Object(o,"JMG_Bear_Hunter_Player_Soldier"); + if (!script) + continue; + if (!script->lastDamaged) + RegenHp(o,ownerNode); + const char *weap = Get_Current_Weapon(o); + if (!weap || !_stricmp(weap,"Weapon_Binoculars") || !_stricmp(weap,"Weapon_Needle") || !_stricmp(weap,"Weapon_Golden_Deer_Statue") || !_stricmp(weap,"Weapon_Weapons_Container") || !_stricmp(weap,"Weapon_Sentry_Gun_Beacon")) + script->armoredCarWeapon.Reset(); + if (_stricmp(script->armoredCarWeapon.weaponName,weap)) + { + script->armoredCarWeapon.Reset(); + sprintf(script->armoredCarWeapon.weaponName,"%s",weap); + script->armoredCarWeapon.calculatedGrant = Get_Max_Total_Bullets(o,weap)/150.0; + } + int currentBullets = Get_Total_Bullets(o,weap); + int maxTotalBullets = Get_Max_Total_Bullets(o,weap); + if (currentBullets < script->armoredCarWeapon.lastammo) + script->armoredCarWeapon.Reset(); + if (!script->armoredCarWeapon.lastFireTime && currentBullets < maxTotalBullets) + { + script->armoredCarWeapon.addedGrant += script->armoredCarWeapon.calculatedGrant; + double ammoClips; + script->armoredCarWeapon.addedGrant = modf(script->armoredCarWeapon.addedGrant,&ammoClips); + int finalClips = (int)JmgUtility::MathClampDouble(ammoClips,0.0,(double)(maxTotalBullets-currentBullets)); + if (finalClips) + { + Set_Clip_Bullets(o,weap,Get_Clip_Bullets(o,weap)+finalClips); + if (ownerNode && !_stricmp(Get_Player_Name(o),ownerNode->PlayerName)) + bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(o))->SupportReceivedAmmoSelf += finalClips; + else + bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(o))->SupportReceivedAmmo += finalClips; + if (ownerNode) + { + ownerNode->SupportGrantedAmmo += finalClips; + GrantScore(ownerNode->PlayerName,(float)(finalClips*(1.0f/(float)maxTotalBullets))); + } + } + } + script->armoredCarWeapon.lastammo = Get_Total_Bullets(o,weap); + } + if (o->As_VehicleGameObj()) + { + JMG_Bear_Hunter_Player_Vehicle *script = (JMG_Bear_Hunter_Player_Vehicle*)Find_Script_On_Object(o,"JMG_Bear_Hunter_Player_Vehicle"); + if (!script || script->lastDamaged) + continue; + RegenHp(o,ownerNode); + } + } +} +void JMG_Bear_Hunter_Armored_Car_Controller::RegenHp(GameObject *obj,BearHunterScoreSystem::BHScoreNode *ownerNode) +{ + GameObject *owner = Get_Vehicle_Driver(obj); + if (!owner) + owner = obj; + float maxHealth = Commands->Get_Max_Health(obj); + float maxShield = Commands->Get_Max_Shield_Strength(obj); + if (Commands->Get_Health(obj) < maxHealth) + { + float grantHp = maxHealth/300.0f; + Commands->Set_Health(obj,Commands->Get_Health(obj)+grantHp); + if (Commands->Get_Health(obj) > maxHealth) + Commands->Set_Health(obj,maxHealth); + DecideScoreVehicleOrInfantry(obj,owner,ownerNode,grantHp); + } + else if (Commands->Get_Shield_Strength(obj) < maxShield) + { + float grantHp = maxShield/300.0f; + Commands->Set_Shield_Strength(obj,Commands->Get_Shield_Strength(obj)+grantHp); + if (Commands->Get_Shield_Strength(obj) > maxShield) + Commands->Set_Shield_Strength(obj,maxShield); + DecideScoreVehicleOrInfantry(obj,owner,ownerNode,grantHp); + } +} +void JMG_Bear_Hunter_Armored_Car_Controller::GrantScore(const char *playerName,float score) +{ + GameObject *player = Get_GameObj_By_Player_Name(playerName); + if (!player) + return; + Commands->Give_Points(player,score,false); +} +void JMG_Bear_Hunter_Armored_Car_Controller::DecideScoreVehicleOrInfantry(GameObject *obj,GameObject *owner,BearHunterScoreSystem::BHScoreNode *ownerNode,float grantHp) +{ + if (obj->As_SoldierGameObj()) + GrantInfantryRepairScore(obj,owner,ownerNode,grantHp); + if (obj->As_VehicleGameObj()) + GrantVehicleRepairScore(obj,owner,ownerNode,grantHp); +} +void JMG_Bear_Hunter_Armored_Car_Controller::GrantVehicleRepairScore(GameObject *obj,GameObject *owner,BearHunterScoreSystem::BHScoreNode *ownerNode,float grantHp) +{ + if (ownerNode && !_stricmp(Get_Player_Name(owner),ownerNode->PlayerName)) + bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(owner))->tmpSupportReceivedHpVehicleSelf += grantHp; + else + bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(owner))->tmpSupportReceivedVehicleHp += grantHp; + if (ownerNode) + { + GrantScore(ownerNode->PlayerName,grantHp*Get_Damage_Points(obj)*0.5f); + ownerNode->tmpSupportGrantedHpVehicle += grantHp; + } +} +void JMG_Bear_Hunter_Armored_Car_Controller::GrantInfantryRepairScore(GameObject *obj,GameObject *owner,BearHunterScoreSystem::BHScoreNode *ownerNode,float grantHp) +{ + if (ownerNode && !_stricmp(Get_Player_Name(owner),ownerNode->PlayerName)) + bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(owner))->tmpSupportReceivedHpInfantrySelf += grantHp; + else + bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(owner))->tmpSupportReceivedInfantryHp += grantHp; + if (ownerNode) + { + GrantScore(ownerNode->PlayerName,grantHp*Get_Damage_Points(obj)*0.5f); + ownerNode->tmpSupportGrantedHpInfantry += grantHp; + } } void JMG_Bear_Hunt_Final_Boss_Support::Created(GameObject *obj) {// You're doing to good if you see these guys @@ -7729,7 +8426,8 @@ { if (NewObjectiveSystemControl.Get_Objective_Status(24) == NewObjectiveSystem::NotDefined) { - JmgUtility::MessageAllPlayers(127,127,255,"San Casina Rug Co: Not only does that statue look valuable, but those little tiny deer seem to love it, bring it back to base!"); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Not only does that statue look valuable, but those little tiny deer seem to love it, bring it back to base!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH94.mp3"); NewObjectiveSystemControl.Add_Objective(24,NewObjectiveSystem::Tertiary,NewObjectiveSystem::Pending,12821,"",12821,JMG_Bear_Hunter_Game_Control::centerOfBase); } else @@ -7794,7 +8492,8 @@ { Remove_Weapon(obj,"Weapon_Golden_Deer_Statue"); JMG_Bear_Hunter_Golden_Deer_Statue::playerWithTheStatue = 0; - JmgUtility::MessageAllPlayers(127,127,255,"San Casina Rug Co: We've placed the deer statue on the power substation, tiny deer will now guard it with their lives!"); + JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: We've placed the deer statue on the power substation, those tiny deer will now guard it with their lives!"); + JmgUtility::Create_2D_Wave_Sound_Dialog("BH95.mp3"); bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(obj))->ReturnedDeerStatue++; Commands->Give_Money(obj,500.0f,false); NewObjectiveSystemControl.Set_Objective_Status(24,NewObjectiveSystem::Accomplished); @@ -7902,6 +8601,178 @@ void JMG_Security_Camera_Behavior_Ignore::Created(GameObject *obj) { } +void JMG_Bear_Hunter_Friendly_Cougar::Created(GameObject *obj) +{ + gotoId = 0; + LastSeen = 0; + currentTargetID = 0; + secondaryTargetId = 0; + lastSeenSecondary = 0; + huntorattack = 0; + waitcount = 0; + speed = 2.0f; + stuckTime = 0; + movingSlow = false; + lastPos = homelocation = Commands->Get_Position(obj); + noPathfindRange = Get_Float_Parameter("NoPathfindDistance")*Get_Float_Parameter("NoPathfindDistance"); + minVisibilityTime = Get_Int_Parameter("MinLooseVisibilityTime")*10; + maxVisibilityTime = Get_Int_Parameter("MaxLooseVisibilityTime")*10; + maxHuntDistance = Get_Float_Parameter("MaxHuntDistance")*Get_Float_Parameter("MaxHuntDistance"); + Commands->Enable_Enemy_Seen(obj,true); + Commands->Start_Timer(obj,this,0.1f,92562343); +} +void JMG_Bear_Hunter_Friendly_Cougar::Enemy_Seen(GameObject *obj,GameObject *seen) +{ + if (!Commands->Get_Health(seen)) + return; + if (Is_Script_Attached(seen,"JMG_Bear_Hunter_AI_Avoid_Enemies") || Is_Script_Attached(seen,"JMG_Utility_AI_Skittish_Herd_Animal")) + return; + int SeenID = Commands->Get_ID(seen); + if (!currentTargetID || !LastSeen) + { + gotoId = 0; + LastSeen = minVisibilityTime == maxVisibilityTime ? maxVisibilityTime : Commands->Get_Random_Int(minVisibilityTime,maxVisibilityTime); + huntorattack = 0; + currentTargetID = SeenID; + } + else if (currentTargetID == SeenID) + LastSeen = minVisibilityTime == maxVisibilityTime ? maxVisibilityTime : Commands->Get_Random_Int(minVisibilityTime,maxVisibilityTime); + else if (!secondaryTargetId || !lastSeenSecondary) + { + gotoId = 0; + lastSeenSecondary = maxVisibilityTime; + secondaryTargetId = SeenID; + } + else if (secondaryTargetId == SeenID) + lastSeenSecondary = maxVisibilityTime; +} +void JMG_Bear_Hunter_Friendly_Cougar::Timer_Expired(GameObject *obj,int number) +{ + if (92562343 == number) + { + if (LastSeen) + { + LastSeen--; + if (!LastSeen) + currentTargetID = 0; + } + if (lastSeenSecondary) + { + lastSeenSecondary--; + if (!lastSeenSecondary) + secondaryTargetId = 0; + } + if (gotoId) + { + if (!Commands->Find_Object(gotoId)) + gotoId = 0; + } + if (currentTargetID) + { + GameObject *target = Commands->Find_Object(currentTargetID); + GameObject *target2 = Commands->Find_Object(secondaryTargetId); + if (!target2 || Commands->Get_Health(target2) == 0.0f) + secondaryTargetId = 0; + if (!target || Commands->Get_Health(target) == 0.0f) + { + if (target2) + { + currentTargetID = secondaryTargetId; + LastSeen = maxVisibilityTime; + } + else + FollowPlayer(obj,false); + } + else if (Get_Float_Parameter("MaxHuntDistance") && JmgUtility::SimpleDistance(homelocation,Commands->Get_Position(target)) > maxHuntDistance) + { + currentTargetID = 0; + waitcount = 0; + if (huntorattack == 1) + Commands->Action_Reset(obj,10); + } + else + { + waitcount++; + if (waitcount > 2) + { + waitcount = 0; + ActionParamsStruct params; + params.Set_Movement(target,Get_Float_Parameter("ChaseSpeed"),Get_Float_Parameter("AttackArriveDistance"),false); + params.MovePathfind = JmgUtility::SimpleDistance(Commands->Get_Position(target),Commands->Get_Position(obj)) <= noPathfindRange ? false : true; + Commands->Action_Goto(obj,params); + params.Set_Basic(this,999,10); + params.Set_Attack(target,Get_Float_Parameter("StartAttackDistance"),1,true); + Commands->Action_Attack(obj,params); + } + } + } + if (!secondaryTargetId && !currentTargetID) + { + if (!gotoId) + FollowPlayer(obj,false); + else + { + GameObject *player = Commands->Find_Object(gotoId); + bool moveSlow = JmgUtility::SimpleDistance(Commands->Get_Position(obj),Commands->Get_Position(player)) < 625.0f; + if (moveSlow != movingSlow) + FollowPlayer(obj,moveSlow); + } + } + Commands->Start_Timer(obj,this,0.1f,92562343); + } +} +void JMG_Bear_Hunter_Friendly_Cougar::Damaged(GameObject *obj,GameObject *damager,float damage) +{ + if (!damager || Commands->Get_Player_Type(damager) != 1 || currentTargetID || Commands->Get_Player_Type(damager) == Commands->Get_Player_Type(obj)) + return; + if (!chooseTarget(obj,damager,¤tTargetID,&LastSeen)) + chooseTarget(obj,damager,&secondaryTargetId,&lastSeenSecondary); + else + { + huntorattack = 0; + waitcount = 0; + } +} +bool JMG_Bear_Hunter_Friendly_Cougar::chooseTarget(GameObject *obj,GameObject *damager,int *compareId,int *seenTimer) +{ + GameObject *target = Commands->Find_Object(*compareId); + if (target) + { + float targetDistance = JmgUtility::SimpleDistance(Commands->Get_Position(obj),Commands->Get_Position(target)); + float damagerDistance = JmgUtility::SimpleDistance(Commands->Get_Position(obj),Commands->Get_Position(damager)); + if (targetDistance < damagerDistance) + return false; + } + *seenTimer = minVisibilityTime == maxVisibilityTime ? maxVisibilityTime : Commands->Get_Random_Int(minVisibilityTime,maxVisibilityTime); + *compareId = Commands->Get_ID(damager); + return true; +} +void JMG_Bear_Hunter_Friendly_Cougar::FollowPlayer(GameObject *obj,bool moveSlow) +{ + waitcount = 0; + currentTargetID = 0; + Commands->Action_Reset(obj,10); + ActionParamsStruct params; + params.Set_Basic(this,999,10); + GameObject *player = JmgUtility::FindNearestPlayer(Commands->Get_Position(obj)); + movingSlow = moveSlow; + params.Set_Movement(player,movingSlow ? 0.15f : Get_Float_Parameter("ReturnHomeSpeed"),Get_Float_Parameter("ReturnHomeArriveDistance"),false); + params.MoveFollow = true; + Commands->Action_Goto(obj,params); + gotoId = Commands->Get_ID(player); +} +void JMG_Bear_Hunter_SpawnPoint_Final_Boss_Line_Of_Sight::Created(GameObject *obj) +{ + Rp2SimplePositionSystem::SimplePositionNode *node = new Rp2SimplePositionSystem::SimplePositionNode(obj,Get_Int_Parameter("Value")); + bossSpawnProtectionPoints += node; + Commands->Destroy_Object(obj); +} +void JMG_Bear_Hunter_SpawnPoint_Final_Boss::Created(GameObject *obj) +{ + Rp2SimplePositionSystem::SimplePositionNode *node = new Rp2SimplePositionSystem::SimplePositionNode(obj,Get_Int_Parameter("Value")); + randomSelectableSpawnPoints[4] += node; + Commands->Destroy_Object(obj); +} ScriptRegistrant JMG_Bear_Hunter_Player_Soldier_Registrant("JMG_Bear_Hunter_Player_Soldier",""); ScriptRegistrant JMG_Rp2_Dedicated_Server_Sound_Emulator_Registrant("JMG_Rp2_Dedicated_Server_Sound_Emulator",""); ScriptRegistrant JMG_Bear_Hunter_Game_Control_Registrant("JMG_Bear_Hunter_Game_Control","PositionFile=DhSwampDeerPositions.ecw:string"); @@ -7986,9 +8857,13 @@ ScriptRegistrant JMG_Bear_Hunter_Wolf_Registrant("JMG_Bear_Hunter_Wolf","WolfPackID:int,ControllerId:int"); ScriptRegistrant JMG_Bear_Hunter_Wolf_Wander_Point_Registrant("JMG_Bear_Hunter_Wolf_Wander_Point","WolfPackID:int"); ScriptRegistrant JMG_Bear_Hunter_Armored_Car_Registrant("JMG_Bear_Hunter_Armored_Car",""); +ScriptRegistrant JMG_Bear_Hunter_Armored_Car_Controller_Registrant("JMG_Bear_Hunter_Armored_Car_Controller",""); ScriptRegistrant JMG_Bear_Hunt_Final_Boss_Support_Registrant("JMG_Bear_Hunt_Final_Boss_Support",""); ScriptRegistrant JMG_Bear_Hunter_Golden_Deer_Statue_Registrant("JMG_Bear_Hunter_Golden_Deer_Statue",""); ScriptRegistrant JMG_Bear_Hunter_Golden_Deer_Statue_Standin_Registrant("JMG_Bear_Hunter_Golden_Deer_Statue_Standin",""); ScriptRegistrant JMG_Bear_Hunter_Golden_Deer_Statue_Attached_Registrant("JMG_Bear_Hunter_Golden_Deer_Statue_Attached",""); ScriptRegistrant JMG_Bear_Hunter_AI_Avoid_Enemies_Registrant("JMG_Bear_Hunter_AI_Avoid_Enemies",""); -ScriptRegistrant JMG_Security_Camera_Behavior_Ignore_Registrant("JMG_Security_Camera_Behavior_Ignore",""); \ No newline at end of file +ScriptRegistrant JMG_Security_Camera_Behavior_Ignore_Registrant("JMG_Security_Camera_Behavior_Ignore",""); +ScriptRegistrant JMG_Bear_Hunter_Friendly_Cougar_Registrant("JMG_Bear_Hunter_Friendly_Cougar","ReturnHomeSpeed=1.0:float,ReturnHomeArriveDistance=1.0:float,ChaseSpeed=1.0:float,AttackArriveDistance=0.0:float,StartAttackDistance=3.0:float,MaxHuntDistance=0.0:float,MinLooseVisibilityTime=3:int,MaxLooseVisibilityTime=6:int,NoPathfindDistance=5.0:float"); +ScriptRegistrant JMG_Bear_Hunter_SpawnPoint_Final_Boss_Line_Of_Sight_Registrant("JMG_Bear_Hunter_SpawnPoint_Final_Boss_Line_Of_Sight","Value:int"); +ScriptRegistrant JMG_Bear_Hunter_SpawnPoint_Final_Boss_Registrant("JMG_Bear_Hunter_SpawnPoint_Final_Boss","Value:int"); diff -ur sourceold/scripts/jmgBearHunter.h source/scripts/jmgBearHunter.h --- sourceold/scripts/jmgBearHunter.h 2019-06-22 07:43:44.238400000 +1000 +++ source/scripts/jmgBearHunter.h 2019-08-20 10:11:06.807000100 +1000 @@ -204,9 +204,7 @@ this->next = NULL; } }; -private: SimplePositionNode *SimplePositionNodeList; -public: int ObjectCount; Rp2SimplePositionSystem() { @@ -526,65 +524,6 @@ } return NULL; } - SimplePositionNode *GetSpotNotVisibileFromSpots(int points,Vector3 pos[],float ranges[]) - { - for (int x = 0;x < points;x++) - pos[x].Z += 2; - SimplePositionNode *current = SimplePositionNodeList; - int random = Commands->Get_Random_Int(0,ObjectCount*2)+1; - int originalRandom = random; - while (current) - { - Vector3 targetpos = current->position; - targetpos.Z += 2.0f; - CastResultStruct res; - bool clear = true; - for (int x = 0;x < points;x++) - { - LineSegClass ray(pos[x],targetpos); - PhysRayCollisionTestClass coltest(ray, &res, SOLDIER_GHOST_COLLISION_GROUP); - PhysicsSceneClass::Get_Instance()->Cast_Ray(coltest,false); - if (JmgUtility::SimpleDistance(pos[x],current->position) < ranges[x] || !coltest.CollidedRenderObj) - { - clear = false; - break; - } - } - if (clear) - { - if (random) - random--; - if (!random) - return current; - } - current = current->next; - if (!current && originalRandom != random) - current = SimplePositionNodeList; - } - return NULL; - } - SimplePositionNode *GetFurthestSpotFromSpots(int points,Vector3 pos[],float weight[]) - { - float furthestDistance = 0; - SimplePositionNode *current = SimplePositionNodeList,*furthest = NULL; - while (current) - { - float tempBest = -1; - for (int x = 0;x < points;x++) - { - float tempDistance = JmgUtility::SimpleDistance(pos[x],current->position)*weight[x]; - if (tempBest == -1 || tempDistance < tempBest) - tempBest = tempDistance; - } - if (furthestDistance < tempBest) - { - furthest = current; - furthestDistance = tempBest; - } - current = current->next; - } - return furthest; - } void DecreaseValue() { SimplePositionNode *Current = SimplePositionNodeList; @@ -601,6 +540,7 @@ Rp2SimplePositionSystem randomWeaponContainerSpawnPositions[6] = {Rp2SimplePositionSystem()}; Rp2SimplePositionSystem ComancheDefensePoints[6] = {Rp2SimplePositionSystem()}; Rp2SimplePositionSystem aiPtLocations = Rp2SimplePositionSystem(); +Rp2SimplePositionSystem bossSpawnProtectionPoints = Rp2SimplePositionSystem(); class Rp2SimpleObjectList { public: @@ -879,13 +819,38 @@ bool LifeSystem(GameObject *obj); void GrantUnlockedWeapons(GameObject *obj); public: + struct ArmoredCarWeapon + { + char weaponName[256]; + int lastFireTime; + int lastammo; + double calculatedGrant; + double addedGrant; + ArmoredCarWeapon() + { + sprintf(this->weaponName,""); + this->lastFireTime = 0; + this->lastammo = 0; + this->calculatedGrant = 0.0; + this->addedGrant = 0.0; + } + void Reset() + { + this->addedGrant = 0.0; + this->lastFireTime = 75; + } + }; JMG_Bear_Hunter_Player_Soldier() { playerId = 0; + lastDamaged = 0; + armoredCarWeapon = ArmoredCarWeapon(); } static double speed[128]; static char primaryWeapon[128][256]; static bool hasGrenadeVest[128]; + int lastDamaged; + ArmoredCarWeapon armoredCarWeapon; }; double JMG_Bear_Hunter_Player_Soldier::speed[128] = {0.0}; char JMG_Bear_Hunter_Player_Soldier::primaryWeapon[128][256] = {""}; @@ -1261,6 +1226,9 @@ bool engineerSpawnedOnce[5]; int engineerScanTime; int lastUpdateEngineersDead; + int wildMountainLionIds[8]; + int wildMountainLionRespawn[8]; + int wildMountainLionsPet; void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); void Custom(GameObject *obj,int message,int param,GameObject *sender); @@ -1310,6 +1278,9 @@ static int karmaDeerIds[6]; static int friendlyTinyDeerIds[5]; static int friendlyTinyDeerRespawnTime[5]; + static int wanderingAiIgnorePlayers[128]; + static void IncreaseBonusObjectiveCount(int objectiveId); + static int bonusObjectiveCount; }; GameObject *JMG_Bear_Hunter_Game_Control::myObject = NULL; int JMG_Bear_Hunter_Game_Control::mutantTargetId = 600172; @@ -1351,11 +1322,13 @@ int JMG_Bear_Hunter_Game_Control::karmaDeerIds[6] = {0}; int JMG_Bear_Hunter_Game_Control::friendlyTinyDeerIds[5] = {0}; int JMG_Bear_Hunter_Game_Control::friendlyTinyDeerRespawnTime[5] = {0}; +int JMG_Bear_Hunter_Game_Control::wanderingAiIgnorePlayers[128] = {0}; +int JMG_Bear_Hunter_Game_Control::bonusObjectiveCount = 0; struct BearHunterScoreSystem { public: - #define BHHighScoreListCount 96 + #define BHHighScoreListCount 111 struct BHScoreNode { char PlayerName[256]; @@ -1455,6 +1428,22 @@ unsigned long TimeInGatlingTanks; unsigned long TimeInIFVs; unsigned long FriendlyTinyDeerKilled; + unsigned long SupportReceivedInfantryHp; + unsigned long SupportReceivedVehicleHp; + unsigned long SupportReceivedAmmo; + unsigned long SupportGrantedHpInfantry; + unsigned long SupportGrantedHpVehicle; + unsigned long SupportGrantedAmmo; + unsigned long SupportReceivedHpInfantrySelf; + unsigned long SupportReceivedHpVehicleSelf; + unsigned long SupportReceivedAmmoSelf; + unsigned long PettedCougars; + unsigned long KilledCougars; + unsigned long KilledMutantCougars; + unsigned long FailedPettingCougars; + unsigned long KilledFriendlyCougars; + unsigned long DiedTryingToEscapeBase; + JmgUtility::GenericDateTime LastPlayTime; bool startedRound; unsigned long totalObjectivesCompleted; @@ -1464,6 +1453,14 @@ bool isMoving; bool isTurning; unsigned int idleDelay; + unsigned long tmpPlayTime; + float tmpSupportReceivedInfantryHp; + float tmpSupportReceivedVehicleHp; + float tmpSupportGrantedHpInfantry; + float tmpSupportGrantedHpVehicle; + float tmpSupportReceivedHpInfantrySelf; + float tmpSupportReceivedHpVehicleSelf; + int tmpPettedCougars; BHScoreNode *next; BHScoreNode(const char *PlayerName) { @@ -1564,6 +1561,22 @@ TimeInGatlingTanks = 0; TimeInIFVs = 0; FriendlyTinyDeerKilled = 0; + SupportReceivedInfantryHp = 0; + SupportReceivedVehicleHp = 0; + SupportReceivedAmmo = 0; + SupportGrantedHpInfantry = 0; + SupportGrantedHpVehicle = 0; + SupportGrantedAmmo = 0; + SupportReceivedHpInfantrySelf = 0; + SupportReceivedHpVehicleSelf = 0; + SupportReceivedAmmoSelf = 0; + PettedCougars = 0; + KilledCougars = 0; + KilledMutantCougars = 0; + FailedPettingCougars = 0; + KilledFriendlyCougars = 0; + DiedTryingToEscapeBase = 0; + JmgUtility::GenericDateTime LastPlayTime = JmgUtility::GenericDateTime(); startedRound = JMG_Bear_Hunter_Game_Control::gameState >= JMG_Bear_Hunter_Game_Control::HuntBears ? true : false; totalObjectivesCompleted = 0; @@ -1571,8 +1584,16 @@ lastFacing = 0; lastPos = Vector3(0.0f,0.0f,0.0f); idleDelay = 0; + tmpPlayTime = 0; isMoving = false; isTurning = false; + tmpSupportReceivedInfantryHp = 0.0f; + tmpSupportReceivedVehicleHp = 0.0f; + tmpSupportGrantedHpInfantry = 0.0f; + tmpSupportGrantedHpVehicle = 0.0f; + tmpSupportReceivedHpInfantrySelf = 0.0f; + tmpSupportReceivedHpVehicleSelf = 0.0f; + tmpPettedCougars = 0; next = NULL; } }; @@ -1673,12 +1694,21 @@ BHScoreNode *Current = BHScoreNodeList; while (Current) { - if (JMG_Bear_Hunter_Game_Control::spawnKarma > 3) - Current->CheatedRounds++; - if (!JMG_Bear_Hunter_Game_Control::hasBeenInjured) - Current->NeverInjured++; + if (Current->tmpPlayTime >= 60) + { + if (JMG_Bear_Hunter_Game_Control::spawnKarma > 3) + Current->CheatedRounds++; + if (!JMG_Bear_Hunter_Game_Control::hasBeenInjured) + Current->NeverInjured++; + } + Current->SupportReceivedInfantryHp += (unsigned long)Current->tmpSupportReceivedInfantryHp; + Current->SupportReceivedVehicleHp += (unsigned long)Current->tmpSupportReceivedVehicleHp; + Current->SupportGrantedHpInfantry += (unsigned long)Current->tmpSupportGrantedHpInfantry; + Current->SupportGrantedHpVehicle += (unsigned long)Current->tmpSupportGrantedHpVehicle; + Current->SupportReceivedHpInfantrySelf += (unsigned long)Current->tmpSupportReceivedHpInfantrySelf; + Current->SupportReceivedHpVehicleSelf += (unsigned long)Current->tmpSupportReceivedHpVehicleSelf; char EncryptString[2048]; - sprintf(EncryptString,"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu 0",Current->PlayTime,Current->PreGameTime,Current->IdleTime,Current->RoundsPlayed,Current->RoundsCompleted,Current->RoundsQuit,Current->RoundsWon,Current->RoundsLost,Current->MostKillsInARound,Current->MostDeathsInARound,Current->MostBonusObjectivesCompletedInARound,Current->Deaths,Current->Kills,Current->VehicleKills,Current->KilledSelf,Current->KilledPlayers,Current->KilledPresident,Current->KilledTurrets,Current->KilledBears,Current->KilledBlackBears,Current->KilledMutantBears,Current->KilledMutantDeer,Current->KilledMutantCats,Current->KilledMutantCatsB,Current->KilledMutantCatsR,Current->KilledMutantRabbits,Current->ObjectiveActivatedAlarm,Current->ObjectiveTurretTruck,Current->ObjectiveTurretTruckAlarm,Current->ObjectiveOilRigsActivated,Current->ObjectiveOilRigsRepaired,Current->ObjectiveEngineersSaved,Current->ObjectiveWeaponsFound,Current->ObjectiveWeaponsReturned,Current->ObjectivePlasmaRifleReturned,Current->BonusObjectivesCompleted,Current->PickedupHealthPowerups,Current->PickedupArmorPowerups,Current->PickedupCashPowerups,Current->PickedupAmmoPowerups,Current->PickedupHealthTotal,Current->PickedupArmorTotal,Current->PickedupCashTotal,Current->PickedupAmmoTotal,Current->PickedupTotalPowerups,Current->PickedupTotalPowerupsInARound,Current->KilledHumanAi,Current->VehiclesDestroyed,Current->VehiclesLost,Current->JazzsLost,Current->CleasansLost,Current->TrucksLost,Current->TanksLost,Current->TurretTruckLost,Current->C4VestPowerups,Current->ActivatedCommTower,Current->PlayedGamesWithDefenseTurrets,Current->PlayedGamesWithGuardianHelicopter,Current->TimesDrown,Current->TimesFallen,Current->KillsWithSentryTurret,Current->KilledSentryTurrets,Current->SentryTurretsPlaced,Current->SentryTurretsLost,Current->PickedUpMedicalNeedle,Current->ReturnedMedicalNeedle,Current->RepairedSubstation,Current->SubstationOnLineAtEnd,Current->SubstationNotDamaged,Current->GiantDeerKilled,Current->SurvivedAlarm,Current->WolfKilled,Current->MutantDogKilled,Current->BlueDeerKilled,Current->CheatedRounds,Current->NeverInjured,Current->MooseKilled,Current->MooseKilled,Current->EatenByRabbit,Current->EatenByRabbit,Current->PickedUpDeerStatue,Current->DroppedDeerStatue,Current->ReturnedDeerStatue,Current->TinyDeerKilled,Current->MutantSquirrelsKilled,Current->WildDeerKilled,Current->WildSquirrelsKilled,Current->ArmoredCarsLost,Current->WarriorsLost,Current->TimeOnFoot,Current->TimeInAJazzs,Current->TimeInACleasans,Current->TimeInASecurityTruck,Current->TimeInArmoredCars,Current->TimeInAUDVs,Current->TimeInGatlingTanks,Current->TimeInIFVs,Current->FriendlyTinyDeerKilled); + sprintf(EncryptString,"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu 0",Current->PlayTime,Current->PreGameTime,Current->IdleTime,Current->RoundsPlayed,Current->RoundsCompleted,Current->RoundsQuit,Current->RoundsWon,Current->RoundsLost,Current->MostKillsInARound,Current->MostDeathsInARound,Current->MostBonusObjectivesCompletedInARound,Current->Deaths,Current->Kills,Current->VehicleKills,Current->KilledSelf,Current->KilledPlayers,Current->KilledPresident,Current->KilledTurrets,Current->KilledBears,Current->KilledBlackBears,Current->KilledMutantBears,Current->KilledMutantDeer,Current->KilledMutantCats,Current->KilledMutantCatsB,Current->KilledMutantCatsR,Current->KilledMutantRabbits,Current->ObjectiveActivatedAlarm,Current->ObjectiveTurretTruck,Current->ObjectiveTurretTruckAlarm,Current->ObjectiveOilRigsActivated,Current->ObjectiveOilRigsRepaired,Current->ObjectiveEngineersSaved,Current->ObjectiveWeaponsFound,Current->ObjectiveWeaponsReturned,Current->ObjectivePlasmaRifleReturned,Current->BonusObjectivesCompleted,Current->PickedupHealthPowerups,Current->PickedupArmorPowerups,Current->PickedupCashPowerups,Current->PickedupAmmoPowerups,Current->PickedupHealthTotal,Current->PickedupArmorTotal,Current->PickedupCashTotal,Current->PickedupAmmoTotal,Current->PickedupTotalPowerups,Current->PickedupTotalPowerupsInARound,Current->KilledHumanAi,Current->VehiclesDestroyed,Current->VehiclesLost,Current->JazzsLost,Current->CleasansLost,Current->TrucksLost,Current->TanksLost,Current->TurretTruckLost,Current->C4VestPowerups,Current->ActivatedCommTower,Current->PlayedGamesWithDefenseTurrets,Current->PlayedGamesWithGuardianHelicopter,Current->TimesDrown,Current->TimesFallen,Current->KillsWithSentryTurret,Current->KilledSentryTurrets,Current->SentryTurretsPlaced,Current->SentryTurretsLost,Current->PickedUpMedicalNeedle,Current->ReturnedMedicalNeedle,Current->RepairedSubstation,Current->SubstationOnLineAtEnd,Current->SubstationNotDamaged,Current->GiantDeerKilled,Current->SurvivedAlarm,Current->WolfKilled,Current->MutantDogKilled,Current->BlueDeerKilled,Current->CheatedRounds,Current->NeverInjured,Current->MooseKilled,Current->MooseKilled,Current->EatenByRabbit,Current->EatenByRabbit,Current->PickedUpDeerStatue,Current->DroppedDeerStatue,Current->ReturnedDeerStatue,Current->TinyDeerKilled,Current->MutantSquirrelsKilled,Current->WildDeerKilled,Current->WildSquirrelsKilled,Current->ArmoredCarsLost,Current->WarriorsLost,Current->TimeOnFoot,Current->TimeInAJazzs,Current->TimeInACleasans,Current->TimeInASecurityTruck,Current->TimeInArmoredCars,Current->TimeInAUDVs,Current->TimeInGatlingTanks,Current->TimeInIFVs,Current->FriendlyTinyDeerKilled,Current->LastPlayTime.day,Current->LastPlayTime.month,Current->LastPlayTime.year,Current->LastPlayTime.second,Current->LastPlayTime.minute,Current->LastPlayTime.hour,Current->LastPlayTime.lTime,Current->SupportReceivedInfantryHp,Current->SupportReceivedVehicleHp,Current->SupportReceivedAmmo,Current->SupportGrantedHpInfantry,Current->SupportGrantedHpVehicle,Current->SupportGrantedAmmo,Current->SupportReceivedHpInfantrySelf,Current->SupportReceivedHpVehicleSelf,Current->SupportReceivedAmmoSelf,Current->PettedCougars,Current->KilledCougars,Current->KilledMutantCougars,Current->FailedPettingCougars,Current->KilledFriendlyCougars,Current->DiedTryingToEscapeBase); fprintf(SaveScores2,"%s\n%s\n",Current->PlayerName,EncryptString); fprintf(SaveScores,"%s\n%s",JmgUtility::Rp2Encrypt(Current->PlayerName,25,5),JmgUtility::Rp2Encrypt2(EncryptString,Current->PlayerName[0],Current->PlayerName[1])); fprintf(SaveScores,"\n%s",JmgUtility::Rp2Encrypt(EncryptString,Current->PlayerName[1],Current->PlayerName[0])); @@ -1730,7 +1760,7 @@ break; } if (match) - sscanf(decryptedString,"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",&Current->PlayTime,&Current->PreGameTime,&Current->IdleTime,&Current->RoundsPlayed,&Current->RoundsCompleted,&Current->RoundsQuit,&Current->RoundsWon,&Current->RoundsLost,&Current->MostKillsInARound,&Current->MostDeathsInARound,&Current->MostBonusObjectivesCompletedInARound,&Current->Deaths,&Current->Kills,&Current->VehicleKills,&Current->KilledSelf,&Current->KilledPlayers,&Current->KilledPresident,&Current->KilledTurrets,&Current->KilledBears,&Current->KilledBlackBears,&Current->KilledMutantBears,&Current->KilledMutantDeer,&Current->KilledMutantCats,&Current->KilledMutantCatsB,&Current->KilledMutantCatsR,&Current->KilledMutantRabbits,&Current->ObjectiveActivatedAlarm,&Current->ObjectiveTurretTruck,&Current->ObjectiveTurretTruckAlarm,&Current->ObjectiveOilRigsActivated,&Current->ObjectiveOilRigsRepaired,&Current->ObjectiveEngineersSaved,&Current->ObjectiveWeaponsFound,&Current->ObjectiveWeaponsReturned,&Current->ObjectivePlasmaRifleReturned,&Current->BonusObjectivesCompleted,&Current->PickedupHealthPowerups,&Current->PickedupArmorPowerups,&Current->PickedupCashPowerups,&Current->PickedupAmmoPowerups,&Current->PickedupHealthTotal,&Current->PickedupArmorTotal,&Current->PickedupCashTotal,&Current->PickedupAmmoTotal,&Current->PickedupTotalPowerups,&Current->PickedupTotalPowerupsInARound,&Current->KilledHumanAi,&Current->VehiclesDestroyed,&Current->VehiclesLost,&Current->JazzsLost,&Current->CleasansLost,&Current->TrucksLost,&Current->TanksLost,&Current->TurretTruckLost,&Current->C4VestPowerups,&Current->ActivatedCommTower,&Current->PlayedGamesWithDefenseTurrets,&Current->PlayedGamesWithGuardianHelicopter,&Current->TimesDrown,&Current->TimesFallen,&Current->KillsWithSentryTurret,&Current->KilledSentryTurrets,&Current->SentryTurretsPlaced,&Current->SentryTurretsLost,&Current->PickedUpMedicalNeedle,&Current->ReturnedMedicalNeedle,&Current->RepairedSubstation,&Current->SubstationOnLineAtEnd,&Current->SubstationNotDamaged,&Current->GiantDeerKilled,&Current->SurvivedAlarm,&Current->WolfKilled,&Current->MutantDogKilled,&Current->BlueDeerKilled,&Current->CheatedRounds,&Current->NeverInjured,&Current->MooseKilled,&Current->MooseKilled,&Current->EatenByRabbit,&Current->EatenByRabbit,&Current->PickedUpDeerStatue,&Current->DroppedDeerStatue,&Current->ReturnedDeerStatue,&Current->TinyDeerKilled,&Current->MutantSquirrelsKilled,&Current->WildDeerKilled,&Current->WildSquirrelsKilled,&Current->ArmoredCarsLost,&Current->WarriorsLost,&Current->TimeOnFoot,&Current->TimeInAJazzs,&Current->TimeInACleasans,&Current->TimeInASecurityTruck,&Current->TimeInArmoredCars,&Current->TimeInAUDVs,&Current->TimeInGatlingTanks,&Current->TimeInIFVs,&Current->FriendlyTinyDeerKilled); + sscanf(decryptedString,"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",&Current->PlayTime,&Current->PreGameTime,&Current->IdleTime,&Current->RoundsPlayed,&Current->RoundsCompleted,&Current->RoundsQuit,&Current->RoundsWon,&Current->RoundsLost,&Current->MostKillsInARound,&Current->MostDeathsInARound,&Current->MostBonusObjectivesCompletedInARound,&Current->Deaths,&Current->Kills,&Current->VehicleKills,&Current->KilledSelf,&Current->KilledPlayers,&Current->KilledPresident,&Current->KilledTurrets,&Current->KilledBears,&Current->KilledBlackBears,&Current->KilledMutantBears,&Current->KilledMutantDeer,&Current->KilledMutantCats,&Current->KilledMutantCatsB,&Current->KilledMutantCatsR,&Current->KilledMutantRabbits,&Current->ObjectiveActivatedAlarm,&Current->ObjectiveTurretTruck,&Current->ObjectiveTurretTruckAlarm,&Current->ObjectiveOilRigsActivated,&Current->ObjectiveOilRigsRepaired,&Current->ObjectiveEngineersSaved,&Current->ObjectiveWeaponsFound,&Current->ObjectiveWeaponsReturned,&Current->ObjectivePlasmaRifleReturned,&Current->BonusObjectivesCompleted,&Current->PickedupHealthPowerups,&Current->PickedupArmorPowerups,&Current->PickedupCashPowerups,&Current->PickedupAmmoPowerups,&Current->PickedupHealthTotal,&Current->PickedupArmorTotal,&Current->PickedupCashTotal,&Current->PickedupAmmoTotal,&Current->PickedupTotalPowerups,&Current->PickedupTotalPowerupsInARound,&Current->KilledHumanAi,&Current->VehiclesDestroyed,&Current->VehiclesLost,&Current->JazzsLost,&Current->CleasansLost,&Current->TrucksLost,&Current->TanksLost,&Current->TurretTruckLost,&Current->C4VestPowerups,&Current->ActivatedCommTower,&Current->PlayedGamesWithDefenseTurrets,&Current->PlayedGamesWithGuardianHelicopter,&Current->TimesDrown,&Current->TimesFallen,&Current->KillsWithSentryTurret,&Current->KilledSentryTurrets,&Current->SentryTurretsPlaced,&Current->SentryTurretsLost,&Current->PickedUpMedicalNeedle,&Current->ReturnedMedicalNeedle,&Current->RepairedSubstation,&Current->SubstationOnLineAtEnd,&Current->SubstationNotDamaged,&Current->GiantDeerKilled,&Current->SurvivedAlarm,&Current->WolfKilled,&Current->MutantDogKilled,&Current->BlueDeerKilled,&Current->CheatedRounds,&Current->NeverInjured,&Current->MooseKilled,&Current->MooseKilled,&Current->EatenByRabbit,&Current->EatenByRabbit,&Current->PickedUpDeerStatue,&Current->DroppedDeerStatue,&Current->ReturnedDeerStatue,&Current->TinyDeerKilled,&Current->MutantSquirrelsKilled,&Current->WildDeerKilled,&Current->WildSquirrelsKilled,&Current->ArmoredCarsLost,&Current->WarriorsLost,&Current->TimeOnFoot,&Current->TimeInAJazzs,&Current->TimeInACleasans,&Current->TimeInASecurityTruck,&Current->TimeInArmoredCars,&Current->TimeInAUDVs,&Current->TimeInGatlingTanks,&Current->TimeInIFVs,&Current->FriendlyTinyDeerKilled,&Current->LastPlayTime.day,&Current->LastPlayTime.month,&Current->LastPlayTime.year,&Current->LastPlayTime.second,&Current->LastPlayTime.minute,&Current->LastPlayTime.hour,&Current->LastPlayTime.lTime,&Current->SupportReceivedInfantryHp,&Current->SupportReceivedVehicleHp,&Current->SupportReceivedAmmo,&Current->SupportGrantedHpInfantry,&Current->SupportGrantedHpVehicle,&Current->SupportGrantedAmmo,&Current->SupportReceivedHpInfantrySelf,&Current->SupportReceivedHpVehicleSelf,&Current->SupportReceivedAmmoSelf,&Current->PettedCougars,&Current->KilledCougars,&Current->KilledMutantCougars,&Current->FailedPettingCougars,&Current->KilledFriendlyCougars,&Current->DiedTryingToEscapeBase); } fclose(LoadScores); } @@ -1849,6 +1879,21 @@ case 93: return EveluateHighestScore(High->TimeInGatlingTanks,Current->TimeInGatlingTanks,High,Current); case 94: return EveluateHighestScore(High->TimeInIFVs,Current->TimeInIFVs,High,Current); case 95: return EveluateHighestScore(High->FriendlyTinyDeerKilled,Current->FriendlyTinyDeerKilled,High,Current); + case 96: return EveluateHighestScore(High->SupportReceivedInfantryHp,Current->SupportReceivedInfantryHp,High,Current); + case 97: return EveluateHighestScore(High->SupportReceivedVehicleHp,Current->SupportReceivedVehicleHp,High,Current); + case 98: return EveluateHighestScore(High->SupportReceivedAmmo,Current->SupportReceivedAmmo,High,Current); + case 99: return EveluateHighestScore(High->SupportGrantedHpInfantry,Current->SupportGrantedHpInfantry,High,Current); + case 100: return EveluateHighestScore(High->SupportGrantedHpVehicle,Current->SupportGrantedHpVehicle,High,Current); + case 101: return EveluateHighestScore(High->SupportGrantedAmmo,Current->SupportGrantedAmmo,High,Current); + case 102: return EveluateHighestScore(High->SupportReceivedHpInfantrySelf,Current->SupportReceivedHpInfantrySelf,High,Current); + case 103: return EveluateHighestScore(High->SupportReceivedHpVehicleSelf,Current->SupportReceivedHpVehicleSelf,High,Current); + case 104: return EveluateHighestScore(High->SupportReceivedAmmoSelf,Current->SupportReceivedAmmoSelf,High,Current); + case 105: return EveluateHighestScore(High->PettedCougars,Current->PettedCougars,High,Current); + case 106: return EveluateHighestScore(High->KilledCougars,Current->KilledCougars,High,Current); + case 107: return EveluateHighestScore(High->KilledMutantCougars,Current->KilledMutantCougars,High,Current); + case 108: return EveluateHighestScore(High->FailedPettingCougars,Current->FailedPettingCougars,High,Current); + case 109: return EveluateHighestScore(High->KilledFriendlyCougars,Current->KilledFriendlyCougars,High,Current); + case 110: return EveluateHighestScore(High->DiedTryingToEscapeBase,Current->DiedTryingToEscapeBase,High,Current); default: return High; } } @@ -1954,6 +1999,21 @@ case 93: return Node->TimeInGatlingTanks ? true : false; case 94: return Node->TimeInIFVs ? true : false; case 95: return Node->FriendlyTinyDeerKilled ? true : false; + case 96: return Node->SupportReceivedInfantryHp ? true : false; + case 97: return Node->SupportReceivedVehicleHp ? true : false; + case 98: return Node->SupportReceivedAmmo ? true : false; + case 99: return Node->SupportGrantedHpInfantry ? true : false; + case 100: return Node->SupportGrantedHpVehicle ? true : false; + case 101: return Node->SupportGrantedAmmo ? true : false; + case 102: return Node->SupportReceivedHpInfantrySelf ? true : false; + case 103: return Node->SupportReceivedHpVehicleSelf ? true : false; + case 104: return Node->SupportReceivedAmmoSelf ? true : false; + case 105: return Node->PettedCougars ? true : false; + case 106: return Node->KilledCougars ? true : false; + case 107: return Node->KilledMutantCougars ? true : false; + case 108: return Node->FailedPettingCougars ? true : false; + case 109: return Node->KilledFriendlyCougars ? true : false; + case 110: return Node->DiedTryingToEscapeBase ? true : false; default: Console_Input("msg SCORE SYSTEM ERROR: Out of bounds!");return false; } } @@ -2010,7 +2070,7 @@ case 43: sprintf(RetChar,"Server Record: %s has acquired %s clips of ammo from ammo powerups.",High->PlayerName,JmgUtility::formatDigitGrouping(High->PickedupAmmoTotal));return RetChar; case 44: sprintf(RetChar,"Server Record: %s has acquired %s powerups.",High->PlayerName,JmgUtility::formatDigitGrouping(High->PickedupTotalPowerups));return RetChar; case 45: sprintf(RetChar,"Server Record: %s has acquired %s powerups in a round.",High->PlayerName,JmgUtility::formatDigitGrouping(High->PickedupTotalPowerupsInARound));return RetChar; - case 46: sprintf(RetChar,"Server Record: %s has killed %s friendly ai.",High->PlayerName,JmgUtility::formatDigitGrouping(High->KilledHumanAi));return RetChar; + case 46: sprintf(RetChar,"Server Record: %s has killed %s friendly AI.",High->PlayerName,JmgUtility::formatDigitGrouping(High->KilledHumanAi));return RetChar; case 47: sprintf(RetChar,"Server Record: %s has destroyed %s vehicles.",High->PlayerName,JmgUtility::formatDigitGrouping(High->VehiclesDestroyed));return RetChar; case 48: sprintf(RetChar,"Server Record: %s has lost %s vehicles.",High->PlayerName,JmgUtility::formatDigitGrouping(High->VehiclesLost));return RetChar; case 49: sprintf(RetChar,"Server Record: %s has lost %s Punda Jazzs.",High->PlayerName,JmgUtility::formatDigitGrouping(High->JazzsLost));return RetChar; @@ -2060,6 +2120,21 @@ case 93: sprintf(RetChar,"Server Record: %s has spent %s minutes in Gatling Tanks.",High->PlayerName,JmgUtility::formatDigitGrouping(High->TimeInGatlingTanks/60.0f));return RetChar; case 94: sprintf(RetChar,"Server Record: %s has spent %s minutes in Warrior Infantry Fighting Vehicles.",High->PlayerName,JmgUtility::formatDigitGrouping(High->TimeInIFVs/60.0f));return RetChar; case 95: sprintf(RetChar,"Server Record: %s has killed %s friendly tiny deer.",High->PlayerName,JmgUtility::formatDigitGrouping(High->FriendlyTinyDeerKilled));return RetChar; + case 96: sprintf(RetChar,"Server Record: %s has received %s points of HP to infantry from Armored Supply Trucks.",High->PlayerName,JmgUtility::formatDigitGrouping(High->SupportReceivedInfantryHp));return RetChar; + case 97: sprintf(RetChar,"Server Record: %s has received %s points of HP to vehicles from Armored Supply Trucks.",High->PlayerName,JmgUtility::formatDigitGrouping(High->SupportReceivedVehicleHp));return RetChar; + case 98: sprintf(RetChar,"Server Record: %s has received %s points of ammo from Armored Supply Trucks.",High->PlayerName,JmgUtility::formatDigitGrouping(High->SupportReceivedAmmo));return RetChar; + case 99: sprintf(RetChar,"Server Record: %s has given %s points of HP to infantry from Armored Supply Trucks.",High->PlayerName,JmgUtility::formatDigitGrouping(High->SupportGrantedHpInfantry));return RetChar; + case 100: sprintf(RetChar,"Server Record: %s has given %s points of HP to vehicles from Armored Supply Trucks.",High->PlayerName,JmgUtility::formatDigitGrouping(High->SupportGrantedHpVehicle));return RetChar; + case 101: sprintf(RetChar,"Server Record: %s has given %s points of ammo from Armored Supply Trucks.",High->PlayerName,JmgUtility::formatDigitGrouping(High->SupportGrantedAmmo));return RetChar; + case 102: sprintf(RetChar,"Server Record: %s has given %s points of HP to infantry from Armored Supply Trucks to theirself.",High->PlayerName,JmgUtility::formatDigitGrouping(High->SupportReceivedHpInfantrySelf));return RetChar; + case 103: sprintf(RetChar,"Server Record: %s has given %s points of HP to vehicles from Armored Supply Trucks to theirself.",High->PlayerName,JmgUtility::formatDigitGrouping(High->SupportReceivedHpVehicleSelf));return RetChar; + case 104: sprintf(RetChar,"Server Record: %s has given %s points of ammo from Armored Supply Trucks to theirself.",High->PlayerName,JmgUtility::formatDigitGrouping(High->SupportReceivedAmmoSelf));return RetChar; + case 105: sprintf(RetChar,"Server Record: %s has petted %s cougars.",High->PlayerName,JmgUtility::formatDigitGrouping(High->PettedCougars));return RetChar; + case 106: sprintf(RetChar,"Server Record: %s has killed %s wild cougars.",High->PlayerName,JmgUtility::formatDigitGrouping(High->KilledCougars));return RetChar; + case 107: sprintf(RetChar,"Server Record: %s has killed %s mutant cougars.",High->PlayerName,JmgUtility::formatDigitGrouping(High->KilledMutantCougars));return RetChar; + case 108: sprintf(RetChar,"Server Record: %s has killed %s a cougar instead of petting it.",High->PlayerName,JmgUtility::formatDigitGrouping(High->FailedPettingCougars));return RetChar; + case 109: sprintf(RetChar,"Server Record: %s has killed %s friendly cougars.",High->PlayerName,JmgUtility::formatDigitGrouping(High->KilledFriendlyCougars));return RetChar; + case 110: sprintf(RetChar,"Server Record: %s has died trying to escape the base %s times when the boss was lurking about.",High->PlayerName,JmgUtility::formatDigitGrouping(High->DiedTryingToEscapeBase));return RetChar; default: sprintf(RetChar,"Server Record ERROR: Record index out of bounds!"); return RetChar; } } @@ -2139,6 +2214,7 @@ } void IncreasePlayerTimeScores() { + JmgUtility::GenericDateTime currentTime = JmgUtility::GenericDateTime(); for (int y = 1;y < 128;y++) { GameObject *Player = Get_GameObj(y); @@ -2156,6 +2232,7 @@ if (abs(Facing - pobj->lastFacing) < 1.0f) IsTurning = false; pobj->lastFacing = Facing; + pobj->LastPlayTime = currentTime; if (pobj->isMoving == IsMoving && pobj->isTurning == IsTurning) if (pobj->idleDelay > 60) { @@ -2194,7 +2271,10 @@ pobj->isMoving = IsMoving; pobj->isTurning = IsTurning; if (pobj->startedRound) + { pobj->PlayTime++; + pobj->tmpPlayTime++; + } else pobj->PreGameTime++; } @@ -2359,11 +2439,19 @@ class JMG_Bear_Hunter_Player_Spawn : public ScriptImpClass { void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); + Rp2SimplePositionSystem::SimplePositionNode *JMG_Bear_Hunter_Player_Spawn::GetSpotNotVisibileFromSpots(int points,Vector3 pos[],float ranges[]); + Rp2SimplePositionSystem::SimplePositionNode *JMG_Bear_Hunter_Player_Spawn::GetFurthestSpotFromSpots(int points,Vector3 pos[],float weight[]); + bool TestRay(Vector3 pos,Vector3 targetPos); }; class JMG_Bear_Hunter_Player_Vehicle : public ScriptImpClass { + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj,int number); void Custom(GameObject *obj,int message,int param,GameObject *sender); + void Damaged(GameObject *obj,GameObject *damager,float damage); void Killed(GameObject *obj,GameObject *killer); +public: + int lastDamaged; }; class JMG_Bear_Hunter_Bear_Tracker : public ScriptImpClass { @@ -2404,6 +2492,7 @@ float lastHealth; float lastArmor; bool attackingPlayer; + bool targetIsMine; void Created(GameObject *obj); void Enemy_Seen(GameObject *obj,GameObject *seen); void Timer_Expired(GameObject *obj,int number); @@ -2415,6 +2504,7 @@ void ChooseTarget(GameObject *obj,Vector3 pos,GameObject *target); bool inRange(GameObject *obj); void SnackTime(GameObject *obj,GameObject *target); + void MineHunt(GameObject *obj,Vector3 myPos,GameObject *enemy); public: static Vector3 bossPos; static int bossChoose; @@ -2640,6 +2730,7 @@ bool timeUp; Vector3 origPos; float origFacing; + int flareId; void Created(GameObject *obj); void Custom(GameObject *obj,int message,int param,GameObject *sender); GameObject *CreateAObject(GameObject *obj,GameObject *Object,const char *Preset,const char *Model,const char *Animation,const Vector3 &Pos,float Facing,GameObject *GAttachTo,const char *Bone,float DeathFrame,float LastFrame); @@ -3214,13 +3305,9 @@ bool JMG_Wandering_AI::CanInvestigateSound = true; class JMG_Wandering_AI_Controller : public ScriptImpClass { - void Created(GameObject *obj); - void Timer_Expired(GameObject *obj,int number); void Destroyed(GameObject *obj); void Detach(GameObject *obj); public: - static int aiIgnorePlayers[128]; - static float soundAttentionWhoreNotify; static Rp2SimplePositionSystem wanderPoints; static bool setup; JMG_Wandering_AI_Controller() @@ -3229,8 +3316,6 @@ JMG_Wandering_AI_Controller::setup = true; } }; -int JMG_Wandering_AI_Controller::aiIgnorePlayers[128] = {0}; -float JMG_Wandering_AI_Controller::soundAttentionWhoreNotify = 0.0025f; Rp2SimplePositionSystem JMG_Wandering_AI_Controller::wanderPoints; bool JMG_Wandering_AI_Controller::setup = false; @@ -3504,9 +3589,29 @@ }; class JMG_Bear_Hunter_Armored_Car : public ScriptImpClass { + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj,int number); + void Custom(GameObject *obj,int message,int param,GameObject *sender); + void Destroyed(GameObject *obj); +public: + JMG_Bear_Hunter_Armored_Car() + { + ownerNode = NULL; + } bool lightsOn; + int effectRangeId; + BearHunterScoreSystem::BHScoreNode *ownerNode; +}; + +class JMG_Bear_Hunter_Armored_Car_Controller : public ScriptImpClass { void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); + void ArmoredCarSupport(GameObject *obj,BearHunterScoreSystem::BHScoreNode *ownerNode); + void RegenHp(GameObject *obj,BearHunterScoreSystem::BHScoreNode *ownerNode); + void GrantScore(const char *playerName,float score); + void DecideScoreVehicleOrInfantry(GameObject *obj,GameObject *owner,BearHunterScoreSystem::BHScoreNode *ownerNode,float grantHp); + void GrantVehicleRepairScore(GameObject *obj,GameObject *owner,BearHunterScoreSystem::BHScoreNode *ownerNode,float grantHp); + void GrantInfantryRepairScore(GameObject *obj,GameObject *owner,BearHunterScoreSystem::BHScoreNode *ownerNode,float grantHp); }; class JMG_Bear_Hunt_Final_Boss_Support : public ScriptImpClass { @@ -3556,4 +3661,37 @@ class JMG_Security_Camera_Behavior_Ignore : public ScriptImpClass { void Created(GameObject *obj); +}; + +class JMG_Bear_Hunter_Friendly_Cougar : public ScriptImpClass { + int gotoId; + float noPathfindRange; + int LastSeen; + int lastSeenSecondary; + int currentTargetID; + int secondaryTargetId; + int huntorattack; + int waitcount; + Vector3 homelocation; + float speed; + int minVisibilityTime; + int maxVisibilityTime; + float maxHuntDistance; + Vector3 lastPos; + int stuckTime; + bool movingSlow; + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj,int number); + void Enemy_Seen(GameObject *obj,GameObject *seen); + void Damaged(GameObject *obj,GameObject *damager,float damage); + bool chooseTarget(GameObject *obj,GameObject *damager,int *compareId,int *seenTimer); + void FollowPlayer(GameObject *obj,bool moveSlow); +}; + +class JMG_Bear_Hunter_SpawnPoint_Final_Boss_Line_Of_Sight : public ScriptImpClass { + void Created(GameObject *obj); +}; + +class JMG_Bear_Hunter_SpawnPoint_Final_Boss : public ScriptImpClass { + void Created(GameObject *obj); }; \ No newline at end of file diff -ur sourceold/scripts/jmgMetroid.cpp source/scripts/jmgMetroid.cpp --- sourceold/scripts/jmgMetroid.cpp 2019-06-22 07:43:44.241400000 +1000 +++ source/scripts/jmgMetroid.cpp 2019-08-20 10:11:06.810000100 +1000 @@ -307,6 +307,7 @@ } void JMG_Metroid_Game_Control::IncreasePlayerTimeScores() { + JmgUtility::GenericDateTime currentTime = JmgUtility::GenericDateTime(); for (int y = 1;y < 128;y++) { GameObject *Player = Get_GameObj(y); @@ -324,6 +325,7 @@ if (abs(Facing - pobj->LastFacing) < 1.0f) IsTurning = false; pobj->LastFacing = Facing; + pobj->LastPlayTime = currentTime; if (pobj->IsMoving == IsMoving && pobj->IsTurning == IsTurning) if (pobj->IdleDelay > 60) { @@ -5189,14 +5191,21 @@ } void JMG_AI_Artillery_Targeting_Fire_Vehicle_Projectile_Attach::Created(GameObject *obj) { - Commands->Start_Timer(obj,this,0.025f,1); + Force_Position_Update(obj); + Force_Orientation_Update(obj); + Force_Velocity_Update(obj); + Update_Network_Object(obj); + Commands->Start_Timer(obj,this,0.1f,1); } void JMG_AI_Artillery_Targeting_Fire_Vehicle_Projectile_Attach::Timer_Expired(GameObject *obj,int number) { if (number == 1) { Force_Position_Update(obj); - Commands->Start_Timer(obj,this,0.025f,1); + Force_Orientation_Update(obj); + Force_Velocity_Update(obj); + Update_Network_Object(obj); + Commands->Start_Timer(obj,this,1.0f,1); } } void JMG_AI_Artillery_Targeting_Fire_Vehicle_Projectile_Attach::Destroyed(GameObject *obj) diff -ur sourceold/scripts/jmgMetroid.h source/scripts/jmgMetroid.h --- sourceold/scripts/jmgMetroid.h 2018-11-17 10:23:57.236600000 +1000 +++ source/scripts/jmgMetroid.h 2019-08-20 10:11:06.811000100 +1000 @@ -192,6 +192,7 @@ unsigned long KillsWithGrenade; unsigned long KillsWithRoboticGrenade; unsigned long KillsWithUnknownWeapon; + JmgUtility::GenericDateTime LastPlayTime; @@ -360,6 +361,7 @@ KillsWithGrenade= 0; KillsWithRoboticGrenade= 0; KillsWithUnknownWeapon = 0; + LastPlayTime = JmgUtility::GenericDateTime(); next = NULL; @@ -506,7 +508,7 @@ if (Current->LongestPlayTimeInARound < Current->playTimeThisRound) Current->LongestPlayTimeInARound = Current->playTimeThisRound; char EncryptString[4096]; - sprintf(EncryptString,"%.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %lu %lu %.2lf %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu 0",Current->PlayTime,Current->IdleTime,Current->Points,Current->MostPointsInARound,Current->HealthPackPoints,Current->RechargePoints,Current->DefenseGunPoints,Current->TeleportPoints,Current->ShieldUpgradePoints,Current->WeaponSpawnPoints,Current->Deaths,Current->DeathFromElectrifiedWater,Current->DeathFromSpikePit,Current->DeathFromFallingOffTheTrain,Current->DeathInLava,Current->DeathInRadioactivePit,Current->DeathFromReactorRadiation,Current->DeathInFire,Current->DeathFromMiniBoss,Current->KilledMiniBoss,Current->DeathFromDefenseCameras,Current->DeathFromAliens,Current->DeathFromRobots,Current->DeathFromTraitors,Current->DeathFromAttackCameras,Current->DeathFromGunEmplacements,Current->DeathFromShredderTurret,Current->DeathFromBansheeBoss,Current->DeathFromMineBoss,Current->DeathFromMineBossSquish,Current->DeathFromMineBossResources,Current->Kills,Current->Suicides,Current->KilledPlayers,Current->KilledDefenseCameras,Current->KilledAliens,Current->KilledRobots,Current->KilledTraitors,Current->KilledSecurityCameras,Current->KilledAttackCameras,Current->KilledGunEmplacements,Current->KilledTurretBoss,Current->KilledBansheeBoss,Current->KilledMineBoss,Current->Chapter1Completed,Current->Chapter2Completed,Current->Chapter3Completed,Current->Chapter4Completed,Current->Chapter5Completed,Current->Chapter6Completed,Current->Chapter7Completed,Current->Chapter8Completed,Current->Chapter9Completed,Current->Chapter10Completed,Current->TriggeredLockdown0,Current->TriggeredLockdown1,Current->TriggeredLockdown2,Current->TriggeredLockdown3,Current->TriggeredLockdown4,Current->TriggeredLockdown5,Current->TriggeredLockdown6,Current->TriggeredLockdown7,Current->TriggeredLockdown8,Current->TriggeredLockdown9,Current->PickedUpPlayerPlacedWeapon,Current->PickedUpLaser,Current->PickedUpShotgun,Current->PickedUpSniper,Current->PickedUpFlame,Current->PickedUpShockCoil,Current->PickedUpMachineGun,Current->PickedUpRoboticLaser,Current->PickedUpRoboticShotgun,Current->PickedUpRoboticSniper,Current->PickedUpRoboticFlame,Current->PickedUpRoboticShockCoil,Current->PickedUpRoboticMachineGun,Current->PickedUpGlitchGun,Current->PickedUpHealthPack,Current->PickedUpPlayerPlacedHealthPack,Current->PickedUpShieldUpgrade,Current->PickedUpPlayerShieldUpgrade,Current->PlacedMedPacks,Current->PlacedRechargers,Current->PlacedTurrets,Current->PlacedTeleports,Current->PlacedShieldUpgrades,Current->PlacedWeaponSpawners,Current->UsedPlayerPlacedTeleport,Current->PlayTimeAsClass0,Current->PlayTimeAsClass1,Current->PlayTimeAsClass2,Current->PlayTimeAsClass3,Current->PlayTimeAsClass4,Current->PlayTimeAsClass5,Current->PlayTimeAsClass6,Current->PlayTimeAsClass7,Current->PlayTimeAsClass8,Current->PlayTimeAsClass9,Current->PlayTimeAsClass10,Current->PlayTimeAsClass11,Current->PlayTimeInSpawnRoom,Current->CompletedPlayThroughs,Current->DeathFromPlayers,Current->LongestPlayTimeInARound,Current->SpawnedAsCharacter0,Current->SpawnedAsCharacter1,Current->SpawnedAsCharacter2,Current->SpawnedAsCharacter3,Current->SpawnedAsCharacter4,Current->SpawnedAsCharacter5,Current->SpawnedAsCharacter6,Current->SpawnedAsCharacter7,Current->SpawnedAsCharacter8,Current->SpawnedAsCharacter9,Current->KilledCrates,Current->PickedUpGrenadeLaunchers,Current->ElevatorButtonsPressed,Current->ElevatorLockdownButton,Current->KilledBrokenDoors,Current->GlitchModeFound,Current->GlitchModeCompleted,Current->FoundCheatGun,Current->OpenedFirstDoor,Current->GotKeycard,Current->KilledByRapids,Current->KilledByFall,Current->TurnedOffLaserFence,Current->BackLaserFence,Current->ReactorPowerRestored,Current->ComputerConsolesDeactivated,Current->CityShieldLowered,Current->ElectrifiedWaterTurnedOff,Current->TunnelEntryLowered,Current->KillsWithDefenseGun,Current->KillsWithCheatGun,Current->KillsWithFlameUpgrade,Current->KillsWithRoboticFlameUpgrade,Current->KillsWithGlitchGun,Current->KillsWithImperialist,Current->KillsWithRoboticImperialist,Current->KillsWithLaserShotgun,Current->KillsWithRoboticLaserShotgun,Current->KillsWithMachineGun,Current->KillsWithRoboticMachineGun,Current->KillsWithShockCoil,Current->KillsWithRoboticShockCoil,Current->KillsWithLaser,Current->KillsWithRoboticLaser,Current->KillsWithHyperdeath,Current->KillsWithSuperHyperdeath,Current->KillsWithKnife,Current->KillsWithGrenade,Current->KillsWithRoboticGrenade,Current->KillsWithUnknownWeapon); + sprintf(EncryptString,"%.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %.2lf %lu %lu %.2lf %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %d %d %d %d %d %d %lu 0",Current->PlayTime,Current->IdleTime,Current->Points,Current->MostPointsInARound,Current->HealthPackPoints,Current->RechargePoints,Current->DefenseGunPoints,Current->TeleportPoints,Current->ShieldUpgradePoints,Current->WeaponSpawnPoints,Current->Deaths,Current->DeathFromElectrifiedWater,Current->DeathFromSpikePit,Current->DeathFromFallingOffTheTrain,Current->DeathInLava,Current->DeathInRadioactivePit,Current->DeathFromReactorRadiation,Current->DeathInFire,Current->DeathFromMiniBoss,Current->KilledMiniBoss,Current->DeathFromDefenseCameras,Current->DeathFromAliens,Current->DeathFromRobots,Current->DeathFromTraitors,Current->DeathFromAttackCameras,Current->DeathFromGunEmplacements,Current->DeathFromShredderTurret,Current->DeathFromBansheeBoss,Current->DeathFromMineBoss,Current->DeathFromMineBossSquish,Current->DeathFromMineBossResources,Current->Kills,Current->Suicides,Current->KilledPlayers,Current->KilledDefenseCameras,Current->KilledAliens,Current->KilledRobots,Current->KilledTraitors,Current->KilledSecurityCameras,Current->KilledAttackCameras,Current->KilledGunEmplacements,Current->KilledTurretBoss,Current->KilledBansheeBoss,Current->KilledMineBoss,Current->Chapter1Completed,Current->Chapter2Completed,Current->Chapter3Completed,Current->Chapter4Completed,Current->Chapter5Completed,Current->Chapter6Completed,Current->Chapter7Completed,Current->Chapter8Completed,Current->Chapter9Completed,Current->Chapter10Completed,Current->TriggeredLockdown0,Current->TriggeredLockdown1,Current->TriggeredLockdown2,Current->TriggeredLockdown3,Current->TriggeredLockdown4,Current->TriggeredLockdown5,Current->TriggeredLockdown6,Current->TriggeredLockdown7,Current->TriggeredLockdown8,Current->TriggeredLockdown9,Current->PickedUpPlayerPlacedWeapon,Current->PickedUpLaser,Current->PickedUpShotgun,Current->PickedUpSniper,Current->PickedUpFlame,Current->PickedUpShockCoil,Current->PickedUpMachineGun,Current->PickedUpRoboticLaser,Current->PickedUpRoboticShotgun,Current->PickedUpRoboticSniper,Current->PickedUpRoboticFlame,Current->PickedUpRoboticShockCoil,Current->PickedUpRoboticMachineGun,Current->PickedUpGlitchGun,Current->PickedUpHealthPack,Current->PickedUpPlayerPlacedHealthPack,Current->PickedUpShieldUpgrade,Current->PickedUpPlayerShieldUpgrade,Current->PlacedMedPacks,Current->PlacedRechargers,Current->PlacedTurrets,Current->PlacedTeleports,Current->PlacedShieldUpgrades,Current->PlacedWeaponSpawners,Current->UsedPlayerPlacedTeleport,Current->PlayTimeAsClass0,Current->PlayTimeAsClass1,Current->PlayTimeAsClass2,Current->PlayTimeAsClass3,Current->PlayTimeAsClass4,Current->PlayTimeAsClass5,Current->PlayTimeAsClass6,Current->PlayTimeAsClass7,Current->PlayTimeAsClass8,Current->PlayTimeAsClass9,Current->PlayTimeAsClass10,Current->PlayTimeAsClass11,Current->PlayTimeInSpawnRoom,Current->CompletedPlayThroughs,Current->DeathFromPlayers,Current->LongestPlayTimeInARound,Current->SpawnedAsCharacter0,Current->SpawnedAsCharacter1,Current->SpawnedAsCharacter2,Current->SpawnedAsCharacter3,Current->SpawnedAsCharacter4,Current->SpawnedAsCharacter5,Current->SpawnedAsCharacter6,Current->SpawnedAsCharacter7,Current->SpawnedAsCharacter8,Current->SpawnedAsCharacter9,Current->KilledCrates,Current->PickedUpGrenadeLaunchers,Current->ElevatorButtonsPressed,Current->ElevatorLockdownButton,Current->KilledBrokenDoors,Current->GlitchModeFound,Current->GlitchModeCompleted,Current->FoundCheatGun,Current->OpenedFirstDoor,Current->GotKeycard,Current->KilledByRapids,Current->KilledByFall,Current->TurnedOffLaserFence,Current->BackLaserFence,Current->ReactorPowerRestored,Current->ComputerConsolesDeactivated,Current->CityShieldLowered,Current->ElectrifiedWaterTurnedOff,Current->TunnelEntryLowered,Current->KillsWithDefenseGun,Current->KillsWithCheatGun,Current->KillsWithFlameUpgrade,Current->KillsWithRoboticFlameUpgrade,Current->KillsWithGlitchGun,Current->KillsWithImperialist,Current->KillsWithRoboticImperialist,Current->KillsWithLaserShotgun,Current->KillsWithRoboticLaserShotgun,Current->KillsWithMachineGun,Current->KillsWithRoboticMachineGun,Current->KillsWithShockCoil,Current->KillsWithRoboticShockCoil,Current->KillsWithLaser,Current->KillsWithRoboticLaser,Current->KillsWithHyperdeath,Current->KillsWithSuperHyperdeath,Current->KillsWithKnife,Current->KillsWithGrenade,Current->KillsWithRoboticGrenade,Current->KillsWithUnknownWeapon,Current->LastPlayTime.day,Current->LastPlayTime.month,Current->LastPlayTime.year,Current->LastPlayTime.second,Current->LastPlayTime.minute,Current->LastPlayTime.hour,Current->LastPlayTime.lTime); fprintf(SaveScores2,"%s\n%s\n",Current->PlayerName,EncryptString); fprintf(SaveScores,"%s\n%s",JmgUtility::Rp2Encrypt(Current->PlayerName,25,5),JmgUtility::Rp2Encrypt2(EncryptString,Current->PlayerName[0],Current->PlayerName[1])); if (Current->next) @@ -546,7 +548,7 @@ MetroidHighScoresNode *Current = FindOrAddPlayerMetroidHighScoreNode(JmgUtility::Rp2Decrypt(PlayerName,25,5)); char DecryptString[4096]; fgets(DecryptString,4096,LoadScores); - sscanf(JmgUtility::Rp2Decrypt(DecryptString,Current->PlayerName[0],Current->PlayerName[1]),"%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lu %lu %lf %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu ",&Current->PlayTime,&Current->IdleTime,&Current->Points,&Current->MostPointsInARound,&Current->HealthPackPoints,&Current->RechargePoints,&Current->DefenseGunPoints,&Current->TeleportPoints,&Current->ShieldUpgradePoints,&Current->WeaponSpawnPoints,&Current->Deaths,&Current->DeathFromElectrifiedWater,&Current->DeathFromSpikePit,&Current->DeathFromFallingOffTheTrain,&Current->DeathInLava,&Current->DeathInRadioactivePit,&Current->DeathFromReactorRadiation,&Current->DeathInFire,&Current->DeathFromMiniBoss,&Current->KilledMiniBoss,&Current->DeathFromDefenseCameras,&Current->DeathFromAliens,&Current->DeathFromRobots,&Current->DeathFromTraitors,&Current->DeathFromAttackCameras,&Current->DeathFromGunEmplacements,&Current->DeathFromShredderTurret,&Current->DeathFromBansheeBoss,&Current->DeathFromMineBoss,&Current->DeathFromMineBossSquish,&Current->DeathFromMineBossResources,&Current->Kills,&Current->Suicides,&Current->KilledPlayers,&Current->KilledDefenseCameras,&Current->KilledAliens,&Current->KilledRobots,&Current->KilledTraitors,&Current->KilledSecurityCameras,&Current->KilledAttackCameras,&Current->KilledGunEmplacements,&Current->KilledTurretBoss,&Current->KilledBansheeBoss,&Current->KilledMineBoss,&Current->Chapter1Completed,&Current->Chapter2Completed,&Current->Chapter3Completed,&Current->Chapter4Completed,&Current->Chapter5Completed,&Current->Chapter6Completed,&Current->Chapter7Completed,&Current->Chapter8Completed,&Current->Chapter9Completed,&Current->Chapter10Completed,&Current->TriggeredLockdown0,&Current->TriggeredLockdown1,&Current->TriggeredLockdown2,&Current->TriggeredLockdown3,&Current->TriggeredLockdown4,&Current->TriggeredLockdown5,&Current->TriggeredLockdown6,&Current->TriggeredLockdown7,&Current->TriggeredLockdown8,&Current->TriggeredLockdown9,&Current->PickedUpPlayerPlacedWeapon,&Current->PickedUpLaser,&Current->PickedUpShotgun,&Current->PickedUpSniper,&Current->PickedUpFlame,&Current->PickedUpShockCoil,&Current->PickedUpMachineGun,&Current->PickedUpRoboticLaser,&Current->PickedUpRoboticShotgun,&Current->PickedUpRoboticSniper,&Current->PickedUpRoboticFlame,&Current->PickedUpRoboticShockCoil,&Current->PickedUpRoboticMachineGun,&Current->PickedUpGlitchGun,&Current->PickedUpHealthPack,&Current->PickedUpPlayerPlacedHealthPack,&Current->PickedUpShieldUpgrade,&Current->PickedUpPlayerShieldUpgrade,&Current->PlacedMedPacks,&Current->PlacedRechargers,&Current->PlacedTurrets,&Current->PlacedTeleports,&Current->PlacedShieldUpgrades,&Current->PlacedWeaponSpawners,&Current->UsedPlayerPlacedTeleport,&Current->PlayTimeAsClass0,&Current->PlayTimeAsClass1,&Current->PlayTimeAsClass2,&Current->PlayTimeAsClass3,&Current->PlayTimeAsClass4,&Current->PlayTimeAsClass5,&Current->PlayTimeAsClass6,&Current->PlayTimeAsClass7,&Current->PlayTimeAsClass8,&Current->PlayTimeAsClass9,&Current->PlayTimeAsClass10,&Current->PlayTimeAsClass11,&Current->PlayTimeInSpawnRoom,&Current->CompletedPlayThroughs,&Current->DeathFromPlayers,&Current->LongestPlayTimeInARound,&Current->SpawnedAsCharacter0,&Current->SpawnedAsCharacter1,&Current->SpawnedAsCharacter2,&Current->SpawnedAsCharacter3,&Current->SpawnedAsCharacter4,&Current->SpawnedAsCharacter5,&Current->SpawnedAsCharacter6,&Current->SpawnedAsCharacter7,&Current->SpawnedAsCharacter8,&Current->SpawnedAsCharacter9,&Current->KilledCrates,&Current->PickedUpGrenadeLaunchers,&Current->ElevatorButtonsPressed,&Current->ElevatorLockdownButton,&Current->KilledBrokenDoors,&Current->GlitchModeFound,&Current->GlitchModeCompleted,&Current->FoundCheatGun,&Current->OpenedFirstDoor,&Current->GotKeycard,&Current->KilledByRapids,&Current->KilledByFall,&Current->TurnedOffLaserFence,&Current->BackLaserFence,&Current->ReactorPowerRestored,&Current->ComputerConsolesDeactivated,&Current->CityShieldLowered,&Current->ElectrifiedWaterTurnedOff,&Current->TunnelEntryLowered,&Current->KillsWithDefenseGun,&Current->KillsWithCheatGun,&Current->KillsWithFlameUpgrade,&Current->KillsWithRoboticFlameUpgrade,&Current->KillsWithGlitchGun,&Current->KillsWithImperialist,&Current->KillsWithRoboticImperialist,&Current->KillsWithLaserShotgun,&Current->KillsWithRoboticLaserShotgun,&Current->KillsWithMachineGun,&Current->KillsWithRoboticMachineGun,&Current->KillsWithShockCoil,&Current->KillsWithRoboticShockCoil,&Current->KillsWithLaser,&Current->KillsWithRoboticLaser,&Current->KillsWithHyperdeath,&Current->KillsWithSuperHyperdeath,&Current->KillsWithKnife,&Current->KillsWithGrenade,&Current->KillsWithRoboticGrenade,&Current->KillsWithUnknownWeapon); + sscanf(JmgUtility::Rp2Decrypt(DecryptString,Current->PlayerName[0],Current->PlayerName[1]),"%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lu %lu %lf %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %d %d %d %d %d %d %lu ",&Current->PlayTime,&Current->IdleTime,&Current->Points,&Current->MostPointsInARound,&Current->HealthPackPoints,&Current->RechargePoints,&Current->DefenseGunPoints,&Current->TeleportPoints,&Current->ShieldUpgradePoints,&Current->WeaponSpawnPoints,&Current->Deaths,&Current->DeathFromElectrifiedWater,&Current->DeathFromSpikePit,&Current->DeathFromFallingOffTheTrain,&Current->DeathInLava,&Current->DeathInRadioactivePit,&Current->DeathFromReactorRadiation,&Current->DeathInFire,&Current->DeathFromMiniBoss,&Current->KilledMiniBoss,&Current->DeathFromDefenseCameras,&Current->DeathFromAliens,&Current->DeathFromRobots,&Current->DeathFromTraitors,&Current->DeathFromAttackCameras,&Current->DeathFromGunEmplacements,&Current->DeathFromShredderTurret,&Current->DeathFromBansheeBoss,&Current->DeathFromMineBoss,&Current->DeathFromMineBossSquish,&Current->DeathFromMineBossResources,&Current->Kills,&Current->Suicides,&Current->KilledPlayers,&Current->KilledDefenseCameras,&Current->KilledAliens,&Current->KilledRobots,&Current->KilledTraitors,&Current->KilledSecurityCameras,&Current->KilledAttackCameras,&Current->KilledGunEmplacements,&Current->KilledTurretBoss,&Current->KilledBansheeBoss,&Current->KilledMineBoss,&Current->Chapter1Completed,&Current->Chapter2Completed,&Current->Chapter3Completed,&Current->Chapter4Completed,&Current->Chapter5Completed,&Current->Chapter6Completed,&Current->Chapter7Completed,&Current->Chapter8Completed,&Current->Chapter9Completed,&Current->Chapter10Completed,&Current->TriggeredLockdown0,&Current->TriggeredLockdown1,&Current->TriggeredLockdown2,&Current->TriggeredLockdown3,&Current->TriggeredLockdown4,&Current->TriggeredLockdown5,&Current->TriggeredLockdown6,&Current->TriggeredLockdown7,&Current->TriggeredLockdown8,&Current->TriggeredLockdown9,&Current->PickedUpPlayerPlacedWeapon,&Current->PickedUpLaser,&Current->PickedUpShotgun,&Current->PickedUpSniper,&Current->PickedUpFlame,&Current->PickedUpShockCoil,&Current->PickedUpMachineGun,&Current->PickedUpRoboticLaser,&Current->PickedUpRoboticShotgun,&Current->PickedUpRoboticSniper,&Current->PickedUpRoboticFlame,&Current->PickedUpRoboticShockCoil,&Current->PickedUpRoboticMachineGun,&Current->PickedUpGlitchGun,&Current->PickedUpHealthPack,&Current->PickedUpPlayerPlacedHealthPack,&Current->PickedUpShieldUpgrade,&Current->PickedUpPlayerShieldUpgrade,&Current->PlacedMedPacks,&Current->PlacedRechargers,&Current->PlacedTurrets,&Current->PlacedTeleports,&Current->PlacedShieldUpgrades,&Current->PlacedWeaponSpawners,&Current->UsedPlayerPlacedTeleport,&Current->PlayTimeAsClass0,&Current->PlayTimeAsClass1,&Current->PlayTimeAsClass2,&Current->PlayTimeAsClass3,&Current->PlayTimeAsClass4,&Current->PlayTimeAsClass5,&Current->PlayTimeAsClass6,&Current->PlayTimeAsClass7,&Current->PlayTimeAsClass8,&Current->PlayTimeAsClass9,&Current->PlayTimeAsClass10,&Current->PlayTimeAsClass11,&Current->PlayTimeInSpawnRoom,&Current->CompletedPlayThroughs,&Current->DeathFromPlayers,&Current->LongestPlayTimeInARound,&Current->SpawnedAsCharacter0,&Current->SpawnedAsCharacter1,&Current->SpawnedAsCharacter2,&Current->SpawnedAsCharacter3,&Current->SpawnedAsCharacter4,&Current->SpawnedAsCharacter5,&Current->SpawnedAsCharacter6,&Current->SpawnedAsCharacter7,&Current->SpawnedAsCharacter8,&Current->SpawnedAsCharacter9,&Current->KilledCrates,&Current->PickedUpGrenadeLaunchers,&Current->ElevatorButtonsPressed,&Current->ElevatorLockdownButton,&Current->KilledBrokenDoors,&Current->GlitchModeFound,&Current->GlitchModeCompleted,&Current->FoundCheatGun,&Current->OpenedFirstDoor,&Current->GotKeycard,&Current->KilledByRapids,&Current->KilledByFall,&Current->TurnedOffLaserFence,&Current->BackLaserFence,&Current->ReactorPowerRestored,&Current->ComputerConsolesDeactivated,&Current->CityShieldLowered,&Current->ElectrifiedWaterTurnedOff,&Current->TunnelEntryLowered,&Current->KillsWithDefenseGun,&Current->KillsWithCheatGun,&Current->KillsWithFlameUpgrade,&Current->KillsWithRoboticFlameUpgrade,&Current->KillsWithGlitchGun,&Current->KillsWithImperialist,&Current->KillsWithRoboticImperialist,&Current->KillsWithLaserShotgun,&Current->KillsWithRoboticLaserShotgun,&Current->KillsWithMachineGun,&Current->KillsWithRoboticMachineGun,&Current->KillsWithShockCoil,&Current->KillsWithRoboticShockCoil,&Current->KillsWithLaser,&Current->KillsWithRoboticLaser,&Current->KillsWithHyperdeath,&Current->KillsWithSuperHyperdeath,&Current->KillsWithKnife,&Current->KillsWithGrenade,&Current->KillsWithRoboticGrenade,&Current->KillsWithUnknownWeapon,&Current->LastPlayTime.day,&Current->LastPlayTime.month,&Current->LastPlayTime.year,&Current->LastPlayTime.second,&Current->LastPlayTime.minute,&Current->LastPlayTime.hour,&Current->LastPlayTime.lTime); } fclose(LoadScores); LoadHighestScores(); diff -ur sourceold/scripts/jmgUtility.cpp source/scripts/jmgUtility.cpp --- sourceold/scripts/jmgUtility.cpp 2019-06-22 07:43:44.244400000 +1000 +++ source/scripts/jmgUtility.cpp 2019-08-20 10:11:06.814000100 +1000 @@ -10333,6 +10333,7 @@ JMG_Utility_AI_Skittish_Herd_Animal::HerdAnimalPositionSystem JMG_Utility_AI_Skittish_Herd_Animal::HerdAnimalPositionControl[128] = {HerdAnimalPositionSystem()}; void JMG_Utility_AI_Skittish_Herd_Animal::Created(GameObject *obj) { + actionCrouched = Get_Float_Parameter("ActionsCrouched"); weaponRange = 3.75; sprintf(defaultWeapon,"%s",Get_Current_Weapon(obj)); int minHerdId = Get_Int_Parameter("MinHerdID"); @@ -10438,7 +10439,7 @@ params.Set_Movement(pos,speed ? speed : (Enemy ? 1.0f : Commands->Get_Random(0.25f,1.0f)),Enemy ? weaponRange*Commands->Get_Random(0.01f,1.0f) : 1.0f,false); params.MovePathfind = true; Vector3 mypos = Commands->Get_Position(obj); - if (!speed && JmgUtility::SimpleDistance(mypos,pos) < 625 && Commands->Get_Random(0.0f,1.0f) < 0.25f) + if (!speed && JmgUtility::SimpleDistance(mypos,pos) < 625 && Commands->Get_Random(0.0f,1.0f) < actionCrouched) { params.MoveCrouched = true; params.AttackCrouched = true; @@ -12115,6 +12116,38 @@ } } } +void JMG_Utility_Player_Seen_Send_Custom::Created(GameObject *obj) +{ + id = Get_Int_Parameter("ID"); + custom = Get_Int_Parameter("Custom"); + Param = Get_Int_Parameter("Param"); + delay = Get_Float_Parameter("Delay"); + triggerOnce = Get_Int_Parameter("TriggerOnce") != 0; + Commands->Start_Timer(obj,this,0.1f,1); +} +void JMG_Utility_Player_Seen_Send_Custom::Timer_Expired(GameObject *obj,int number) +{ + if (number == 1) + { + for (int x = 1;x < 128;x++) + { + GameObject *player = Get_GameObj(x); + if (!player || Commands->Get_Player_Type(player) == -4) + continue; + SmartGameObj *smartGameObject = player->As_SmartGameObj(); + if (!smartGameObject || !smartGameObject->Is_Visible()) + continue; + if (obj->As_SmartGameObj()->Is_Obj_Visible(smartGameObject)) + { + GameObject *object = id ? (id == -1 ? player : Commands->Find_Object(id)) : obj; + Commands->Send_Custom_Event(obj,object,custom,Param == -1 ? Commands->Get_ID(player) : Param,delay); + if (triggerOnce) + Destroy_Script(); + } + } + Commands->Start_Timer(obj,this,0.1f,1); + } +} ScriptRegistrant JMG_Utility_Check_If_Script_Is_In_Library_Registrant("JMG_Utility_Check_If_Script_Is_In_Library","ScriptName:string,CppName:string"); ScriptRegistrant JMG_Send_Custom_When_Custom_Sequence_Matched_Registrant("JMG_Send_Custom_When_Custom_Sequence_Matched","Success_Custom=0:int,Correct_Step_Custom=0:int,Partial_Failure_Custom=0:int,Failure_Custom=0:int,Send_To_ID=0:int,Custom_0=0:int,Custom_1=0:int,Custom_2=0:int,Custom_3=0:int,Custom_4=0:int,Custom_5=0:int,Custom_6=0:int,Custom_7=0:int,Custom_8=0:int,Custom_9=0:int,Disable_On_Success=1:int,Disable_On_Failure=0:int,Starts_Enabled=1:int,Enable_Custom=0:int,Correct_Step_Saftey=0:int,Failure_Saftey=1:int,Max_Failures=1:int"); ScriptRegistrant JMG_Utility_Change_Model_On_Timer_Registrant("JMG_Utility_Change_Model_On_Timer","Model=null:string,Time=0:float"); @@ -12365,7 +12398,7 @@ ScriptRegistrant JMG_Utility_Timer_Trigger_Enemy_Seen_Registrant("JMG_Utility_Timer_Trigger_Enemy_Seen","Scan_Rate=0.1:float"); ScriptRegistrant JMG_Utility_Custom_Teleport_To_Random_Wander_Point_Registrant("JMG_Utility_Custom_Teleport_To_Random_Wander_Point","Custom:int,WanderingAIGroupID=-1:int,SafeTeleportDistance=1.5:float,RetryOnFailure=0:int"); ScriptRegistrant JMG_Utility_Send_Custom_If_Not_Moving_Enough_Registrant("JMG_Utility_Send_Custom_If_Not_Moving_Enough","Time:float,Distance:float,ID=0:int,SendCustom:int,Param:int,Delay=0.0:float"); -ScriptRegistrant JMG_Utility_AI_Skittish_Herd_Animal_Registrant("JMG_Utility_AI_Skittish_Herd_Animal","MinHerdID=0:int,MaxHerdID=0:int,WanderGroupID=0:int,WanderRadiusAroundHerdCenter=25.0:float,MinWanderFrequency=5.0:float,MaxWanderFrequency=30.0:float,MinRetreatRange=50.0:float,MaxRetreatRange=200.0:float,MinRetreatTime=6.0:float,MaxRetreatTime=24.0:float,MinUpdateHerdCenter=10.0:float,MaxUpdateHerdCenter=25.0:float,RunTowardThreatChance=0.0:float"); +ScriptRegistrant JMG_Utility_AI_Skittish_Herd_Animal_Registrant("JMG_Utility_AI_Skittish_Herd_Animal","MinHerdID=0:int,MaxHerdID=0:int,WanderGroupID=0:int,WanderRadiusAroundHerdCenter=25.0:float,MinWanderFrequency=5.0:float,MaxWanderFrequency=30.0:float,MinRetreatRange=50.0:float,MaxRetreatRange=200.0:float,MinRetreatTime=6.0:float,MaxRetreatTime=24.0:float,MinUpdateHerdCenter=10.0:float,MaxUpdateHerdCenter=25.0:float,RunTowardThreatChance=0.0:float,ActionsCrouched=0.25:float"); ScriptRegistrant JMG_Utility_AI_Skittish_Herd_Animal_Ignore_Registrant("JMG_Utility_AI_Skittish_Herd_Animal_Ignore",""); ScriptRegistrant JMG_Utility_AI_Skittish_Herd_Animal_Controller_Registrant("JMG_Utility_AI_Skittish_Herd_Animal_Controller",""); ScriptRegistrant JMG_Utility_Custom_Display_Dialog_Box_Registrant("JMG_Utility_Custom_Display_Dialog_Box","Custom:int,Message:string,Delim=@:string"); @@ -12402,3 +12435,4 @@ ScriptRegistrant JMG_Utility_AI_Lobbed_Vehicle_Projectile_Custom_Registrant("JMG_Utility_AI_Lobbed_Vehicle_Projectile_Custom","TargetCustom:int,MinDistance=0.0:float,MinAngle=-90.0:float,MaxAngle=90.0:float,UseLowAngleMaxDistance=0.0:float,UseLowAngleWhenAboveMinDistance=1:int,UseLowAngleTargetAboveHeight=9999.9:float,VehicleProjectilePreset:string,FireVelocity=1.0:float,GravityScale=1.0:float,MissAmountPerMeter=0.0:float,BaseMissAmount=0.0:float,ProjectedShotsChance=1.0:float,FireRate=1.0:float,ReloadTime=1.0:float,ReloadSound=null:string,ClipCount=1:int,FireSound=null:string,MuzzleFlashExplosion=null:string,ProjectileExplosion=null:string,CustomTimeoutTime=3:int,AimTurret=1:int"); ScriptRegistrant JMG_Utility_Vehicle_Enter_Send_Custom_From_Enterer_Registrant("JMG_Utility_Vehicle_Enter_Send_Custom_From_Enterer","PlayerType=2:int,ID:int,Custom:int,Param:int,Delay:float,TriggerOnce:int"); ScriptRegistrant JMG_Utility_Custom_Send_Custom_On_Count_From_Sender_Registrant("JMG_Utility_Custom_Send_Custom_On_Count_From_Sender","Custom:int,Count:int,ID=0:int,SendCustom:int,Param:int,Delay:float,ResetCustom:int"); +ScriptRegistrant JMG_Utility_Player_Seen_Send_Custom_Registrant("JMG_Utility_Player_Seen_Send_Custom","ID:int,Custom:int,Param:int,Delay:float,TriggerOnce:int"); \ No newline at end of file diff -ur sourceold/scripts/jmgUtility.h source/scripts/jmgUtility.h --- sourceold/scripts/jmgUtility.h 2019-06-22 07:43:44.247400000 +1000 +++ source/scripts/jmgUtility.h 2019-08-20 10:11:06.817000100 +1000 @@ -240,6 +240,46 @@ class JmgUtility { public: + struct GenericDateTime + { + int month; + int day; + int year; + int hour; + int minute; + int second; + unsigned long lTime; + GenericDateTime(const GenericDateTime &dateTime) + { + this->month = dateTime.month; + this->day = dateTime.day; + this->year = dateTime.year; + this->hour = dateTime.hour; + this->minute = dateTime.minute; + this->second = dateTime.second; + this->lTime = dateTime.lTime; + } + GenericDateTime() + { + time_t theTime = time(0); + struct tm *timeinfo; + time(&theTime); + timeinfo = localtime(&theTime); + this->year = timeinfo->tm_year+1900; + this->month = timeinfo->tm_mon+1; + this->day = timeinfo->tm_mday; + this->hour = timeinfo->tm_hour; + this->minute = timeinfo->tm_min; + this->second = timeinfo->tm_sec; + this->lTime = (long)mktime(timeinfo); + } + void DebugTime() + { + char debug[220]; + sprintf(debug,"msg %d/%d/%d %d:%02d:%02d {%lu}",month,day,year,hour,minute,second,lTime); + Console_Input(debug); + } + }; static bool IsInPathfindZone(Vector3 spot) { if (!Get_Random_Pathfind_Spot(spot,5.0f,&spot)) @@ -558,6 +598,16 @@ DisplayChatMessage(Player,Red,Green,Blue,MSG); } } + static void MessageTeamPlayersAndType(int Red,int Green,int Blue,int Team,const char *MSG) + { + for (int x = 0;x < 128;x++) + { + GameObject *Player = Get_GameObj(x); + if (!Player || !(Commands->Get_Player_Type(Player) == Team || Get_Team(x) == Team)) + continue; + DisplayChatMessage(Player,Red,Green,Blue,MSG); + } + } static GameObject *FindNearestPlayer(const Vector3 &pos) { GameObject *nearestPlayer = NULL; @@ -798,6 +848,16 @@ } return true; } + static void Create_2D_Wave_Sound_Dialog(const char *soundName) + { + for (int x = 1;x < 128;x++) + { + GameObject *player = Get_GameObj(x); + if (!player) + continue; + Create_2D_Wave_Sound_Dialog_Player(player,soundName); + } + } }; class NewObjectiveSystem @@ -877,10 +937,10 @@ { switch (priority) { - case Primary: JmgUtility::MessageTeamPlayersType(50,255,50,team,format); break; - case Secondary: JmgUtility::MessageTeamPlayersType(50,150,250,team,format); break; - case Tertiary:case Unknown: JmgUtility::MessageTeamPlayersType(150,50,150,team,format); break; - default: JmgUtility::MessageTeamPlayersType(125,150,150,team,format); break; + case Primary: JmgUtility::MessageTeamPlayersAndType(50,255,50,team,format); break; + case Secondary: JmgUtility::MessageTeamPlayersAndType(50,150,250,team,format); break; + case Tertiary:case Unknown: JmgUtility::MessageTeamPlayersAndType(150,50,150,team,format); break; + default: JmgUtility::MessageTeamPlayersAndType(125,150,150,team,format); break; } } void messagePlayerAndColor(GameObject *player,const char *format,Priority priority) @@ -6725,6 +6785,7 @@ * \MinUpdateHerdCenter - Min amount of time required for the center point of the herd to reposition * \MaxUpdateHerdCenter - Max amount of time required for the center point of the herd to reposition * \RunTowardThreatChance - Chance that it'll flee on purpose toward the threat (0.0 - 1.0) +* \ActionsCrouched - Chance that it will move and stand crouched 0-1.0 * \author jgray * \ingroup JmgUtility */ @@ -6880,6 +6941,7 @@ float minWanderFrequency; float maxWanderFrequency; float runTowardThreatChance; + float actionCrouched; void Created(GameObject *obj); void Enemy_Seen(GameObject *obj,GameObject *seen); void Timer_Expired(GameObject *obj,int number); @@ -7947,4 +8009,24 @@ int count; void Created(GameObject *obj); void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief Sends a custom when a player is seen, ignores team -4 (spec) and non-visible +* \ID - ID to send the custom to, 0 sends to self, -1 sends to enter +* \Custom - Custom message to send +* \Param - Param to send +* \Delay - Delay to add before sending custom +* \TriggerOnce - Allows the script only to trigger the first time the zone is entered +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Player_Seen_Send_Custom : public ScriptImpClass { + int id; + int custom; + int Param; + float delay; + bool triggerOnce; + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj,int number); }; \ No newline at end of file diff -ur sourceold/scripts/scripts.h source/scripts/scripts.h --- sourceold/scripts/scripts.h 2018-11-17 10:23:57.259600000 +1000 +++ source/scripts/scripts.h 2019-08-20 10:11:06.818000100 +1000 @@ -318,6 +318,18 @@ class ActionParamsStruct { public: ActionParamsStruct( void ); + void Set_Basic_Old(ScriptClass *s,unsigned long priority,unsigned long ID,long state); + void Set_Attack_Hold(GameObject *Target,float range,float deviation,bool primary,bool Hold); + void Set_Attack_Position(const Vector3 & position,float Range,float Deviation,bool Primary); + void Set_Goto_Location(const Vector3 & position,float speed,float arrivedistance,bool crouch); + void Set_Goto_Following(GameObject *Target,float speed,float arrivedistance,bool following); + void Set_Goto_Crouch(GameObject *Target,float speed,float arrivedistance,bool crouch); + void Set_Goto_Crouch_Following(GameObject *Target,float speed,float arrivedistance,bool crouch,bool following); + void Set_Goto(GameObject *Target,float speed,float arrivedistance); + void Set_Goto_Waypath_Start(unsigned long waypathID,unsigned long waypathstartID,unsigned long waypathendID,bool splined); + void Set_Goto_Waypath(unsigned long waypathID,bool splined,bool v57,bool Hold); + void Set_Goto_Waypath_ID(unsigned long waypathID); + void Set_Move_Arrive_Distance(float distance); void Set_Basic( GameObjObserverClass * script, float priority, int action_id, SoldierAIState ai_state = NO_AI_STATE_CHANGE ) { ObserverID = script->Get_ID(); Priority = (int)priority; ActionID = action_id; AIState = ai_state; } void Set_Basic( long observer_id, float priority, int action_id, SoldierAIState ai_state = NO_AI_STATE_CHANGE ) { ObserverID = observer_id; Priority = (int)priority; ActionID = action_id; AIState = ai_state; } void Set_Look( const Vector3 & location, float duration ) { LookLocation = location; LookDuration = duration; } @@ -450,6 +462,89 @@ LookDuration = duration; return ; } +void inline ActionParamsStruct::Set_Move_Arrive_Distance(float distance) +{ + MoveArrivedDistance = distance; +} +void inline ActionParamsStruct::Set_Goto_Location(const Vector3 & position,float speed,float arrivedistance,bool crouch) +{ + MoveLocation.X = position.X; + MoveLocation.Y = position.Y; + MoveLocation.Z = position.Z; + MoveSpeed = speed; + MoveArrivedDistance = arrivedistance; + MoveCrouched = crouch; +} +void inline ActionParamsStruct::Set_Goto_Following(GameObject *Target,float speed,float arrivedistance,bool following) +{ + MoveObject = Target; + MoveSpeed = speed; + MoveArrivedDistance = arrivedistance; + MoveFollow = following; +} +void inline ActionParamsStruct::Set_Goto_Crouch(GameObject *Target,float speed,float arrivedistance,bool crouch) +{ + MoveObject = Target; + MoveSpeed = speed; + MoveArrivedDistance = arrivedistance; + MoveCrouched = crouch; +} +void inline ActionParamsStruct::Set_Goto_Crouch_Following(GameObject *Target,float speed,float arrivedistance,bool crouch,bool following) +{ + MoveObject = Target; + MoveSpeed = speed; + MoveArrivedDistance = arrivedistance; + MoveCrouched = crouch; + MoveFollow = following; +} +void inline ActionParamsStruct::Set_Goto(GameObject *Target,float speed,float arrivedistance) +{ + MoveObject = Target; + MoveSpeed = speed; + MoveArrivedDistance = arrivedistance; +} +void inline ActionParamsStruct::Set_Goto_Waypath_Start(unsigned long waypathID,unsigned long waypathstartID,unsigned long waypathendID,bool splined) +{ + WaypathID = waypathID; + WaypointStartID = waypathstartID; + WaypointEndID = waypathendID; + WaypathSplined = splined; +} +void inline ActionParamsStruct::Set_Goto_Waypath(unsigned long waypathID,bool splined,bool v57,bool Hold) +{ + WaypathID = waypathID; + WaypathSplined = splined; + AttackActive = v57; + AttackCheckBlocked = Hold; +} +void inline ActionParamsStruct::Set_Goto_Waypath_ID(unsigned long waypathID) +{ + WaypathID = waypathID; +} +void inline ActionParamsStruct::Set_Basic_Old(ScriptClass *s,unsigned long priority,unsigned long ID,long state) +{ + ID = s->Get_ID(); + Priority = priority; + ActionID = ID; + AIState = (SoldierAIState)state; +} +void inline ActionParamsStruct::Set_Attack_Hold(GameObject *Target,float Range,float Deviation,bool Primary,bool Hold) +{ + AttackObject = Target; + AttackRange = Range; + AttackError = Deviation; + AttackPrimaryFire = Primary; + AttackCheckBlocked = Hold; +} +void inline ActionParamsStruct::Set_Attack_Position(const Vector3 & position,float Range,float Deviation,bool Primary) +{ + AttackRange = Range; + AttackLocation.X = position.X; + AttackLocation.Y = position.Y; + AttackLocation.Z = position.Z; + AttackError = Deviation; + AttackPrimaryFire = Primary; +} enum { CUSTOM_EVENT_SYSTEM_FIRST = 1000000000,