//////////////////////////////////////////////////////////////////////
ACTION barrell_explode //from rocket_event
{
EXCLUSIVE_ENTITY; // terminate other actions, to stop moving
MY.EVENT = NULL;
// Explode
morph <explo+7.pcx>, ME;
MY.AMBIENT = 100;
MY.FACING = ON;
MY.NEAR = ON;
MY.FLARE = ON;
MY.PASSABLE = ON;
MY.AMBIENT = 100;
MY.LIGHTRED = light_flash.RED;
MY.LIGHTGREEN = light_flash.GREEN;
MY.LIGHTBLUE = light_flash.BLUE;
MY.LIGHTRANGE = 64;
wait(1);
play_entsound ME,hit_wham,300;
while(MY.CYCLE <= 7)
{
MY.CYCLE += TIME;
waitt(1);
}
// Apply damage
range = 300;
damage = 50;
temp.PAN = 360;
temp.TILT = 360;
temp.Z = range;
indicator = _EXPLODE; // must always be set before scanning
scan(MY.POS,MY_ANGLE,temp);
remove(ME);
}
//////////////////////////////////////////////////////////////////////
action damaged_barrell
{
IF(EVENT_TYPE==EVENT_SHOOT && indicator== _GUNFIRE)
{
barrell_explode();
}
}
//////////////////////////////////////////////////////////////////////
action explo_effect
{
my._HEALTH = 20; // setting your health damage.
my.enable_shoot = on; // telling the program that you are going to shoot the barrell.
my.enable_scan = on; // scanning the entity to make sure that you did shoot it.
my.event=damaged_barrell;
}