TopoSolitario wrote:
And another question (I never stop asking)...
assaults has no animation! It is a really weird situation, both units going hand to hand, bullet to bullet, grenade to grenade... and no one moves... they just die! I probably will tweak Assault.BSF with an AddVizAnim for attacker and defender... it is a must have! The idea is to add something like this: AddVizAnim(unit,"FIRE", 255) in the propper place of the function.
Now the question is, if I create a new animation tag in the animation file for the unit called [ASSAULT] will it work if I add AddVizAnim(me, "ASSAULT", 255)? To work with current units I'll use "fire", but it is good to kown... as having some GI's charging with bayonets will be nice (or zombies advancing with open arms).
Another question is the 255 of the anim... what does it mean? in the docs it is said "the mask is the men affected (1 == man 0, 2 == man 1, etc) neg mask means play until you tell it play something else", so does 255 means animation for man 1, man 4 and man4? :s
I'm not too sure ... but 255 means ALL ... I'm not a programmer and never really messed with any other value than 255. Since the men's "mask" are individual, using 255 ensures any remaining masks will perform the animation.
You know, another good FUNCTION to look at is in the CombatTools.BSF. The function TurnAndFire (pasted below for quick reference) has examples , such as ... infantry "throwing grenades" when they are one tile away.
Here's the script from CombatTools .... Has several variaties of AddVizAnim ...
Note the AddVizAnim(me, "FLAME", 255) ... If the unit has flame damage it will call this animation. Now, look at an example of the US_Flamethrower.TXT file ... contains the tag [FLAME00] and the frames ... So, perhaps your [ASSAULT00] tag would work as you mentioned.
Code: Select all
// show the visual stuff with a unit turning and firing
FUNCTION TurnAndFire (me, x, y, unit, flameDamage)
{
int fired ;
int grenades ;
int effectX ;
int effectY ;
int i;
int tileX ;
int tileY ;
int distance ;
int rangeBracket ;
int effectiveness ;
fired = 0 ;
//Log("TaF: ", x, y, flameDamage) ;
// focus camera on unit and play fire effect
AddVizCamUnit(me) ;
// do i need to use a charge to attack this unit?
if ( (unit!= -1) && (GetAttrib (unit, "ArmourType") == 1 ))
{
distance = GetDistanceBetween(unit, me) ;
rangeBracket = GetRangeBracket (distance) ;
effectiveness = GetAttribArray(me, "APEffective", rangeBracket) ;
if ( effectiveness == 0 )
{
SetAttrib(me, "APCharges", GetAttrib(me, "APCharges")-1 ) ;
}
}
//Log ("hasgrenade, hasmg, range", grenades, GetAttrib (me, "HasMG"), GetDistanceBetween(me, unit)) ;
// work out which attack anims to play
if (flameDamage > 0 )
{
fired = 1 ;
AddVizUnitTurnToFace(me, x, y) ;
AddVizAnim(me, "FLAME", 255) ;
}
else
{
AddVizUnitTurnToFire(me, x, y) ;
grenades = GetAttrib (me, "HasGrenade") ;
if ( grenades > 0 )
{
//Log ("has grenade");
fired = 1 ;
// if range is 1 tile throw grendes
// unit could be -1
if ( (unit != -1) && (GetDistanceFromUnit(me, x, y) < 2 ))
{
AddVizAnim(me, "grenadethrow", 255) ;
AddVizFunctionCall("PlaySFX",x, y, 58) ;
tileX = GetUnitX (unit) ;
tileX *= 100 ;
tileY = GetUnitY (unit) ;
tileY *= 100 ;
for (i=0; i<3; i++)
{
effectX = tileX + Rand (0,100) ;
effectY = tileY + Rand (0,100) ;
AddVizSpotAnim(effectX, effectY, "bang", 3, Rand(2,6)) ;
}
//Log ("grenade thrown");
}
// only shoot small arms at infantry
// this will be true is unit == -1
if ( GetAttrib(unit, "ArmourType") == 0 )
{
AddVizAnim(me, "FIRE", 255) ;
}
}
if ( ( GetAttrib (me, "HasMG") == 1 ) && ( fired == 0 ) )
{
fired = 1 ;
// only shoot mg at short range & soft targets
//Log ("has mg");
if ( (GetDistanceFromUnit(me, x, y) < 4 ) && ( ( GetAttrib(unit, "ArmourType") == 0 ) ) )
{
AddVizAnim(me, "MGFIRE", 255) ;
//Log ("mg fired");
}
else
{
AddVizAnim(me, "FIRE", 255) ;
}
}
}
if (fired == 0 )
{
fired = 1 ;
// 255 means all 8 units. It will work out which ones are valid.
AddVizAnim(me, "FIRE", 255) ;
//Log ("no mg or grenade");
}
// then move the camera to look at the target
AddVizCamUnit(unit) ;
}