//// Improved 'Sell up the river mod' code //// // Original Author: The Big Mc // Last Edited by: Locutus (aka Wouter Snijders) Date: 2001-12-11 // // // // Comments: // - Works in Multiplayer asm well (because of 'IsHumanPlayer' check instead of '1') // - Works for AI as well as human player // - Only makes offer to original owner of city, which isn't always the human player (because of extra LOQ_oldCityOwner variable) // - Problem: currently doesn't work for human if more than 1 city is captured in 1 turn; // Solution: use an 'OldCities' array to store all conquered cities, ala (left open due to lack of time) // - Should give city back immediately after capture, not 1 turn later (because of extra LOQ_capturedCity variable) city_t LOQ_capturedCity; // the city that was captured int_t LOQ_oldCityOwner; // used to store the original owner of the city int_t LOQ_amount; // store price for which city should be sold // when a city is captured, store old owner HandleEvent(CaptureCity) 'LOQ_BarbCaptureCityPre' pre { LOQ_capturedCity = city[0]; LOQ_oldCityOwner = city[0].owner; } // when a city is captured by barbs, offer to sell it back HandleEvent(CaptureCity) 'LOQ_BarbCaptureCityPost' post { LOQ_amount = LOQ_capturedCity.population * 1000; // in original version 6000, I like this better if (LOQ_capturedCity.owner = 0) { // if barbarians captured it if (IsHumanPlayer(LOQ_oldCityOwner) { // for human players, give option to buy city back Message(LOQ_oldCityOwner, 'LOQ_WantItBack_Q'); } else { // for AI players, buy city back if funds available if (PlayerGold(LOQ_oldCityOwner) >= LOQ_amount) { AddGold(LOQ_oldCItyOwner, (-1 * LOQ_amount)); Event:GiveCity(LOQ_capturedCity, LOQ_oldCityOwner); } } } } AlertBox 'LOQ_WantItBack_Q' { Show(): Text(ID_LOQ_WANT_IT_BACK_Q); Button(DI_LOQ_BUTTON_NO) { // "I don't want it!" Kill(); Message(LOQ_oldCityOwner, 'LOQ_DontNeedScum'); } Button(ID_LOQ_BUTTON_YESWW) { // "Gimme, gimme, gimme!" Kill(); if (PlayerGold(LOQ_oldCityOwner) >= LOQ_amount) { // if funds available AddGold(1, -6000); Event:GiveCity(LOQ_capturedCity, LOQ_oldCityOwner); Message(1, 'LOQ_ItsAllYours'); } else { Message(1, 'LOQ_NoCashNoGlory'); } } } AlertBox 'LOQ_ItsAllYOurs' { Show(); Text(ID_LOQ_ITS_ALL_YOURS); Button(ID_LOQ_BUTTON_OK) { Kill(); } } AlertBox 'LOQ_DontNeedScum' { Show(); Text(ID_LOQ_DONT_NEED_SCUM); Button(ID_LOQ_BUTTON_OK) { Kill(); } } AlertBox 'LOQ_NoCashNoGlory' { Show(); Text(ID_LOQ_NO_CASH_NO_GLORY); Button(ID_LOQ_BUTTON_OK) { Kill(); } } // Section that should go in scen_str.txt (don't forget to remove the '//'s!): // #### Button text // LOQ_BUTTON_OK "OK" // LOQ_BUTTON_NO "No" // LOQ_BUTTON_YESWW "yes we will" // // #### Message box text // // LOQ_WANT_IT_BACK_Q " A Big barbarian has delived a massage to you and left he said that they recintly captured the city of {city[0].name} and are scared they will soon be taken over they will give {city[0].name} to you for 6000 gold and safe pasage out of your lands." // LOQ_ITS_ALL_YOURS "Reports from {city[0].name} say that the Barberians have left it will take a bit for your staff to get to the city and protect it." // LOQ_NO_CASH_NO_GLORY "you do not have the money to keep you end of the bargin the Barberians are not impresed but they will keep the ofer open." // LOQ_DONT_NEED_SCUM "We don't need scum like that you say as you kick the Barberian out of your city."