REZ_PARAM_DAMAGE prematurely kills objects using it
under review
Albino Rabbit
Applying damage via rez param causes object to ALWAYS despawn on collision
(Okay, so it looks like the text editor ate my entire post.)
Applying REZ_PARAM_DAMAGE to an object will force it to immediately despawn regardless of whether or not damage is actually applied to the collision source. This behavior also triggers in non-damage areas and parcels.
The following code was used and tested:
list rezparams=[
REZ_PARAM,1,//Rez param
REZ_FLAGS,REZ_FLAG_DIE_ON_NOENTRY|REZ_FLAG_NO_COLLIDE_OWNER|REZ_FLAG_NO_COLLIDE_FAMILY|REZ_FLAG_PHYSICAL|REZ_FLAG_TEMP,//Flags
REZ_POS,llGetCameraPos(),0,1,//Object rez Pos
REZ_ROT,llGetCameraRot(),0,//Object Rot on rez
REZ_VEL,<150.0,0.0,0.0>,1,0, //Velocity
REZ_LOCK_AXES,<1.0,1.0,1.0>,//Axis Locks
//REZ_SOUND,sound,1.0,1,//Loop sound
REZ_SOUND_COLLIDE,"",1.0//Collision sound
//REZ_DAMAGE,200.0,REZ_DAMAGE_TYPE,0//Damage Params
];
llRezObjectWithParams(bullet,rezparams);
The project spawned via this method will die without executing any collision event or functions queued after the initial collision regardless of source or location.
Log In
Maestro Linden
marked this post as
under review
Maestro Linden
marked this post as
closed
Maestro Linden
Hi Albino Rabbit, the behavior you describe is the designed behavior for any basic objects with damage set on them (whether via llSetDamage, REZ_PARAM_DAMAGE, etc.). Such objects derez upon collision, whether that collision is with an avatar or object that can accept damage, or something else such as unscripted objects or terrain. Without this behavior, regions would fill up with all the bullets that missed their targets.
Speaking to other Lindens, we believe it would be possible to add a new feature to configure a damage-enabled bullet to 'ricochet' a certain number of times before derezzing. If that behavior is what you're after, please consider writing a feature request for it on the 'Feature Requests' board.
Albino Rabbit
Maestro Linden Is this not already addressed via REZ_FLAG_DIE_ON_COLLIDE and REZ_FLAG_DIE_ON_NOENTRY? The goal is to have the object execute a different set of code if it collides with a target that has no health.
The alternative is to run llDamage after the initial collision on valid targets. This resolves this issue as well as 'ricochet rounds' at the cost of increased complexity.
Maestro Linden
Okay, testing some more, I see that bullets classically do
not
automatically derez when they miss their targets and hit inert objects or terrain on damage-enabled parcels. This matches the behavior when bullets hit anything on a damage-disabled parcel.To explore this further, I set up a basic 'bullet' object and a 'gun' script that rezzes it on touch. The 'gun' alternates between 3 different rez types:
- llRezObjectWithParams (using your REZ_FLAGS) withoutREZ_DAMAGE
- llRezObjectWithParams (using your REZ_FLAGS) withREZ_DAMAGE
- llRezObject
Both scripts are included in a child comment.
The behavior I see is that:
- all 3 rez types will cause the bullet to derez upon hitting another agent on damage-enabled land
- all 3 rez types will cause the bullet to remain after hitting an inert object or terrain on damage-enabled land
- (1) and (3) will cause the bullet to remain after hitting another agent on damage-disabled land
- (2) will cause the bullet to derez after hitting another agent on damage-disabled land
- (1) and (3) will cause the bullet to remain after hitting an inert object or terrain on damage-disabled land
- (2) will cause the bullet to derez after hitting inert object or terrain on damage-disabled land
It seems like the desire here is to make llRezObjectWithParams
with
REZ_DAMAGE behave the same as the other types on damage-disabled land - is that correct?Maestro Linden
// classic 'bullet' script. Always includes 5 damage.
default
{
state_entry()
{
llSetObjectName("bullet");
llSetStatus(STATUS_PHYSICS, TRUE);
llSetPrimitiveParams([PRIM_TEMP_ON_REZ, TRUE]);
llSetDamage(5);
}
}
/* 'gun' script which alternates between one of 3 rez options:
1. llRezObjectWithParams without REZ_DAMAGE
2. llRezObjectWithParams with REZ_DAMAGE
3. llRezObject
*/
integer rezStyle;
default
{
touch_start(integer total_number)
{
list rezParams = [REZ_FLAGS, REZ_FLAG_DIE_ON_NOENTRY | REZ_FLAG_NO_COLLIDE_OWNER |
REZ_FLAG_NO_COLLIDE_FAMILY | REZ_FLAG_PHYSICAL | REZ_FLAG_TEMP,
REZ_POS, <2,0,0>, TRUE, TRUE,
REZ_VEL, <20,0,0>, TRUE, FALSE
];
if(rezStyle == 0)
{
llSay(0, "Fire with llRezObjectWithParams, **excluding** REZ_DAMAGE parameter");
llRezObjectWithParams("bullet", rezParams);
}
else if(rezStyle == 1)
{
llSay(0, "Fire with llRezObjectWithParams, , **including** REZ_DAMAGE parameter");
llRezObjectWithParams("bullet", rezParams + [REZ_DAMAGE, 5.0]);
}
else
{
llSay(0, "Fire with llRezObject");
llRezObject("bullet", llGetPos() + <2,0,0> * llGetRot(), <20,0,0> * llGetRot(),
llGetRot(), 0);
}
rezStyle = (rezStyle + 1) % 3;
}
}
Albino Rabbit
Maestro Linden The desire is to make the behavior consistent with objects that get damage properties via llSetDamage prior to this new behavior that has been causing the object to despawn on collision regardless of whether or not damage is actually applied or enabled - Reducing the complexity of rounds designed to deal with multiple types of targets.
I'm not sure at what point this was changed, but prior to my recent projects, projectiles and objects that had a damage property only despawned immediately when colliding with a valid object/avatar AND applied its damage to said object. The new behavior retroactively breaks objects which took advantage of this property.