//****************KILL SETTLERS by Maq********************** trigger 'WW2PBEM_NoSettlersAlive' when (unit.built && unit.type == UnitType("UNIT_SETTLER")) { KillUnit(unit); } //****************DATE BUTTON by EPW********************** trigger 'InitDATEP1' when (g.player || unit.selected) { //Initialize Date Variables initial_year = g.year; last_checked_year = g.year; year = 1941; month = 12; //Message for Player 1 on turn one Message(g.player, 'The Date'); DisableTrigger('InitDATEP1'); } trigger 'WW2PBEM_Date' when (IsHumanPlayer(g.player)) { if(g.year > last_checked_year && g.year > initial_year) { if(month < 12) { month = month + 1; } elseif(month == 12) { month = 1; year = year + 1; } last_checked_year = g.year; } Message(g.player, 'The Date'); } messagebox 'The Date' { if(month == 1) { strDBindex = GetStringDBIndex(ID_JANUARY); } elseif(month == 2) { strDBindex = GetStringDBIndex(ID_FEBRUARY); } elseif(month == 3) { strDBindex = GetStringDBIndex(ID_MARCH); } elseif(month == 4) { strDBindex = GetStringDBIndex(ID_APRIL); } elseif(month == 5) { strDBindex = GetStringDBIndex(ID_MAY); } elseif(month == 6) { strDBindex = GetStringDBIndex(ID_JUNE); } elseif(month == 7) { strDBindex = GetStringDBIndex(ID_JULY); } elseif(month == 8) { strDBindex = GetStringDBIndex(ID_AUGUST); } elseif(month == 9) { strDBindex = GetStringDBIndex(ID_SEPTEMBER); } elseif(month == 10) { strDBindex = GetStringDBIndex(ID_OCTOBER); } elseif(month == 11) { strDBindex = GetStringDBIndex(ID_NOVEMBER); } elseif(month == 12) { strDBindex = GetStringDBIndex(ID_DECEMBER); } SetStringbyDBIndex(1,strDBIndex); Title(ID_REAL_DATE); MessageType("INFECT_CITY"); Show(); } //****************OIL COUNT by EPW********************** //Oil Count Initialization trigger 'InitOilCount' when (g.player || unit.selected) { //Initial Variable SetActionKey(1, "."); oilResource = 0; oilCount = 0; refCount = 0; ConversionRate = 5; //Conversion Rate to PW manpunCount = 0; oilReserve = 25; //Minimum Oil at turn start oilValue = 20; refValue = 20; //Country Starting Oil oAmerica = 500; oGermany = 2000; oMexico = 50; oRussia = 500; oEngland = 1000; oJapan = 2000; oChina = 100; //Sets Oil Maintance and Burn Rates b=burnrate m=maintenance cost bRateTank = 1; mRateTank = 1; bRateMobileSam = 1; mRateMobileSam = 1; bRateFighter = 3; mRateFighter = 2; bRateSubmarine = 4; mRateSubmarine = 1; bRateDestroyer = 4; mRateDestroyer = 1; bRateBattleship = 5; mRateBattleship = 3; bRateAircraftCarrier = 5; mRateAircraftCarrier = 3; bRateNuke = 20; mRateNuke = 1; bRateTroopShip = 3; mRateTroopShip = 1; // 'OilisGood' equivalent for player1 warning = 0; //warning message check = 0; //for 'movingisbad' trigger Message(g.player, 'MaintenanceCost'); Message(g.player, 'OilResourceandRefinaryCount'); Message(g.player, 'turnStartOil'); Message(g.player, 'BeginTurnPunishment'); Message(g.player, 'OilInfo'); DisableTrigger('InitOilCount'); } //Beginning of turn trigger for maintanence ('OilisGood') Trigger 'OilisGood' when (IsHumanPlayer(g.player)) { //variable resets warning = 0; //warning message oilCount = 0; check = 0; //for 'movingisbad' trigger //Calculates Unit Oil Maintanence Cost Message(g.player, 'MaintenanceCost'); //Counts Oil Resources and Refinaries, then reports total oil to player Message(g.player, 'OilResourceandRefinaryCount'); //Calculates oil each player has at beginning of their turn Message(g.player, 'turnStartOil'); //Punishment for not having enough fuel at beginning of turn to cover Maintanence Costs Message(g.player, 'BeginTurnPunishment'); //Oil Info Message Message(g.player, 'OilInfo'); } //Use fuel when moving ('Movingisbad') Trigger 'Movingisbad' when (unit.moved && IsHumanPlayer(g.player)) { //Gets unit type and its burnRate Message(g.player, 'UnitTypeBurnRate'); //Subtracts fuel for moving Message(g.player, 'SubtractFuel'); //Punishment for running out of fuel midturn ('MidTurnPunishmen') Message(g.player, 'MidTurnPunishment'); //Low Fuel Warnings Message(g.player, 'LowFuelWarnings'); } //Oil Button Popup Trigger 'OilInfoButton' when (key.1.pressed) { //Triggers OilInfoScreen Message(g.player, 'OilInfo'); } //Maintanence Punishment Message ('MaintanencePunishmentMessage') messagebox 'MaintanencePunishmentMessage' { Text(ID_MAINTANENCE_PUNISHMENT); Title(ID_WARNING); MessageType("BOMB_CABINET"); Show(); } //Low Fuel Warnings ('LowFuelWarnings') messagebox 'LowFuelWarnings' { Abort(); if(oilCount < 101 && warning != 1) { Message(g.player,'LowFuelAlert'); warning = 1; } elseif(oilCount < 1 && warning != 2) { Message(g.player,'LowFuelAlert'); warning = 2; } } //Low Fuel Warning alertbox 'LowFuelAlert' { if(oilCount > 0) { Text(ID_FUEL_ALERT); } else { Text(ID_RUN_OUT_OF_FUEL); } Title(ID_WARNING); Button(ID_WW_BUTTON_CLOSE) { Kill(); } } //Oil Info Message ('OilInfo') messagebox 'OilInfo' { Message(g.player,'MaintenanceCost'); Message(g.player, 'OilResourceandRefinaryCount'); Text(ID_OIL_INFO_A); Title(ID_OIL_INFO_TITLE); MessageType("BOMB_CABINET"); Button(ID_WW_BUTTON_UNIT_INFO) { Message(g.player, 'MAINTENANCE_A'); Kill(); } Button(ID_WW_BUTTON_RATES) { Message(g.player, 'RATES_A'); Kill(); } Button(ID_WW_BUTTON_PW) { Message(g.player, 'PW'); Kill(); } Button(ID_WW_BUTTON_GIVE) { Message(g.player, 'GiveSelect'); Kill(); } } //chose which country to give gift to. alertbox 'GiveSelect' { Text (ID_GIVE); if(buttontracker == 0 && PlayerCivilization(g.player) != CivilizationIndex("GERMAN")) { Button(ID_WW_GERMAN) { diplotracker = 1; buttontracker = 0; strDBIndex = GetStringDBIndex(ID_WW_GERMAN); Message(g.player, 'SelectAmounttoGive'); Kill(); } Button(ID_WW_NEXT) { buttontracker = 1; Message(g.player, 'GiveSelect'); Kill(); } Button(ID_WW_BUTTON_CLOSE) { buttontracker = 0; Kill(); } } elseif(buttontracker == 0 && PlayerCivilization(g.player) == CivilizationIndex("GERMAN")) {buttontracker = 1;} if(buttontracker == 1 && PlayerCivilization(g.player) != CivilizationIndex("JAPANESE")) { Button(ID_WW_JAPANESE) { diplotracker = 2; buttontracker = 0; strDBIndex = GetStringDBIndex(ID_WW_JAPANESE); Message(g.player, 'SelectAmounttoGive'); Kill(); } Button(ID_WW_NEXT) { buttontracker = 2; Message(g.player, 'GiveSelect'); Kill(); } Button(ID_WW_BUTTON_CLOSE) { buttontracker = 0; Kill(); } } elseif(buttontracker == 1 && PlayerCivilization(g.player) == CivilizationIndex("JAPANESE")) {buttontracker = 2;} if(buttontracker == 2 && PlayerCivilization(g.player) != CivilizationIndex("RUSSIAN")) { Button(ID_WW_RUSSIANS) { diplotracker = 3; buttontracker = 0; strDBIndex = GetStringDBIndex(ID_WW_RUSSIANS); Message(g.player, 'SelectAmounttoGive'); Kill(); } Button(ID_WW_NEXT) { buttontracker = 3; Message(g.player, 'GiveSelect'); Kill(); } Button(ID_WW_BUTTON_CLOSE) { buttontracker = 0; Kill(); } } elseif(buttontracker == 2 && PlayerCivilization(g.player) == CivilizationIndex("RUSSIAN")) {buttontracker = 3;} if(buttontracker == 3 && PlayerCivilization(g.player) != CivilizationIndex("AMERICANS")) { Button(ID_WW_AMERICANS) { diplotracker = 4; buttontracker = 0; strDBIndex = GetStringDBIndex(ID_WW_AMERICANS); Message(g.player, 'SelectAmounttoGive'); Kill(); } Button(ID_WW_NEXT) { buttontracker = 4; Message(g.player, 'GiveSelect'); Kill(); } Button(ID_WW_BUTTON_CLOSE) { buttontracker = 0; Kill(); } } elseif(buttontracker == 3 && PlayerCivilization(g.player) == CivilizationIndex("AMERICANS")) {buttontracker = 4;} if(buttontracker == 4 && PlayerCivilization(g.player) != CivilizationIndex("ENGLISH")) { Button(ID_WW_ENGLISH) { diplotracker = 5; buttontracker = 0; strDBIndex = GetStringDBIndex(ID_WW_ENGLISH); Message(g.player, 'SelectAmounttoGive'); Kill(); } Button(ID_WW_NEXT) { buttontracker = 5; Message(g.player, 'GiveSelect'); Kill(); } Button(ID_WW_BUTTON_CLOSE) { buttontracker = 0; Kill(); } } elseif(buttontracker == 4 && PlayerCivilization(g.player) == CivilizationIndex("ENGLISH")) {buttontracker = 5;} if(buttontracker == 5 && PlayerCivilization(g.player) != CivilizationIndex("CHINESE")) { Button(ID_WW_CHINA) { diplotracker = 6; buttontracker = 0; strDBIndex = GetStringDBIndex(ID_WW_CHINA); Message(g.player, 'SelectAmounttoGive'); Kill(); } Button(ID_WW_NEXT) { buttontracker = 6; Message(g.player, 'GiveSelect'); Kill(); } Button(ID_WW_BUTTON_CLOSE) { buttontracker = 0; Kill(); } } elseif(buttontracker == 5 && PlayerCivilization(g.player) == CivilizationIndex("CHINESE")) {buttontracker = 6;} if(buttontracker == 6 && PlayerCivilization(g.player) != CivilizationIndex("MEXICO")) { Button(ID_WW_MEXICANS) { diplotracker = 7; buttontracker = 0; strDBIndex = GetStringDBIndex(ID_WW_MEXICANS); Message(g.player, 'SelectAmounttoGive'); Kill(); } Button(ID_WW_NEXT) { buttontracker = 0; Message(g.player, 'GiveSelect'); Kill(); } Button(ID_WW_BUTTON_CLOSE) { buttontracker = 0; Kill(); } } elseif(buttontracker == 6 && PlayerCivilization(g.player) == CivilizationIndex("MEXICO")) {buttontracker = 0; } } //Chose amount to give country alertbox 'SelectAmounttoGive' { Text(ID_GIVE_AMOUNT); Button(ID_WW_BUTTON_CLOSE) { if(totalAmount > 0) { MessageAll('GiveMessage'); totalAmount = 0; } Kill(); } Button(ID_WW_BUTTON_TEN_OIL) { if(oilCount >= 10) { giveAmount = 10; totalAmount = totalAmount + giveAmount; Message(g.player, 'Give'); oilCount = oilCount - 10; Message(g.player, 'SetCivoilCount'); Message(g.player, 'SelectAmounttoGive'); Kill(); } else { Message(g.player, 'NotEnoughOil'); Kill(); } } Button(ID_WW_BUTTON_HUNDRED_OIL) { if(oilCount >= 100) { giveAmount = 100; totalAmount = totalAmount + giveAmount; Message(g.player, 'Give'); oilCount = oilCount - 100; Message(g.player, 'SetCivoilCount'); Message(g.player, 'SelectAmounttoGive'); Kill(); } else { Message(g.player, 'NotEnoughOil'); Kill(); } } } //Gives gift to Country messagebox 'Give' { Abort(); if(diplotracker == 1) { oGermany = oGermany + giveAmount; } elseif(diplotracker == 2) { oJapan = oJapan + giveAmount; } elseif(diplotracker == 3) { oRussia = oRussia + giveAmount; } elseif(diplotracker == 4) { oAmerica = oAmerica + giveAmount; } elseif(diplotracker == 5) { oEngland = oEngland + giveAmount; } elseif(diplotracker == 6) { oChina = oChina + giveAmount; } elseif(diplotracker == 7) { oMexico = oMexico + giveAmount; } } //Sends Message to everyone about the gift. messagebox 'GiveMessage' { SetStringbyDBIndex(2, strDBIndextwo); SetStringbyDBIndex(3, strDBindex); Text(ID_GIVE_ALERT); MessageType("EXCHANGE"); } //allows you to convert oil to pw alertbox 'PW' { Text(ID_CONVERT); Button(ID_WW_BUTTON_CLOSE) { Kill(); } Button(ID_WW_BUTTON_TEN_OIL) { if(oilCount >= 10) { SetPW(g.player, player.publicworkslevel + 10 * ConversionRate); oilCount = oilCount - 10; Message(g.player, 'SetCivoilCount'); Message(g.player, 'PW'); Kill(); } else { Message(g.player, 'NotEnoughOil'); Kill(); } } Button(ID_WW_BUTTON_HUNDRED_OIL) { if(oilCount >= 100) { SetPW(g.player, player.publicworkslevel + 100 * ConversionRate); oilCount = oilCount - 100; Message(g.player, 'SetCivoilCount'); Message(g.player, 'PW'); Kill(); } else { Message(g.player, 'NotEnoughOil'); Kill(); } } } //Not enough oil to convert/give alertbox 'NotEnoughOil' { Text(ID_NOTENOUGHOIL); Button(ID_WW_BUTTON_CLOSE) { Kill(); } } //maintanence message helpbox 'MAINTENANCE_A' { Text(ID_MAINTENANCE_A); OnClose { Message(g.player, 'MAINTENANCE_B'); } } //maintanence message helpbox 'MAINTENANCE_B' { Text(ID_MAINTENANCE_B); } //rates message helpbox 'RATES_A' { Text(ID_RATES_A); OnClose { Message(g.player, 'RATES_B'); } } //rates message helpbox 'RATES_B' { Text(ID_RATES_B); } //Calculates Maintanence Cost 'MaintenanceCost' messagebox 'MaintenanceCost' { Abort(); cTank = mRateTank * UnitCount(g.player, UnitType("UNIT_TANK")); cMobileSam = mRateMobileSame * UnitCount(g.player, UnitType("UNIT_MOBILE_SAM")); cFighter = mRateFighter * UnitCount(g.player, UnitType("UNIT_FIGHTER")); cSubmarine = mRateSubmarine * UnitCount(g.player, UnitType("UNIT_SUBMARINE")); cDestroyer = mRateDestroyer * UnitCount(g.player, UnitType("UNIT_DESTROYER")); cBattleship = mRateBattleShip * UnitCount(g.player, UnitType("UNIT_BATTLESHIP")); cAirCraftCarrier = mRateAirCraftCarrier * UnitCount(g.player, UnitType("UNIT_AIRCRAFT_CARRIER")); cNuke = mRateNuke * UnitCount(g.player, UnitType("UNIT_NUKE")); cTroopship = mRateTroopShip * UnitCount(g.player, UnitType("UNIT_TROOP_SHIP")); Maintenance_Cost = cTank + cMobileSam + cFighter + cSubmarine + cDestroyer + cBattleship + cAirCraftCarrier + cNuke + cTroopship; } //Counts number of Oil Resources and Refinaries duh ('OilResourceandRefinaryCount') messagebox 'OilResourceandRefinaryCount' { Abort(); aCity = 0; oilResource = 0; oilProduction = 0; refCount = 0; while(aCity < Cities(g.player)) { SetCityByIndex(1, g.player, aCity); oilResource = oilResource + CityCollectingGood(city.1,5); if(CityHasBuilding(city.1, "IMPROVE_OIL_REFINERY")) { refCount = refCount + 1; } aCity = aCity + 1; } //Message(g.player, 'Error'); oilProduction = oilValue * oilResource + refValue * refCount; } messagebox 'Error' { Text(ID_ERROR); } //Calculates oil each player has at beginning of their turn ('turnStartOil') messagebox 'turnStartOil' { Abort(); //Calculates total amount of fuel for each player at beginning of turn. oilCount = oilProduction - Maintenance_Cost; //Adds on stored value if(PlayerCivilization(g.player) == CivilizationIndex("AMERICANS")) { strDBindextwo = GetStringDBIndex(ID_WW_AMERICANS); oAmerica = oAmerica + oilCount; oilCount = oAmerica; } elseif(PlayerCivilization(g.player) == CivilizationIndex("GERMAN")) { strDBindextwo = GetStringDBIndex(ID_WW_GERMAN); oGermany = oGermany + oilCount; oilCount = oGermany; } elseif(PlayerCivilization(g.player) == CivilizationIndex("RUSSIAN")) { strDBindextwo = GetStringDBIndex(ID_WW_RUSSIANS); oRussia = oRussia + oilCount; oilCount = oRussia; } elseif(PlayerCivilization(g.player) == CivilizationIndex("MEXICO")) { strDBindextwo = GetStringDBIndex(ID_WW_MEXICANS); oMexico = oMexico + oilCount; oilCount = oMexico; } elseif(PlayerCivilization(g.player) == CivilizationIndex("ENGLISH")) { strDBindextwo = GetStringDBIndex(ID_WW_ENGLISH); oEngland = oEngland + oilCount; oilCount = oEngland; } elseif(PlayerCivilization(g.player) == CivilizationIndex("JAPANESE")) { strDBindextwo = GetStringDBIndex(ID_WW_JAPANESE); oJapan = oJapan + oilCount; oilCount = oJapan; } elseif(PlayerCivilization(g.player) == CivilizationIndex("CHINESE")) { strDBindextwo = GetStringDBIndex(ID_WW_CHINA); oChina = oChina + oilCount; oilCount = oChina; } } //Punishment for not having enough fuel at beginning of turn to cover Maintanence Costs ('BeginTurnPunishment') messagebox 'BeginTurnPunishment' { Abort(); aUnits = 0; manpunCount = 0; adder = 1; counter = 0; while(oilCount < oilReserve && counter < (player.totalunits * 10)) { SetUnitByIndex(1, g.player, aUnits); if(unit.type == UnitType("UNIT_TANK") || unit.type == UnitType("UNIT_MOBILE_SAM") || unit.type == UnitType("UNIT_NUKE") || unit.type == UnitType("UNIT_FIGHTER") || unit.type == UnitType("UNIT_SUBMARINE") || unit.type == UnitType("UNIT_DESTROYER") || unit.type == UnitType("UNIT_BATTLESHIP") || unit.type == UnitType("UNIT_AIRCRAFT_CARRIER") || unit.type == UnitType("UNIT_TROOP_SHIP")) { DamageUnit(unit.1, Random(2)); AddMovement(unit.1, -100); oilCount = oilCount + 1; manpunCount = manpunCount + adder; } counter = counter + 1; aUnits = aUnits + 1; if(aUnits == (player.totalunits - 1)) { aUnits = 0; adder = 0; } } if(manpunCount > 0) { Message(g.player,'MaintanencePunishmentMessage'); } //Adds Punishment oil to country variable Message(g.player, 'SetCivoilCount'); } //Sets oilCount to Civs Count messagebox 'SetCivoilCount' { Abort(); if(PlayerCivilization(g.player) == CivilizationIndex("AMERICANS")) { oAmerica = oilCount; } elseif(PlayerCivilization(g.player) == CivilizationIndex("GERMAN")) { oGermany = oilCount; } elseif(PlayerCivilization(g.player) == CivilizationIndex("RUSSIAN")) { oRussia = oilCount; } elseif(PlayerCivilization(g.player) == CivilizationIndex("MEXICO")) { oMexico = oilCount; } elseif(PlayerCivilization(g.player) == CivilizationIndex("ENGLISH")) { oEngland = oilCount; } elseif(PlayerCivilization(g.player) == CivilizationIndex("JAPANESE")) { oJapan = oilCount; } elseif(PlayerCivilization(g.player) == CivilizationIndex("CHINESE")) { oChina = oilCount; } } //Punishment for running out of fuel midturn ('MidTurnPunishmen') messagebox 'MidTurnPunishment' { Abort(); //No more oil? Then no more move for you! if(oilCount < 1 && check == 0) { aUnits = 0; while(aUnits < player.totalunits) { SetUnitByIndex(1, g.player, aUnits); if(unit.type == UnitType("UNIT_TANK") || unit.type == UnitType("UNIT_MOBILE_SAM") || unit.type == UnitType("UNIT_NUKE") || unit.type == UnitType("UNIT_FIGHTER") || unit.type == UnitType("UNIT_SUBMARINE") || unit.type == UnitType("UNIT_DESTROYER") || unit.type == UnitType("UNIT_BATTLESHIP") || unit.type == UnitType("UNIT_AIRCRAFT_CARRIER") || unit.type == UnitType("UNIT_TROOP_SHIP")) { AddMovement(unit.1, -10000); SetOrder(1, 10); AddOrder(unit.1, unit.location); //Sets Movement to 0 CatchUp(); } aUnits = aUnits + 1; } check = 1; } } //Subtracts fuel for moving ('SubtractFuel') messagebox 'SubtractFuel' { Abort(); if(PlayerCivilization(g.player) == CivilizationIndex("AMERICANS")) { oAmerica = oAmerica - burnRate; oilCount = oAmerica; if(oAmerica < 1) { oAmerica = 0; //Negative numbers are bad. } } elseif(PlayerCivilization(g.player) == CivilizationIndex("GERMAN")) { oGermany = oGermany - burnRate; oilCount = oGermany; if(oGermany < 1) { oGermany = 0; //Negative numbers are bad. } } elseif(PlayerCivilization(g.player) == CivilizationIndex("RUSSIAN")) { oRussia = oRussia - burnRate; oilCount = oRussia; if(oRussia < 1) { oRussia = 0; //Negative numbers are bad. } } elseif(PlayerCivilization(g.player) == CivilizationIndex("MEXICO")) { oMexico = oMexico - burnRate; oilCount = oMexico; if(oMexico < 1) { oMexico = 0; //Negative numbers are bad. } } elseif(PlayerCivilization(g.player) == CivilizationIndex("ENGLISH")) { oEngland = oEngland - burnRate; oilCount = oEngland; if(oEngland < 1) { oEngland = 0; //Negative numbers are bad. } } elseif(PlayerCivilization(g.player) == CivilizationIndex("JAPANESE")) { oJapanese = oJapanese - burnRate; oilCount = oJapanese; if(oJapanese < 1) { oJapanese = 0; //Negative numbers are bad. } } elseif(PlayerCivilization(g.player) == CivilizationIndex("CHINESE")) { oChinese = oChinese - burnRate; oilCount = oChinese; if(oChinese < 1) { oChinese = 0; //Negative numbers are bad. } } } //Gets unit type and its burnRate ('BurnRate') messagebox 'UnitTypeBurnRate' { Abort(); //Gets unit type and its burnRate if(unit.type == UnitType("UNIT_TANK")){ burnRate = bRateTank; } elseif(unit.type == UnitType("UNIT_MOBILE_SAM")){ burnRate = bRateMobileSam; } elseif(unit.type == UnitType("UNIT_NUKE")){ burnRate = bRateNuke; } elseif(unit.type == UnitType("UNIT_FIGHTER")){ burnRate = bRateFighter; } elseif(unit.type == UnitType("UNIT_SUBMARINE")){ burnRate = bRateSubmarine; } elseif(unit.type == UnitType("UNIT_DESTROYER")){ burnRate = bRateDestroyer; } elseif(unit.type == UnitType("UNIT_BATTLESHIP")){ burnRate = bRateBattleShip; } elseif(unit.type == UnitType("UNIT_AIRCRAFT_CARRIER")){ burnRate = bRateAirCraftCarrier; } elseif(unit.type == UnitType("UNIT_TROOP_SHIP")){ burnRate = bRateTroopShip; } } //****************END**********************