 |
|  |
 |
|
BureauBert
|
 |
Vienna, Europe
Apr 2003 time: 06:28
|
|
Hi ískallin!
This is a quick reply concerning the pillbox/barbed-wire question, since I already implemented them to my own mod-in-progress:
Look into the /Scenarios/WW2_something(?)/scenario0000 or /scenario0001 folder (they contain basically the same files with just some different scenario-events).
Find the graphics/sprite-files:
If you have installed the Activision-scen. the tileimps for both the pillbox and the barbed wire are in the TileFile - I am not sure if the original TileFile already contains them.
For the BARBED WIRE you only need the according *.tga's in graphics/pictures (unfortunately I actually haven't installed the Acti-Scen and therefore I can't tell you the numbers - but as far as I remember they included a list to be found in the /sprites-folder). For the BARBED WIRE you will have to find THREE files named like
UPTIxxx.tga
UPTIxxxD.tga
UPTIxxxL.tga
For the PILLBOX you will need the pictures for both the pillbox-ti and the pillbox-unit - something like:
UPTIxxx.tga
UPTIxxxD.tga
UPTIxxxL.tga
AND
UPUPxxxa.tga
UPUPxxxb.tga
and ADDITIONALLY
the pillbox-sprite:
GUxxx.spr
Next you will have to copy the PILLBOX-unit from the scenario's units.txt to your MOD_units.txt.
SPECIAL ISSUE: The pillboxes work by creating a pillbox-unit on the pillbox-tileimp when a defined unit-type moves to the tileimp. As the script doesen't care for the owner of tileimp/unit (yet? - I am thinking but nor actually working on it), the pillboxes can be 'activated' by anyone. IF you use the 'auto-withdraw'-function in diplomod.slc this results in expelled enemy's pillbox-units spread over the enemy's territory, doing nothing and impossible to disband. My temporary solution is providing a special border-guard-unit as a 'pillbox-garrison' (I took the green machinegunner from the same scenario), that won't be built by the AI (which doesen't really matter since we haven't yet and possibly will be unable to teach the AI how to use the pillboxes properly).
If you want to stick with this solution you will also have to provide some 'pillbox-garrison-unit' in your MOD_units.txt and NOT provide it to the AI in their unitbuildlist.txt.
NEWSPRITES: According entry in your MOD_newsprite.txt for the pillbox needed.
TILEIMPS: You will also have to copy the pillbox & barbed wire-entries from the scenario's tileimp.txt to your MOD_tileimp.txt.
Apart from adding some entries to the Great Library and some other textfiles (have a look at the Activision-files again), the main thing will be the following SLIC:
PHP:
/////////////////////////////////////////////////
// Script for the Invasion of France scenario //
// last update 12-19-00 by Tony Evans //
/////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
//adapted for MoT_Mod 20-Apr-2003: //
// //
// //
//Note 01-June-2003: Check for Airplanes (barbed wire) now performed by //
//IsAirUnit (MG's UnitCheckers from GoodMod) in aihelpers.slc. //
////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
// Zeroes out movements points from any land units that move onto Barbed Wire
//-----------------------------------------------------------------------------
HandleEvent(MoveUnits) 'WWBarbedWireMove_F' post {
location_t tmpLoc;
army_t tmpArmy;
unit_t tmpUnit;
int_t numUnits;
int_t checkUnit;
int_t i;
tmpLoc = location[1]; // destination location
if (TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_BARBED_WIRE))) {
tmpArmy = army[0];
numUnits = tmpArmy.size;
for(i = 0; i < numUnits; i = i + 1) {
GetUnitFromArmy(tmpArmy, i, tmpUnit);
checkUnit = tmpUnit;
if (!IsAirUnit(tmpUnit)) { // if unit is not an airplane
AddMovement(tmpUnit, -1000); // subtract any remaining movement points
}
}
}
}
//-----------------------------------------------------------------------------------
// Creates/Removes Pillbox unit when Infantry moves on/off a Pillbox Tile Improvement
//-------------------------------------------------------------------------------------
HandleEvent(MoveUnits) 'WWActivatePillbox_F' post {
location_t tmpLoc;
location_t tmpLoc2;
army_t tmpArmy;
unit_t tmpUnit;
unit_t pillboxUnit;
int_t numUnits;
int_t unitType;
int_t foundInfantry;
int_t foundPillbox;
int_t infantryLeft;
int_t i;
tmpLoc = location[0]; // start location
tmpLoc2 = location[1]; // destination location
foundInfantry = 0;
foundPillbox = 0;
infantryLeft = 0;
tmpArmy = army[0];
// If the tile left has a Pillbox and no other Infantry remain, kill the Pillbox unit
if (TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_PILLBOX))) {
numUnits = tmpArmy.size;
for(i = 0; i < numUnits; i = i + 1) {
GetUnitFromArmy(tmpArmy, i, tmpUnit);
unitType = tmpUnit.type;
if (unitType == UnitDB(UNIT_BORDER_GUARD)) { // if unit is Border Guard
infantryLeft = 1;
}
}
if (infantryLeft == 1) {
numUnits = GetUnitsAtLocation(tmpLoc);
for (i = 0; i < numUnits; i = i + 1) {
GetUnitFromCell(tmpLoc, i, tmpUnit);
unitType = tmpUnit.type;
if (unitType == UnitDB(UNIT_BORDER_GUARD)) { // if unit is Border Guard
foundInfantry = 1;
} elseif (unitType == UnitDB(PILLBOX)) {
pillboxUnit = tmpUnit;
}
}
if (foundInfantry == 0 && pillboxUnit.valid) {
KillUnit(pillboxUnit);
}
}
}
// If the destination tile has a Pillbox and doesn't have a Pillbox unit, create one
if (TileHasImprovement(tmpLoc2, TerrainImprovementDB(TILEIMP_PILLBOX))) {
numUnits = tmpArmy.size;
if (numUnits == 12) {
return CONTINUE;
}
for(i = 0; i < numUnits; i = i + 1) {
GetUnitFromArmy(tmpArmy, i, tmpUnit);
unitType = tmpUnit.type;
if (unitType == UnitDB(UNIT_BORDER_GUARD)) { // if unit is Border Guard
foundInfantry = 1;
}
}
if (foundInfantry == 1) {
numUnits = GetUnitsAtLocation(tmpLoc2);
for (i = 0; i < numUnits; i = i + 1) {
GetUnitFromCell(tmpLoc2, i, tmpUnit);
unitType = tmpUnit.type;
if (unitType == UnitDB(PILLBOX)) { // if unit is a Pillbox
return CONTINUE;
}
}
CreateUnit(tmpArmy.owner, UnitDB(PILLBOX), tmpLoc2, 0);
}
}
}
HandleEvent(MoveIntoTransport) 'WWPillboxTransport_F' pre {
location_t tmpLoc;
army_t tmpArmy;
unit_t tmpUnit;
unit_t pillboxUnit;
int_t numUnits;
int_t unitType;
int_t foundInfantry;
int_t foundPillbox;
int_t infantryLeft;
int_t i;
tmpArmy = army[0];
if (ArmyIsValid(tmpArmy)) {
tmpLoc = tmpArmy.location;
foundInfantry = 0;
foundPillbox = 0;
infantryLeft = 0;
// If the tile left has a Pillbox and no other Infantry remain, kill the Pillbox unit
if (TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_PILLBOX))) {
numUnits = tmpArmy.size;
for(i = 0; i < numUnits; i = i + 1) {
GetUnitFromArmy(tmpArmy, i, tmpUnit);
unitType = tmpUnit.type;
if (unitType == UnitDB(UNIT_BORDER_GUARD)) { // if unit is Border Guard
infantryLeft = infantryLeft + 1;
}
}
if (infantryLeft >= 1) {
numUnits = GetUnitsAtLocation(tmpLoc);
for (i = 0; i < numUnits; i = i + 1) {
GetUnitFromCell(tmpLoc, i, tmpUnit);
unitType = tmpUnit.type;
if (unitType == UnitDB(UNIT_BORDER_GUARD)) { // if unit is Border Guard
foundInfantry = foundInfantry + 1;
} elseif (unitType == UnitDB(PILLBOX)) {
pillboxUnit = tmpUnit;
}
}
foundInfantry = foundInfantry - infantryLeft;
if (foundInfantry == 0 && pillboxUnit.valid) {
KillUnit(pillboxUnit);
}
}
}
}
}
HandleEvent(BoardTransportOrder) 'WWPillboxBoard_F' pre {
location_t tmpLoc;
army_t tmpArmy;
unit_t tmpUnit;
unit_t pillboxUnit;
int_t numUnits;
int_t unitType;
int_t foundInfantry;
int_t foundPillbox;
int_t infantryLeft;
int_t i;
tmpArmy = army[0];
if (ArmyIsValid(tmpArmy)) {
tmpLoc = tmpArmy.location;
foundInfantry = 0;
foundPillbox = 0;
infantryLeft = 0;
// If the tile left has a Pillbox and no other Infantry remain, kill the Pillbox unit
if (TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_PILLBOX))) {
numUnits = tmpArmy.size;
for(i = 0; i < numUnits; i = i + 1) {
GetUnitFromArmy(tmpArmy, i, tmpUnit);
unitType = tmpUnit.type;
if (unitType == UnitDB(UNIT_BORDER_GUARD)) { // if unit is Border Guard
infantryLeft = infantryLeft + 1;
}
}
if (infantryLeft >= 1) {
numUnits = GetUnitsAtLocation(tmpLoc);
for (i = 0; i < numUnits; i = i + 1) {
GetUnitFromCell(tmpLoc, i, tmpUnit);
unitType = tmpUnit.type;
if (unitType == UnitDB(UNIT_BORDER_GUARD)) { // if unit is Border Guard
foundInfantry = foundInfantry + 1;
} elseif (unitType == UnitDB(PILLBOX)) {
pillboxUnit = tmpUnit;
}
}
foundInfantry = foundInfantry - infantryLeft;
if (foundInfantry == 0 && pillboxUnit.valid) {
KillUnit(pillboxUnit);
}
}
}
}
}
//---------------------------------------------------------
// Stops the moving and disbanding of those pesky Pillboxes
//-----------------------------------------------------------
HandleEvent(MoveUnits) 'WWPillboxStayPut_F' pre {
int_t i;
int_t tmpNum;
int_t unitType;
unit_t tmpUnit;
army_t tmpArmy;
tmpArmy = army[0];
if (ArmyIsValid(tmpArmy)) {
tmpNum = tmpArmy.size;
for(i = 0; i < tmpNum; i = i + 1) {
GetUnitFromArmy(tmpArmy, i, tmpUnit);
unitType = tmpUnit.type;
if (unitType == UnitDB(PILLBOX)) {
return STOP;
}
}
}
}
HandleEvent(DisbandArmyOrder) 'WWDisbandFail_F' pre {
int_t i;
int_t tmpNum;
int_t unitType;
unit_t tmpUnit;
army_t tmpArmy;
location_t tmpLoc;
int_t numUnits;
int_t infantryLeft;
int_t foundInfantry;
unit_t pillboxUnit;
tmpArmy = army[0];
infantryLeft = 0;
foundInfantry = 0;
if (ArmyIsValid(tmpArmy)) {
tmpLoc = tmpArmy.location;
// If the tile left has a Pillbox and no other Infantry remain, kill the Pillbox unit
if (TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_PILLBOX))) {
numUnits = tmpArmy.size;
for(i = 0; i < numUnits; i = i + 1) {
GetUnitFromArmy(tmpArmy, i, tmpUnit);
unitType = tmpUnit.type;
if (unitType == UnitDB(UNIT_BORDER_GUARD)) { // if unit is Border Guard
infantryLeft = infantryLeft + 1;
} elseif (unitType == UnitDB(PILLBOX)) { // Stop disbanding if Pillbox unit is in army
return STOP;
}
}
if (infantryLeft >= 1) {
numUnits = GetUnitsAtLocation(tmpLoc);
for (i = 0; i < numUnits; i = i + 1) {
GetUnitFromCell(tmpLoc, i, tmpUnit);
unitType = tmpUnit.type;
if (unitType == UnitDB(UNIT_BORDER_GUARD)) { // if unit is Border Guard
foundInfantry = foundInfantry + 1;
} elseif (unitType == UnitDB(PILLBOX)) {
pillboxUnit = tmpUnit;
}
}
foundInfantry = foundInfantry - infantryLeft;
if (foundInfantry == 0 && pillboxUnit.valid) {
KillUnit(pillboxUnit);
}
}
}
}
}
HandleEvent(DisbandUnit) 'WWDisbandFail2_F' pre {
unit_t tmpUnit;
unit_t tmpUnit2;
int_t unitType;
int_t unitType2;
location_t tmpLoc;
int_t infantryLeft;
int_t foundInfantry;
int_t numUnits;
unit_t pillboxUnit;
int_t i;
tmpUnit = unit[0];
unitType = tmpUnit.type;
tmpLoc = tmpUnit.location;
infantryLeft = 0;
foundInfantry = 0;
// If the tile left has a Pillbox and no other Infantry remain, kill the Pillbox unit
if (TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_PILLBOX))) {
if (unitType == UnitDB(PILLBOX)) {
return STOP; // Stop disbanding of Pillbox unit
} elseif (unitType == UnitDB(UNIT_BORDER_GUARD)) { // if unit is Border Guard
infantryLeft = 1;
}
if (infantryLeft == 1) {
numUnits = GetUnitsAtLocation(tmpLoc);
for (i = 0; i < numUnits; i = i + 1) {
GetUnitFromCell(tmpLoc, i, tmpUnit2);
unitType2 = tmpUnit2.type;
if (unitType2 == UnitDB(UNIT_BORDER_GUARD)) { // if unit is Border Guard
foundInfantry = foundInfantry + 1;
} elseif (unitType2 == UnitDB(PILLBOX)) {
pillboxUnit = tmpUnit2;
}
}
if (foundInfantry >= 2 && pillboxUnit.valid) {
KillUnit(pillboxUnit);
}
}
}
}
Please NOTE that you will have to replace the check for airunits in the first function (barbed wire) with your own ckeck if you don't use Martin G.'s UnitCheckers (from GoodMod) in your MOD.
Well I hope & think I forgot nothing important so far. To achieve the demanded text length for today here is another piece of SLIC: Since we are very glad about our abilities to build advanced military facilities we don't want our ignorant mayors to build odd things like farms and shopping centers over them:
PHP:
////////////////////////////////////////////////////////////////////////////////////////////////
// Prevents the building of tile improvements over forts, military camps, barbed wires, //
// pillboxes, air bases and villages - except for the replacement of one of these 'military' //
// ti's by another one and except for roads, railroads, maglevs. //
// //
// Code snippets from City Expansion by BlueO, Pedrunn and IW //
// Adapted for preserveforts.slc by BureauBert 22-Apr-2003 //
////////////////////////////////////////////////////////////////////////////////////////////////
int_f TileHasFort(location_t tmpLoc) {
if(TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_FORTIFICATIONS))
|| TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_MILITARY_CAMPS))
|| TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_BARBED_WIRE))
|| TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_PILLBOX))
|| TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_AIR_BASES))
|| TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_VILLAGE))) {
return 1;
} else {
return 0;
}
}
HandleEvent(CreateImprovement) 'DontLetPlaceImpsOverForts' pre {
if(TileHasFort(location[0]) == 1) {
if(value[0] == TerrainImprovementDB(TILEIMP_ROAD)
|| value[0] == TerrainImprovementDB(TILEIMP_RAILROAD)
|| value[0] == TerrainImprovementDB(TILEIMP_MAGLEV)
|| value[0] == TerrainImprovementDB(TILEIMP_UNDERSEA_TUNNEL)
|| value[0] == TerrainImprovementDB(TILEIMP_FORTIFICATIONS)
|| value[0] == TerrainImprovementDB(TILEIMP_MILITARY_CAMPS)
|| value[0] == TerrainImprovementDB(TILEIMP_BARBED_WIRE)
|| value[0] == TerrainImprovementDB(TILEIMP_PILLBOX)
|| value[0] == TerrainImprovementDB(TILEIMP_AIR_BASES)
|| value[0] == TerrainImprovementDB(TILEIMP_VILLAGE)) {
// really odd: != does not work in the above statements
}
else {
return STOP;
}
}
}
Note that you will most likely have to remove villages and military camps from the above list. 
I hope this helps - good luck and have fun!
|
|
|  |
All times are GMT. The time now is 05:28. Apolyton Time is 00:28. |
top of page
|
| archivepost |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|