Jump to content

Linden Lab PvP Script - owner bullet = hurt owner D:


IA Nova
 Share

You are about to reply to a thread that has been inactive for 2240 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'm trying to get it, that the bullets and damage done by the owner of the object do not hurt the owner but yes others players, is there any way to do this? 

 

my script for dmg is : 

vector velocity;
integer shot = FALSE; 
integer fade = FALSE;
float alpha = 1.0;
float damage = 25;
float hitpower = 8000;
float lifetime = 5;

explode()
{
    llSetStatus(STATUS_PHYSICS, FALSE); 
    vector vel = llGetVel() * hitpower;
    llPushObject(llDetectedKey(0), vel, ZERO_VECTOR, FALSE);
    llSetForce(<0,0,0>, TRUE);
    llTriggerSound("3da2ccf7-8361-a8f8-76d7-7f13ec966161", 10.0);
    llDie();
}

default
{
    state_entry()
    {
        llSetDamage(damage);
    }
    
    on_rez(integer start_param)
    {
        llSetStatus(STATUS_PHYSICS, TRUE);
        llSetStatus(STATUS_DIE_AT_EDGE, TRUE);
        llSetBuoyancy(1.0);
        llCollisionSound("", 1.0);          //  Disable collision sounds
        velocity = llGetVel() * 5;
        float vmag;
        vmag = llVecMag(velocity);
        if (vmag > 0.1) shot = TRUE;
        llSetTimerEvent(lifetime);
    }

    collision_start(integer total_number)
    {
        explode();
    }
    
    timer()
    {
        if (!fade)
        {
            if (shot)
            {
                explode();
            }
        }   
        else
        {
            llSetAlpha(alpha, -1);
            alpha = alpha * 0.999999;  
            if (alpha < 0.1) 
            {
                explode();
            }     
        }
    }
}

 

Link to comment
Share on other sites

5 minutes ago, HzFox said:

I'm trying to get it, that the bullets and damage done by the owner of the object do not hurt the owner but yes others players, is there any way to do this? 

Yes.  Don't shoot yourself.

Or, change the collision_start event to

collision_start(integer total_number)
{
    if ( llGetOwner() != llDetectedKey(0) )
    {
        Explode();
    }
}

 

  • Like 2
Link to comment
Share on other sites

I'm a bit silly, to apply the script, but it looks simple, even though my ant brain can not understand how to color the script fragment, anyway I have a screenshot here of the error it gives me:

  4fa39a3b4b.png

vector velocity;
integer shot = FALSE; 
integer fade = FALSE;
float alpha = 1.0;
float damage = 25;
float hitpower = 8000;
float lifetime = 5;

explode()
{
    llSetStatus(STATUS_PHYSICS, FALSE); 
    vector vel = llGetVel() * hitpower;
    llPushObject(llDetectedKey(0), vel, ZERO_VECTOR, FALSE);
    llSetForce(<0,0,0>, TRUE);
    llTriggerSound("3da2ccf7-8361-a8f8-76d7-7f13ec966161", 10.0);
    llDie();
}

default
{
    state_entry()
    {
        llSetDamage(damage);
    }
    
    on_rez(integer start_param)
    {
        llSetStatus(STATUS_PHYSICS, TRUE);
        llSetStatus(STATUS_DIE_AT_EDGE, TRUE);
        llSetBuoyancy(1.0);
        llCollisionSound("", 1.0);          //  Disable collision sounds
        velocity = llGetVel() * 5;
        float vmag;
        vmag = llVecMag(velocity);
        if (vmag > 0.1) shot = TRUE;
        llSetTimerEvent(lifetime);
    }

    collision_start(integer total_number)
{
    if ( llGetOwner() != llDetectedKey(0) )
    {
        Explode();
    }
}
        else
        {
            llSetAlpha(alpha, -1);
            alpha = alpha * 0.999999;  
            if (alpha < 0.1) 
            {
                explode();
            }     
        }
    }
}

i change : 

collision_start(integer total_number)
    {
        explode();
    }
    
    timer()
    {
        if (!fade)
        {
            if (shot)
            {
                explode();
            }
        }   

for 

collision_start(integer total_number)
{
    if ( llGetOwner() != llDetectedKey(0) )
    {
        Explode();
    }
}

X_x 

Link to comment
Share on other sites

i test too : 

vector velocity;
integer shot = FALSE; 
integer fade = FALSE;
float alpha = 1.0;
float damage = 25;
float hitpower = 8000;
float lifetime = 5;

explode()
{
    llSetStatus(STATUS_PHYSICS, FALSE); 
    vector vel = llGetVel() * hitpower;
    llPushObject(llDetectedKey(0), vel, ZERO_VECTOR, FALSE);
    llSetForce(<0,0,0>, TRUE);
    llTriggerSound("3da2ccf7-8361-a8f8-76d7-7f13ec966161", 10.0);
    llDie();
}

default
{
    state_entry()
    {
        llSetDamage(damage);
    }
    
    on_rez(integer start_param)
    {
        llSetStatus(STATUS_PHYSICS, TRUE);
        llSetStatus(STATUS_DIE_AT_EDGE, TRUE);
        llSetBuoyancy(1.0);
        llCollisionSound("", 1.0);          
        velocity = llGetVel() * 5;
        float vmag;
        vmag = llVecMag(velocity);
        if (vmag > 0.1) shot = TRUE;
        llSetTimerEvent(lifetime);
    }

    collision_start(integer total_number)
{
    if ( llGetOwner() != llDetectedKey(0) )
    {
        Explode();
    }
}
    
    timer()
    {
        if (!fade)
        {
            if (shot)
            {
                explode();
            }
        }   
        else
        {
            llSetAlpha(alpha, -1);
            alpha = alpha * 0.999999;  
            if (alpha < 0.1) 
            {
                explode();
            }     
        }
    }
}

643449051b.png

Link to comment
Share on other sites

Sorry.  That was a typing mistake on my part.  Explode(); should be explode();  Like this:

    collision_start(integer total_number)
    {
        if ( llGetOwner() != llDetectedKey(0) )
        {
            explode();
        }
     }
Edited by Rolig Loon
Link to comment
Share on other sites

Thanks for the help! >, <
it's still hurting me when throwing a spear!! ;_;

now it works for me without errors, but it keeps hurting me, it's that I throw a spear and these are sometimes left on the ground, but if the combat is very close to throwing a spear it hurts me instead of my rival >,< 

 

i use the script : 

vector velocity;
integer shot = FALSE; 
integer fade = FALSE;
float alpha = 1.0;
float damage = 25;
float hitpower = 8000;
float lifetime = 5;

explode()
{
    llSetStatus(STATUS_PHYSICS, FALSE); 
    vector vel = llGetVel() * hitpower;
    llPushObject(llDetectedKey(0), vel, ZERO_VECTOR, FALSE);
    llSetForce(<0,0,0>, TRUE);
    llTriggerSound("3da2ccf7-8361-a8f8-76d7-7f13ec966161", 10.0);
    llDie();
}

default
{
    state_entry()
    {
        llSetDamage(damage);
    }
    
    on_rez(integer start_param)
    {
        llSetStatus(STATUS_PHYSICS, TRUE);
        llSetStatus(STATUS_DIE_AT_EDGE, TRUE);
        llSetBuoyancy(1.0);
        llCollisionSound("", 1.0);          
        velocity = llGetVel() * 5;
        float vmag;
        vmag = llVecMag(velocity);
        if (vmag > 0.1) shot = TRUE;
        llSetTimerEvent(lifetime);
    }

   collision_start(integer total_number)
    {
        if ( llGetOwner() != llDetectedKey(0) )
        {
            explode();
        }
     }
    
    timer()
    {
        if (!fade)
        {
            if (shot)
            {
                explode();
            }
        }   
        else
        {
            llSetAlpha(alpha, -1);
            alpha = alpha * 0.999999;  
            if (alpha < 0.1) 
            {
                explode();
            }     
        }
    }
}

 

Link to comment
Share on other sites

I did not know there were different types of script, for each object that you throw or shooting,
I thought they were all the same, I'm throwing an object with this script:

 

vector velocity;
integer shot = FALSE; 
integer fade = FALSE;
float alpha = 1.0;
float damage = 25;
float hitpower = 8000;
float lifetime = 5;

explode()
{
    llSetStatus(STATUS_PHYSICS, FALSE); 
    vector vel = llGetVel() * hitpower;
    llPushObject(llDetectedKey(0), vel, ZERO_VECTOR, FALSE);
    llSetForce(<0,0,0>, TRUE);
    llTriggerSound("3da2ccf7-8361-a8f8-76d7-7f13ec966161", 10.0);
    llDie();
}

default
{
    state_entry()
    {
        llSetDamage(damage);
    }
    
    on_rez(integer start_param)
    {
        llSetStatus(STATUS_PHYSICS, TRUE);
        llSetStatus(STATUS_DIE_AT_EDGE, TRUE);
        llSetBuoyancy(1.0);
        llCollisionSound("", 1.0);          
        velocity = llGetVel() * 5;
        float vmag;
        vmag = llVecMag(velocity);
        if (vmag > 0.1) shot = TRUE;
        llSetTimerEvent(lifetime);
    }

   collision_start(integer total_number)
    {
        if ( llGetOwner() != llDetectedKey(0) )
        {
            explode();
        }
     }
    
    timer()
    {
        if (!fade)
        {
            if (shot)
            {
                explode();
            }
        }   
        else
        {
            llSetAlpha(alpha, -1);
            alpha = alpha * 0.999999;  
            if (alpha < 0.1) 
            {
                explode();
            }     
        }
    }
}

 

I just want the object not to hurt me when it is thrown and it is against some stone or nearby wall

Link to comment
Share on other sites

35 minutes ago, HzFox said:

t's still hurting me when throwing a spear!! ;_;

It will do.   If you read the wiki article on llSetDamage you'll see that when you've called it, it makes the object automatically inflict damage on the avatar with whom it collides and then disappear.    There's no way to be selective about it.   It inflicts the damage when the avatar and the damage-enabled object collide, without any collision event being fired even.

That's one of the reasons most people who make weapons don't use llSetDamage but, instead, use resident-made combat systems and HUDs.

  • Like 1
Link to comment
Share on other sites

7 hours ago, HzFox said:

ahhh, if there is no solution to that error, then I'll go ahead in other ways! thank you very much!

The only way to use llSetDamage is in projectiles like bullets or arrows, which you fire from an attachment.   That way they don't collide with the owner, since you can have the script rez them some way in front of you.    So if you are stabbing people with your spear, you could have it fire an invisible bullet. 

If you're throwing the spear, it would get more complicated, since you'd have to hold a spear that plays a throwing animation, then launches a visible damage -enabled spear, and makes itself invisible, but it could probably be done.

 

  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2240 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...