ok, i tried the sugestion and....
1 created a force shield entity (a cilinder without top and bottom, some sides)
2 assigned an action
3 modified the event of the shield protected entity
4 worked really good for me
5 thanks....
action act_shield
{
shield = my;
while(!player){ wait(1);}
my.x = the_robot.x;
my.y = the_robot.y;
my.z = the_robot.z;
my.albedo = 0;
my.unlit = on;
my.scale_x = 1;
my.scale_y = 1;
my.scale_z = 1;
my.passable = off;
my.push = 0;
my.health = 150;
my.passable = on;
my.transparent = ON;
my.invisible = off;
my.ambient = 100;
my.alpha = 0;
// shield is a cilinder whitout some sides
while(shield.health > 0) // as long as still active
{
my.x = the_robot.x; // move with the protected entity
my.y = the_robot.y;
my.z = the_robot.z;
my.pan += 1; // do some rotating effect
wait(1);
}
}
/************************************/
function robot_event()
{
if(EVENT_TYPE == EVENT_SHOOT)// active when player is shooting the robot...
{ // ...can't do damage if player is not in range
if (player.hlock == 1) // hlock = 1 active when distance between
{ // player and robot is below 350 (vec_dist())
if(shield.health <= 0) // as long as the shield is active...
{ // ...do not decrease entity health
my.health -= 10;
}
// shield_sw ---is a var to cancel repeating hits to initiate
// the shield on/off out of control
if((shield_sw == 0) && (shield.health > 0))
{
shield.health -= 10; // reduce robot shield energy
shield_sw = 1; // do not allow more shield hits until finish
shield.alpha = 0; // initialize shield alpha
while (shield.alpha < 50) // make more solid
{
shield.alpha += 5 * time;
wait(1);
}
shield.alpha = 50; // make more transparent
while (shield.alpha > 5)
{
shield.alpha -= 5 * time;
wait(1);
}
shield.alpha = 0;
shield_sw = 0; // reset the switch to allow another complete
} // cycle of shield fading
}
}
scaned_entity = null;
if (EVENT_TYPE == event_detect)
{
scaned_entity = you;
// save the entity position scaned in this global vector
vec_set (v_scaned.x, player.x);
}
}
/******************************/
any opinions, suggestions are apreciated