Jump to content

Rez a Bullet in Prim attached to Avatar


Ares Halostar
 Share

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

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

Recommended Posts

I have an attached prim, which is attached to the Avatar Centre.

It basically detects if someone is aiming at me, and rotates the prim towards that avatar and fires a bullet.

Rotation of the attached prim towards the target avatar works fine, but when it comes to rezzing the bullet towards the avatar, it instead, rezzes the bullet, and fires it, at the direction my avatar is facing.  As I said, the attached prim rotates nicely to approximately the target's direction, but meh, the bullet fires where I am pointing.

I can't work out the required rotations in the Fire() routine, as rotations always do my head in.

Any help would be appreciated.

vector vel;                   
vector pos;  
vector DetPos;
vector MyPos;
string sName;
integer LIFETIME = 1000; 
float SPEED = 75.0;
float Distance;
key target;
key Hitter;
//Notes llGetRootRotation - returns region rotation of avatar NOT of the object's root prim.
// llGetRot - Returns a rotation that is the prim's rotation relative to the region's axes.
// llGetLocalRot - Returns the rotation of the prim relative to the root.If called from the root prim, it returns the objects rotation.

Fire()
{
    rotation rot = llGetLocalRot();            
    vector vel = llRot2Fwd(rot);  
    pos = llGetPos();  
    vel = vel * SPEED;                                                                   
    llTriggerSound("Report", 1.0); 
    llRezObject("Bullet2", pos, vel, rot, LIFETIME);  
}
default
{
    state_entry()
    {
        llSetText("", <1.0, 1.0, 1.0>, 1.0);
        llSensorRepeat("", "", AGENT, 96, PI, 1.0);
    }
    sensor(integer n)
    {
        integer i;
        list sweep;
        integer inc;
        for (i=0;i<n;++i)
        {
            if (llGetAgentInfo(llDetectedKey(i)) & AGENT_MOUSELOOK)
            {
                target = llDetectedKey(i);
                DetPos = llDetectedPos(i);
                MyPos = llGetPos();
                Distance = llVecDist(DetPos, MyPos);
                if (llVecDist(llGetPos(), llDetectedPos(i)+llRot2Fwd(llDetectedRot(i))*llVecDist(llGetPos(),llDetectedPos(i))) < 1.5)
                {
                    sweep += llDetectedName(i);
                    inc = inc + 1;
                }  
                if (i == n-1)
                {
                    llSetText(llDumpList2String( sweep, "\n"), <1.0, 1.0, 1.0>, 1.0);
                    string Aimer = llDumpList2String(sweep,"\n");
                    if (inc>0)
                    {
                        //llLookAt(DetPos,0.5,1.0);
                        llLookAt(MyPos+(DetPos+<0,0,1> - MyPos) / llGetRootRotation(),0.5,1.0);
                        llSetText(Aimer+" is Targetting me."+"\n Enemy at: "+(string)llRound(Distance)+" M",<1,1,0>,1.0);
                        Fire();
                    }
                }
            }
        }
    }
}

 

Link to comment
Share on other sites

I could type up the entire thing for you in about three minutes.

But what good would that do you?

On the other hand, I could tell you about some functions and how they work, and trust you to be intelligent enough to learn from there, but I'm always being told that unless people know all of this already, they might use it wrong, so I really don't know what to do anymore.

You should probably hire someone's alt to sell you one.

Edited by Berksey
  • Thanks 1
Link to comment
Share on other sites

Berksey makes a good point. I think all you need is a gentle push in a different direction, though.  You are defining the direction in which the bullet is fired by using llRot2Forward(rot), which guarantees that it will head off in whatever direction you are facing. In fact, it doesn't make any difference which way your attachment is facing. That rotation is purely cosmetic.  Instead, what you need to do is define the vector between yourself and the detected avatar.  That's llDetectedPos(0) - llGetPos().  That's the vector along which your bullet must travel.  To figure out how hard to push it, you'll have to experiment.  Just multiply that vector by an arbitrary scale factor and see what happens.

Link to comment
Share on other sites

Does it really only detect folks aiming at you or at anyone who is in mouselook? Because you know, mouselook is not only for combat... sounds like an unintentional griefer item you are building there.

Edited by Fionalein
Link to comment
Share on other sites

20 hours ago, Ares Halostar said:

I have an attached prim, which is attached to the Avatar Centre.

It basically detects if someone is aiming at me, and rotates the prim towards that avatar and fires a bullet.

If you're able to rez, why not rez an interceptor shield plate instead? I've dealt with "shields" that auto-retaliate against mouselookers in the past. Its a stupid concept. Mouselook does not mean someone is 100% going to shoot you. Many people naturally walk around and look at things and people in mouselook. Your application is only going to annoy others and make you into a griefer.

Link to comment
Share on other sites

Fionalein - The script actually detects when someone is aiming at you.  Look at the script more closely.  It doesn't just target anyone in mouselook, as that would be a silly thing to do.

Berksey - I was only after a bit of friendly advice, nothing more.  I have been in SL for many years, and I like to script, but I am no expert, and I sometimes ask for help on these forums.  We are not all expert scripters.

Lucia Nightfire -  Again, as others, you have not bothered to read the script.  It will ONLY target someone that is aiming at you in mouselook.  I have no intention of using this script as a griefer tool.  In fact, I only plan on using this script on my own parcel.

 

Thankyou Rolig for your suggestion.  I am already experimenting with that line of advice. 

Rolig, you were the only one to offer any constructive advice.  I will think twice in future, when asking for help here.

 

Link to comment
Share on other sites

Your script cannot differentiate between looking at a person in mouselook and aiming, for they are one and the same. And besides, all it does is scan for avatars and target whoever is in mouselook; you lied.

Your argument is invalid, and your project will be attacking anyone who is in mouselook and is within 96 meters of you. Funny how you are expert enough to lie to people who know better, then say you aren't so good at this to cover your butt.

Good luck with your senseless, automatic bullying device. And sure, Rolig helps people. But you don't need help with continuing this project, I think.

Come to think of it, you should do great on these forums, and inworld.

Edited by PheebyKatz
  • Haha 1
Link to comment
Share on other sites

8 minutes ago, PheebyKatz said:

Your argument is invalid, and your project will be attacking anyone whose crosshairs for looking at things are on you.

Actually it would not - as I do not transmit what I am looking at, I could shoot Ares all day without his script responding even once ...

Link to comment
Share on other sites

I edited my post; it took a moment to realize that myself but I did.

Plus all it does is detect if an agent is in mouselook. That means anyone within range who is in mouselook is targeted. That's straight-up griefing, and cannot be justified in any way, no matter who helps you with the script on this forum.

And even if you own the server itself, it's still griefing, and griefing is always against the TOS. Even orbiting a person can be considered griefing, and it's built-in.

tl;dr: scripting is bad. Nobody should do it unless they have a reputation of at least 73759679867.

Edited by PheebyKatz
  • Thanks 1
Link to comment
Share on other sites

Considering the nature of the script idea itself, sending projectiles at people as a defense against possible future attack sounds an awful lot like nuking your neighbor for looking out the window at you, just in case he was about to jump out and shoot you.

Perhaps it is an aggressive nature, coupled with fear of the aggression of others, that is behind the thinking, but in an environment other than a combat zone, it's just downright antisocial.

And IN a combat zone, you'd probably get kicked out for using something not part of their sealed, anti-cheating system.

Please understand, not everything people say that you don't like is a potential threat, and people not helping you with a weapon that targets people who aren't shooting you is to be applauded, not condemned, if you have any real feelings whatsoever.

So basically, someone comes to SL, gets frustrated, and wants to lash out. Gee, everyone's been there. Not everyone shoots people out of nowhere for it, though. Sure, effortlessly dealing with those who would do us harm is an attractive idea, but implementing it isn't so simple as shooting people for looking at you funny.

Also, even things like, "let him get banned" are just symptoms of the same problem. Letting someone cause problems in the hopes it will remove them is just as bad as actively causing problems oneself.

I'd never wish to see anyone pushed out of the community for seeing things differently; better to maybe try to get people to see that "other differents" can make sense first.

Personally, when in a situation where objects might be flying at me and either disrupting my fun, or taking points off of my combat meter, I prefer small, floating, angled deflector shields. If the shield rezzes at an angle to the oncoming projectile, it can deflect the projectile away from you, rather than being pierced by it.

Incidentally, this also works great in dealing with anything thrown at you by, say, an automated attack script that targets you whether you're an aggressor towards anyone or not.

Edited by PheebyKatz
Link to comment
Share on other sites

God, some of you are toxic.  Never have I been the subject of so much hate and ignorance.

As I said, the script only targets avatars when they are aiming at you, and yes, you have to be in mouselook to aim at someone with a weapon.

This line of code: 

On ‎6‎/‎22‎/‎2018 at 12:25 PM, Ares Halostar said:

if (llVecDist(llGetPos(), llDetectedPos(i)+llRot2Fwd(llDetectedRot(i))*llVecDist(llGetPos(),llDetectedPos(i))) < 1.5)

determines if you have anyone's crosshairs are on you.  Did you actually test out the script ?  Obviously not, as you are incapable.

Some people just like to get on their high horse and sprout crap.

And as I said, I will only be using this script on my own land.

I invite any Administrators to look at this post, and lock/close this thread, as I don't want to be the subject of more flaming.

I have been in Second Life for over 10 years with various avatars, and never been accused of griefing.

I used to enjoy the input of the advanced members of this forum, but a few individuals just can't look past their noob noses.

 

  • Haha 1
Link to comment
Share on other sites

Don't let a couple bad eggs jumping to conclusions reflect badly on the rest of us, Ares.

Off the top of my head, I think all you need to do is:

vector vel = llRot2Fwd( llRotBetween(<1,0,0>, targetPosition - llGetPos()) );

llRotBetween will return a rotation that points the forward/X-axis (<1,0,0>) towards your target.

Edited by Wulfie Reanimator
Link to comment
Share on other sites

No one helps building a griefing item? Wulfie to the rescue... how predictable.

1 hour ago, Ares Halostar said:

And as I said, I will only be using this script on my own land.

Yeah you did, and what will stop it from leaving the land?

Edited by Fionalein
Link to comment
Share on other sites

10 minutes ago, Fionalein said:

No one helps building a griefing item? Wulfie to the rescue... how predictable.

Yeah you did, and what will stop it from leaving the land?

Just stop it. Being confrontational like this on a forum doesn't help anyone. It's disruptive and unconstructive. I think I'm repeating myself to you already.

OP has a legitimate scripting question, and the script has a legitimate use. We're allowed to help OP.

Can it be used for griefing? Yes. The same goes for any script that launches physical objects, does anything physics related, plays sound, displays particles, or rezzes anything at all. If and only if OP uses something for griefing should we judge them for actually doing something wrong, and file an Abuse Report.

Edited by Wulfie Reanimator
  • Haha 1
Link to comment
Share on other sites

Aiming in mouselook is the same as looking at someone in mouselook. The only difference is whether they have a weapon pointing at you and are hitting the button on it, and the only way to tell someone's actually firing at you is to detect things coming at you from them.

You could test it and find this out for yourself, of course. But that might change your mind. I don't know if you want to do that. But rest assured, nobody on this forum has EVER, EVER tried what you're doing and decided better upon doing so. Honest, I have never messed with scripts that shoot things at people. xD

Earlier I saw the bullying that happens when someone recommends a simple function and others prefer to use a different one; now someone is asking a person to choose an alternative to something that could cost them their land and their account and that person is called a bad egg for it. Name-calling is so morally superior, yes.

Yes, these forums are full of toxicity. And it's always someone else's. Welcome to SL.

People are free to ignore my advice. There's a setting for it. But just because you don't like what I say doesn't mean I'm wrong. Next time I'll just listen to Fiona. Helping people is unwelcome if they don't like you here.

I used to be an extremely sweet and nice person, and all it got me was bullied. Yet, here I am, asking someone to reconsider something that could cause trouble, and they cheer people for calling me names. People respond by saying yeah, bad people say don't shoot others. Please think about it. Really.

Edited by PheebyKatz
Link to comment
Share on other sites

Thanks for your constructive advice PheebyKatz.  The script now works, but not as it is presented here.  What I posted earlier is just one part of the project that I was working on.

There will be added checks besides the check for who is aiming at me.  I will also add collision checking and checking the owner of the bullet that collided, and all these things together will ensure that no one gets shot, that shouldn't.  Besides, I will not be using this outside of my parcel.  It is my project and something that kept me interested.

All things that shoot at people can be used to grief someone.  It is how we use it that determines if we are a griefer or not.

And for your info, a script similar to mine was created by someone on the old forums ages ago, so this is nothing new.

SL for me was always about creating things.  I've even sold a few things years ago.

  • Like 1
Link to comment
Share on other sites

1 hour ago, PheebyKatz said:

Aiming in mouselook is the same as looking at someone in mouselook. The only difference is whether they have a weapon pointing at you and are hitting the button on it, and the only way to tell someone's actually firing at you is to detect things coming at you from them.

You could test it and find this out for yourself, of course. But that might change your mind. I don't know if you want to do that. But rest assured, nobody on this forum has EVER, EVER tried what you're doing and decided better upon doing so. Honest, I have never messed with scripts that shoot things at people. xD

Earlier I saw the bullying that happens when someone recommends a simple function and others prefer to use a different one; now someone is asking a person to choose an alternative to something that could cost them their land and their account and that person is called a bad egg for it. Name-calling is so morally superior, yes.

Yes, these forums are full of toxicity. And it's always someone else's. Welcome to SL.

People are free to ignore my advice. There's a setting for it. But just because you don't like what I say doesn't mean I'm wrong. Next time I'll just listen to Fiona. Helping people is unwelcome if they don't like you here.

I used to be an extremely sweet and nice person, and all it got me was bullied. Yet, here I am, asking someone to reconsider something that could cause trouble, and they cheer people for calling me names. People respond by saying yeah, bad people say don't shoot others. Please think about it. Really.

Guys. When someone comes in asking for help with their script, the default reaction shouldn't be "this is senseless and you will get banned for it." I'm only saying "bad eggs" (and it was prompted by Fionalein's calling for bans) because this forum is supposed to be for helping with scripts, but you make false assumptions (about a script you can read in full) and scold them for it instead.

The concern is valid and pointing it out is not a bad thing, but the way it was done in this thread was bad.

How about I ask about ways to rez physical objects at a rate of 10-20 per second? Would you accuse me of trying to grief?
What about creating an object that follows an avatar while rezzing those objects at them and/or blinding them and playing loud sounds?
Go to a combat sim in a modern/futuristic setting. That's the norm you'll find. LL doesn't shut them down.

My point is, there are many applications for a lot of things that have a lot of potential as griefing tools. What's important (for everyone) is understanding the context for the script. If OP takes it outside of their land ("what's stopping them?"), even to other combat sims, they will obviously deal with the consequences then. It's not our job to judge whether someone's creativity deserves the help or not -- or at least, if you decide it doesn't, don't be a donkey about it.

Edited by Wulfie Reanimator
  • Thanks 1
Link to comment
Share on other sites

I want to mention that shooting someone on your own land, even with something made and sold for that purpose, can still get your account in trouble, but I don't want to sound like I'm harping.

In the hopes of furthering the constructivity, I will try to be nicer, but bear in mind my main left this forum earlier today because of how she was treated by others; there's always going to be some residual ugh when the sweet person gives up on being nice, it leaks out and gets on people. Apologies.

I see so much arrogance in this place so regularly it makes me not want to help people. I can't help wanting to help people though.

What I wish we had was a sticky about how to ask for help without being misunderstood and misunderstanding the people who post here regularly. Tips and things are great, and how to get started is scripting is great, but how to ask this forum for help in the most efficient way, without triggering everyone who's a refugee from a war zone could be good.

People new to all of this scripting jazz see the magic of it all. They see that OMG it can do this, and this, and what if I made it do... and that doesn't mean they're out to zap everyone who comes along. But there's also wanting to see people avoid the serious dismay of getting into trouble, or worse, incurring the wrath of someone who spent the 2,900 L$ on something more effective than an auto-targeting gun, and having them torment you with harassment by a hundred alts.

Some people really take it seriously when they're out exploring and someone shoots them or sets them on fire or even sends unwanted flowers at them, for that matter. I wouldn't expect people wanting to do awesome magical stuff to think of that, but I learned it the hard way.

Trying repeatedly to keep other people from learning things the hard way and getting hurt has made me bitter. Try to help, and if it isn't what someone wants to hear, it turns into some TV show or something.

I just don't want bad coding practices coming back to bite me in the butt someday, so to speak, as I have been so graciously reminded so many times. If I didn't try to avoid assisting people in getting hurt, I'd feel I was doing a lot more harm than good.

Link to comment
Share on other sites

I simply asked for scripting advice.  

I didn't ask to be called a liar, and be called a griefer and that I should be banned.

Stop with the head games.

16 hours ago, PheebyKatz said:

Perhaps it is an aggressive nature, coupled with fear of the aggression of others, that is behind the thinking, but in an environment other than a combat zone, it's just downright antisocial.

And IN a combat zone, you'd probably get kicked out for using something not part of their sealed, anti-cheating system.

Please understand, not everything people say that you don't like is a potential threat, and people not helping you with a weapon that targets people who aren't shooting you is to be applauded, not condemned, if you have any real feelings whatsoever.

So basically, someone comes to SL, gets frustrated, and wants to lash out. Gee, everyone's been there. Not everyone shoots people out of nowhere for it, though. Sure, effortlessly dealing with those who would do us harm is an attractive idea, but implementing it isn't so simple as shooting people for looking at you funny.

The above pyscho babble you wrote is insulting to say the least, and I ignored it for a while, but you persist.

Now, the script problem is solved and nothing further needs to be said, unless you need to explain yourself more (which is not needed or wanted).

THE END

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2105 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...