Okay, so like I finally got around to pulling this old game out from under a layer of dust and started to look at this huge mod I was working on a couple years ago...
Anyway, I found this SLIC code I did and thought someone might like to use it, as I haven't really seen anything like it here before. But I haven't been around much, so maybe I missed it?
This first one deals with unit upgrades. It allows you to pay gold to upgrade one or all of your units when you get the right techs:
Generic replace function:
example trigger:
I can post the whole file if anyone's interested, but it's fairly customized to my mod. I do have a version w/out the different civ types though.
Let me know if you see any errors I remember there being two issues with this: 1) I can't remember exactly, 2) It only works on the host server pc in multiplayer.
The next one is really simple. It just adds to the city size when a new one is built after arcologies is discovered:
The next script deals with having different units for different types of civilizations (ie: african, european, asian...). What I did here was I created a bunch of different advances to define each civilization type, and assigned them to the actual civs:
And then you can add certain units to each civ like this:
All I did was add a new tech for each unit, and only allow it when you have the prerequisite tech. The units are only altered (for now) in appearance in my mod. I just couldn't stand the thought of samurai in England and Hoplites in China.
Again, let me know if you see any errors/things I could've done better here. The civ type script concept here has just one major problem: The AI likes to trade the civ type techs! So Japan and Turkey will trade and then turkey can build samurai. Bah.
If I get enough feedback, I could post my mod, but it's fricken huge (like 100+ MB I think), because I added so many new techs, units, improvements (like space/undersea only ones), AI, sprites and library entries, all on top of Celestial Dawn's mod.
Hope these scripts are some help.
L8r.
Anyway, I found this SLIC code I did and thought someone might like to use it, as I haven't really seen anything like it here before. But I haven't been around much, so maybe I missed it?
This first one deals with unit upgrades. It allows you to pay gold to upgrade one or all of your units when you get the right techs:
Generic replace function:
Code:
messagebox 'msgReplaceUnits' { Title(ID_TITLE_upgrade_query); MessageType("TP_QUEUE_EMPTY_AFTER_UNIT"); MessageClass(789); i = 0; onecost = 0; oldunitcount = 0; while (i < player.totalunits) { SetUnitByIndex(1, g.player, i); if (unit.type == oldunittype) { oldunitcount = oldunitcount + 1; } i = i + 1; } if(oldunitcount>0) { onecost = (newunitcost) - (oldunitcost); if (onecost <= player.gold) { KillClass(g.player,987); MessageClass(987); privoldunittype=oldunittype; privnewunittype=newunittype; privoldunitcost=oldunitcost; privnewunitcost=newunitcost; privtotalcost = (privnewunitcost*oldunitcount) - (privoldunitcost*oldunitcount); privonecost = privnewunitcost - privoldunitcost; if (privtotalcost <= player.gold && oldunitcount>1) { Button(ID_BUTTON_Do_upgrade) { AddGold(player, -privtotalcost); i = 0; while (i < player.totalunits) { SetUnitByIndex(1, player, i); if (unit.type == privoldunittype) { oldunitlocation = unit.location; // KillUnit(unit.1); SetOrder(1, 56); AddOrder(unit, oldunitlocation); CreateUnit(player, privnewunittype, oldunitlocation, 0); } else { i = i + 1; } } KillClass(g.player, 987); } } Button(ID_BUTTON_Do_one_upgrade) { AddGold(player, -privonecost); i = 0; while (i < player.totalunits) { SetUnitByIndex(1, g.player, i); if (unit.type == privoldunittype) { oldunitlocation = unit.location; SetOrder(1, 56); AddOrder(unit, oldunitlocation); CreateUnit(player, privnewunittype, oldunitlocation, 0); // KillUnit(unit.1); KillClass(player, 987); message(g.player,'msgReplaceUnits'); } else { i = i + 1; } } } Button(ID_BUTTON_LibraryNew) { LibraryUnit(privnewunittype); } Button(ID_BUTTON_LibraryOld) { LibraryUnit(privoldunittype); } if (oldunitcount>1) { Text(ID_TEXT_upgrade_query); } else { Text(ID_TEXT_upgrade_one_query); } } else { Abort(); } } else { Abort(); } }
Code:
trigger 'IronWorking_trigReplaceUnits' when (HasAdvance(g.player, ID_ADVANCE_IRON_WORKING) ) { if(HasAdvance(g.player, ID_ADVANCE_EUROPEAN_CIV)) { oldunittype = UnitType("UNIT_WARRIOR"); newunittype = UnitType("UNIT_LEGION"); oldunitcost = 100; newunitcost = 300; SetString(0,ID_UNIT_WARRIOR); SetString(1,ID_UNIT_LEGION); message(g.player,'msgReplaceUnits'); oldunittype = UnitType("UNIT_SWORDSMAN"); newunittype = UnitType("UNIT_LEGION"); oldunitcost = 100; newunitcost = 300; SetString(0,ID_UNIT_SWORDSMAN); SetString(1,ID_UNIT_LEGION); message(g.player,'msgReplaceUnits'); } if(HasAdvance(g.player, ID_ADVANCE_AFRICAN_CIV)) { oldunittype = UnitType("UNIT_WARRIOR"); newunittype = UnitType("UNIT_LEGION"); oldunitcost = 100; newunitcost = 300; SetString(0,ID_UNIT_WARRIOR); SetString(1,ID_UNIT_LEGION); message(g.player,'msgReplaceUnits'); oldunittype = UnitType("UNIT_SWORDSMAN"); newunittype = UnitType("UNIT_LEGION"); oldunitcost = 100; newunitcost = 300; SetString(0,ID_UNIT_SWORDSMAN); SetString(1,ID_UNIT_LEGION); message(g.player,'msgReplaceUnits'); } if(HasAdvance(g.player, ID_ADVANCE_EASTERN_CIV)) { oldunittype = UnitType("UNIT_WARRIOR"); newunittype = UnitType("UNIT_LEGION"); oldunitcost = 100; newunitcost = 300; SetString(0,ID_UNIT_WARRIOR); SetString(1,ID_UNIT_LEGION); message(g.player,'msgReplaceUnits'); oldunittype = UnitType("UNIT_SWORDSMAN"); newunittype = UnitType("UNIT_LEGION"); oldunitcost = 100; newunitcost = 300; SetString(0,ID_UNIT_SWORDSMAN); SetString(1,ID_UNIT_LEGION); message(g.player,'msgReplaceUnits'); } if(HasAdvance(g.player, ID_ADVANCE_NATIVE_CIV)) { oldunittype = UnitType("UNIT_WARRIOR"); newunittype = UnitType("UNIT_BERSERKER"); oldunitcost = 100; newunitcost = 300; SetString(0,ID_UNIT_WARRIOR); SetString(1,ID_UNIT_BERSERKER); message(g.player,'msgReplaceUnits'); oldunittype = UnitType("UNIT_SWORDSMAN"); newunittype = UnitType("UNIT_BERSERKER"); oldunitcost = 100; newunitcost = 300; SetString(0,ID_UNIT_SWORDSMAN); SetString(1,ID_UNIT_BERSERKER); message(g.player,'msgReplaceUnits'); } if(HasAdvance(g.player, ID_ADVANCE_WESTERN_CIV)) { oldunittype = UnitType("UNIT_WARRIOR"); newunittype = UnitType("UNIT_BERSERKER"); oldunitcost = 100; newunitcost = 300; SetString(0,ID_UNIT_WARRIOR); SetString(1,ID_UNIT_BERSERKER); message(g.player,'msgReplaceUnits'); oldunittype = UnitType("UNIT_SWORDSMAN"); newunittype = UnitType("UNIT_BERSERKER"); oldunitcost = 100; newunitcost = 300; SetString(0,ID_UNIT_SWORDSMAN); SetString(1,ID_UNIT_BERSERKER); message(g.player,'msgReplaceUnits'); } if(HasAdvance(g.player, ID_ADVANCE_ASIAN_CIV)) { oldunittype = UnitType("UNIT_WARRIOR"); newunittype = UnitType("UNIT_SAMURAI"); oldunitcost = 100; newunitcost = 300; SetString(0,ID_UNIT_WARRIOR); SetString(1,ID_UNIT_SAMURAI); message(g.player,'msgReplaceUnits'); oldunittype = UnitType("UNIT_SWORDSMAN"); newunittype = UnitType("UNIT_SAMURAI"); oldunitcost = 100; newunitcost = 300; SetString(0,ID_UNIT_SWORDSMAN); SetString(1,ID_UNIT_SAMURAI); message(g.player,'msgReplaceUnits'); } }
Let me know if you see any errors I remember there being two issues with this: 1) I can't remember exactly, 2) It only works on the host server pc in multiplayer.
The next one is really simple. It just adds to the city size when a new one is built after arcologies is discovered:
Code:
trigger 'GrowCity' when (city.built) { if (HasAdvance(g.player, ID_ADVANCE_ARCOLOGIES) ) { if (IsUnderseaCity(city) ) { AddPops(city,3); } // terraintype 13 = space - done this way because isspacecity function is broken elseif (TerrainType(city.location) == 13 ) { AddPops(city,1); } else { AddPops(city,5); } } }
Code:
trigger 'trigStartUpCiv' when ((g.year == 0) && (IsPlayerAlive(g.player))) { Message(g.player, 'msgStartUpCiv'); } messagebox 'msgStartUpCiv' { //civtype 0 = None - barbarian //civtype 1 = Native Indian - sioux, iroquois //civtype 2 = European - greek, russian, spanish, portugese, roman, phoenician, byzantine, italian //civtype 3 = Western/Eurpoean 2 - american, scottish, english, german, french, dutch, vikings, turkish, celtic, austrian, hungarian, swedish //civtype 4 = Asian - japanese, chinese, thai, polynesian, indonesian, korean, mongolian //civtype 5 = African/South American - zulu, mayan, incan, aztec, brazilian, mexican, ethiopian, bantu //civtype 6 = Middle Eastern - Arabian, persian, egyptian, hebrew, indian, assyrian nativeciv=177; europeanciv=178; africanciv=179; asianciv=180; easternciv=181; westernciv=182; //civtype 0 = None - barbarian if(PlayerCivilization(g.player) == CivilizationIndex("BARBARIAN")) { GrantAdvance(g.player,westernciv); GrantAdvance(g.player,easternciv); GrantAdvance(g.player,asianciv); GrantAdvance(g.player,nativeciv); GrantAdvance(g.player,africanciv); GrantAdvance(g.player,europeanciv); } //civtype 1 = Native Indian - sioux, iroquois if(PlayerCivilization(g.player) == CivilizationIndex("SIOUX")) { GrantAdvance(g.player,nativeciv); } if(PlayerCivilization(g.player) == CivilizationIndex("IROQUOIS")) { GrantAdvance(g.player,nativeciv); } //civtype 2 = European - greek, russian, spanish, portugese, roman, phoenician, byzantine, italian if(PlayerCivilization(g.player) == CivilizationIndex("GREEK")) { GrantAdvance(g.player,europeanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("RUSSIAN")) { GrantAdvance(g.player,europeanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("ITALIAN")) { GrantAdvance(g.player,europeanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("ROMAN")) { GrantAdvance(g.player,europeanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("PHOENICIAN")) { GrantAdvance(g.player,europeanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("BYZANTINE")) { GrantAdvance(g.player,europeanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("SPANISH")) { GrantAdvance(g.player,europeanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("BYZANTINE")) { GrantAdvance(g.player,europeanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("PORTUGUESE")) { GrantAdvance(g.player,europeanciv); } //civtype 3 = Western/Eurpoean 2 - american, scottish, english, german, french, dutch, vikings, turkish, celtic, austrian, hungarian, swedish if(PlayerCivilization(g.player) == CivilizationIndex("AMERICANS")) { GrantAdvance(g.player,westernciv); } if(PlayerCivilization(g.player) == CivilizationIndex("SCOTTISH")) { GrantAdvance(g.player,westernciv); } if(PlayerCivilization(g.player) == CivilizationIndex("SLAVIC")) { GrantAdvance(g.player,westernciv); } if(PlayerCivilization(g.player) == CivilizationIndex("ENGLISH")) { GrantAdvance(g.player,westernciv); } if(PlayerCivilization(g.player) == CivilizationIndex("GERMAN")) { GrantAdvance(g.player,westernciv); } if(PlayerCivilization(g.player) == CivilizationIndex("FRENCH")) { GrantAdvance(g.player,westernciv); } if(PlayerCivilization(g.player) == CivilizationIndex("DUTCH")) { GrantAdvance(g.player,westernciv); } if(PlayerCivilization(g.player) == CivilizationIndex("VIKING")) { GrantAdvance(g.player,westernciv); } if(PlayerCivilization(g.player) == CivilizationIndex("TURKISH")) { GrantAdvance(g.player,westernciv); } if(PlayerCivilization(g.player) == CivilizationIndex("CELTIC")) { GrantAdvance(g.player,westernciv); } if(PlayerCivilization(g.player) == CivilizationIndex("AUSTRIAN")) { GrantAdvance(g.player,westernciv); } if(PlayerCivilization(g.player) == CivilizationIndex("HUNGARIAN")) { GrantAdvance(g.player,westernciv); } if(PlayerCivilization(g.player) == CivilizationIndex("SWEDISH")) { GrantAdvance(g.player,westernciv); } //civtype 4 = Asian - japanese, chinese, thai, polynesian, indonesian, korean, mongolian if(PlayerCivilization(g.player) == CivilizationIndex("JAPANESE")) { GrantAdvance(g.player,asianciv); } if(PlayerCivilization(g.player) == CivilizationIndex("CHINESE")) { GrantAdvance(g.player,asianciv); } if(PlayerCivilization(g.player) == CivilizationIndex("THAI")) { GrantAdvance(g.player,asianciv); } if(PlayerCivilization(g.player) == CivilizationIndex("POLYNESIAN")) { GrantAdvance(g.player,asianciv); } if(PlayerCivilization(g.player) == CivilizationIndex("INDONESIAN")) { GrantAdvance(g.player,asianciv); } if(PlayerCivilization(g.player) == CivilizationIndex("KOREAN")) { GrantAdvance(g.player,asianciv); } if(PlayerCivilization(g.player) == CivilizationIndex("MONGOL")) { GrantAdvance(g.player,asianciv); } //civtype 5 = African/South American - zulu, mayan, incan, aztec, brazilian, mexican, ethiopian, bantu if(PlayerCivilization(g.player) == CivilizationIndex("ZULU")) { GrantAdvance(g.player,africanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("MAYAN")) { GrantAdvance(g.player,africanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("INCAN")) { GrantAdvance(g.player,africanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("AZTEC")) { GrantAdvance(g.player,africanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("BRAZILIAN")) { GrantAdvance(g.player,africanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("MEXICAN")) { GrantAdvance(g.player,africanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("ETHIOPIAN")) { GrantAdvance(g.player,africanciv); } if(PlayerCivilization(g.player) == CivilizationIndex("BANTU")) { GrantAdvance(g.player,africanciv); } //civtype 6 = Middle Eastern - Arabian, persian, egyptian, hebrew, indian, assyrian if(PlayerCivilization(g.player) == CivilizationIndex("ARABIAN")) { GrantAdvance(g.player,easternciv); } if(PlayerCivilization(g.player) == CivilizationIndex("PERSIAN")) { GrantAdvance(g.player,easternciv); } if(PlayerCivilization(g.player) == CivilizationIndex("EGYPTIAN")) { GrantAdvance(g.player,easternciv); } if(PlayerCivilization(g.player) == CivilizationIndex("HEBREW")) { GrantAdvance(g.player,easternciv); } if(PlayerCivilization(g.player) == CivilizationIndex("INDIAN")) { GrantAdvance(g.player,easternciv); } if(PlayerCivilization(g.player) == CivilizationIndex("ASSYRIAN")) { GrantAdvance(g.player,easternciv); } //advance #'s zuluspearman=165; zuluwarrior=166; phalanx=167; warrior=168; swordsman=169; spearman=170; legion=171; samurai=172; berserker=173; espearman=174; slinger=175; archer=176; toolmaking=2; ironworking=11; bronzeworking=5; warriorcode=164; //civtype 0 = None - barbarian //civtype 1 = Native Indian - sioux, iroquois //civtype 2 = European - greek, russian, spanish, portugese, roman, phoenician, byzantine, italian //civtype 3 = Western/Eurpoean 2 - american, scottish, english, german, french, dutch, vikings, turkish, celtic, austrian, hungarian, swedish //civtype 4 = Asian - japanese, chinese, thai, polynesian, indonesian, korean, mongolian //civtype 5 = African/South American - zulu, mayan, incan, aztec, brazilian, mexican, ethiopian, bantu //civtype 6 = Middle Eastern - Arabian, persian, egyptian, hebrew, indian, assyrian //0: CTP1 warrior, Spearman, Mounted Archer, Archer, Chariot, Elephant, Samurai, Legion, Pikeman, Knight, Crusader, Horse Archer, Cavalry, Musketeers.... //1: CTP1 warrior, Spearman, Mounted Archer, Archer, Chariot, Elephant, Berserker, Pikeman, Horse Archer //2: Swordsman, Phalanx, Mounted Archer, Archer, Chariot, Elephant, Legion, Pikeman, Knight //3: Swordsman, Spearman, Mounted Archer, Archer, Chariot, Elephant, Berserker, Pikeman, Knight //4: Swordsman, Spearman, Mounted Archer, Archer, Chariot, Elephant, Samurai, Pikeman, Horse Archer //5: CTP1 Warrior, Zulu Phalanx, Mounted Archer, Zulu Spearman, Chariot, Elephant, Legion, Pikeman, Light Cavalry //6: Swordsman, Egyptian Spearman, Mounted Archer, Slinger, Chariot, Elephant, Legion, Pikeman, Light Cavalry Abort(); }
Code:
trigger 'Toolmaking_trigGiveAdvance' when (HasAdvance(g.player, ID_ADVANCE_TOOLMAKING)) { if(HasAdvance(g.player, ID_ADVANCE_NATIVE_CIV)){ GrantAdvance(g.player, warrior); } if(HasAdvance(g.player, ID_ADVANCE_EUROPEAN_CIV)){ GrantAdvance(g.player,swordsman); } if(HasAdvance(g.player, ID_ADVANCE_WESTERN_CIV)){ GrantAdvance(g.player,swordsman); } if(HasAdvance(g.player, ID_ADVANCE_ASIAN_CIV)){ GrantAdvance(g.player,swordsman); } if(HasAdvance(g.player, ID_ADVANCE_AFRICAN_CIV)){ GrantAdvance(g.player,warrior); } if(HasAdvance(g.player, ID_ADVANCE_EASTERN_CIV)){ GrantAdvance(g.player,swordsman); } }
Again, let me know if you see any errors/things I could've done better here. The civ type script concept here has just one major problem: The AI likes to trade the civ type techs! So Japan and Turkey will trade and then turkey can build samurai. Bah.
If I get enough feedback, I could post my mod, but it's fricken huge (like 100+ MB I think), because I added so many new techs, units, improvements (like space/undersea only ones), AI, sprites and library entries, all on top of Celestial Dawn's mod.
Hope these scripts are some help.
L8r.
Comment