Hello Pip!
Here's the code:
Code: Select all
FUNCTION minefield(objectid, tilex, tiley, objectx, objecty, check, user, unit)
{
int id;
int i;
int exp;
int suppressionDamage;
int morale;
if( check != 0 )
{
if( GetUnitSide(unit) == 0 )
{
if (tilex == objectx && tiley == objecty)
{
return 2 ;
}
else
{
// the next step in the unit's path will run them over a mine, reacting will give player a chance to pick a new route
if (GetRouteNextX(unit) == objectx && GetRouteNextY(unit) == objecty)
{
return 1 ;
}
}
}
return -1 ;
}
else
{
// is the unit on our tile?
if( (tilex == objectx && tiley == objecty ) && (GetUnitSide(unit) == 0) )
{
//is the unit an engineer unit?
if ( CanUnitDisarmMines(unit) == 1 )
{
if (IsUnitSquadType(unit, "INFANTRY") == 1)
{
SetAttrib(unit, "AP", 0);
}
else
{
AddVizFunctionCall("PlaySFX", tilex, tiley, 57) ;
PlayUISFX(75);
AddVizUnitSpotAnim(unit, 255, "bang", 4, 0) ;
}
DeleteObject(objectid);
AddVizDelay(10) ;
if ( GetShowSide() == GetCurrentSide() )
{
AddVizFunctionCall("GetHeadImage", GetCurrentSide(), "BP0Image:", 13) ;
AddVizFunctionCall("ShowUIScreen", "BattlePop0", "Anim1", "IDS_MINECLEAR", GetWorkString(13)) ;
}
}
//the unit is not an engineer, there is chance it gets destroyed
else
{
if (Rand(0,100)>=25);
{
if(GetAttrib(unit, "Blocking")==0)
{
SetAttrib(unit, "AP", 0);
suppressionDamage = HE_Attack ( -1, unit, 74, tilex, tiley, 74, 4, 57, 1 );
MoraleUpdate (unit, -1, suppressionDamage);
//morale = GetAttrib(unit, "morale");
//morale = morale - suppressionDamage;
//SetAttrib(unit, "morale",morale);
}
else
{
AddVizFunctionCall("PlaySFX", tilex, tiley, 57) ;
PlayUISFX(75);
AddVizUnitSpotAnim(unit, 255, "bang", 4, 0) ;
KillUnit(unit, 255) ;
DamageTile(tilex, tiley, 50);
}
AddVizDelay(10) ;
if (GetShowSide() == GetCurrentSide() )
{
AddVizFunctionCall("GetHeadImage", GetCurrentSide(), "BP0Image:", 13) ;
AddVizFunctionCall("ShowUIScreen", "BattlePop0", "Anim1", "IDS_MINE", GetWorkString(13)) ;
}
}
}
}
return 0 ;
}
}
The fundamental question is: "What is to be done?" (Lenin)
The line that attracs my attention is:
Code: Select all
{
// is the unit on our tile?
if( (tilex == objectx && tiley == objecty ) && (GetUnitSide(unit) == 0) )
Hm. Which side is "our"? AFAIK the basic setting is 0 = Soviet, 1 = Axis. Has it something to do with that?
Some other questions:
Can this code here be changed that mines are dangerous to both sides? And: Has the Kursk campaign been fixed? If yes, where can the relevant script be found?
Any help appreciated!
Regards,
S.