JoelTyrone Posted August 25, 2017 Share Posted August 25, 2017 Im trying to script a flying object that roams around my sim. Im trying to script it soi that it only "sees" an avatar that Is in front of its "eye" , and only in Line of Sight. I need to know how to make It roam, how to make it sense an avatar that is only in its line of sight, and only fire its weapons at people of a certain group. Any help is appreciated. Leave a comment here, or contact me inworld. Link to comment Share on other sites More sharing options...
Rolig Loon Posted August 25, 2017 Share Posted August 25, 2017 That's a lot of stuff for a beginning scripter to handle. I suggest getting the basics of LSL under your belt first. Start with some simple tutorials and then start practicing on sample scripts to see how they work. Then work up to your project as an intermediate goal. You are creating a self-guided security drone -- not an easy job. Attack the project in modules. Creating a roaming object is one challenge. Learning how sensors work is another one. Mastering the subject of rotations and aiming anything is another one. And then writing filters to identify specific targets is another. 1 Link to comment Share on other sites More sharing options...
JoelTyrone Posted August 26, 2017 Author Share Posted August 26, 2017 13 hours ago, Rolig Loon said: That's a lot of stuff for a beginning scripter to handle. I suggest getting the basics of LSL under your belt first. Start with some simple tutorials and then start practicing on sample scripts to see how they work. Then work up to your project as an intermediate goal. You are creating a self-guided security drone -- not an easy job. Attack the project in modules. Creating a roaming object is one challenge. Learning how sensors work is another one. Mastering the subject of rotations and aiming anything is another one. And then writing filters to identify specific targets is another. I know how scripts work. I know the basics. I say Beginning because it seems that is I dont, people assume I know what they are talking of. Im used to scripting weapons, not drones. That's why I need the help Link to comment Share on other sites More sharing options...
Innula Zenovka Posted August 26, 2017 Share Posted August 26, 2017 (edited) Since it's flying, you can't really use pathfinding to make your drone wander, which would otherwise be the obvious option. Probably keyframed motion would be the best option. So you would need to give the drone some simple rules to follow in choosing its next destination as it patrols (and to ensure it stays on the parcel, doesn't run into trees and buildings and the like); As Rolig suggests, llSensorRepeat, with a tight arc for the sensor, would be the obvious way to spot targets. However, that will also see avatars who may be hiding behind or inside objects. If you want to avoid that, when you do spot someone, follow it up with llCastRay to make sure there's nothing in between the drone and the target . If you want the drone to attack only people with the same active group as that to which the drone is set, or only people who don't have the right active group, that's easy --llDetectedGroup and llSameGroup both tell you if the target's group is the same as yours or not.. However, if you want it to attack only people with a particular group active that isn't the same as that of the drone, you would need to use, I think, the method using llGetAttachmentList that I reference here. Getting it to turn and aim directly at a target once it's detected one needs a working knowledge of rotations, as Rolig says. Once you have the drone working, then if you describe how you have it set up, I (or plenty of other people here) can certainly help you calculate how to turn it to aim at the target. Edited August 27, 2017 by Innula Zenovka Link to comment Share on other sites More sharing options...
Rolig Loon Posted August 26, 2017 Share Posted August 26, 2017 I agree with Innula. I'd go with KFM too. If I were scripting it, I would set up two logical situations -- probably running each in a separate state in the movement script. One situation is the drone's normal, ho-hum condition, where you may choose to have it follow either a fixed course, or a random course, or just sit idle. The other situation is the drone's "alarmed" condition, when it has detected someone and needs to get to the person's position, or at least look at it. In both of those situations, the movement task is the same: (1) determine the drone's current position, (2) decide on a destination, (3) create a KFM path between the start and the destination, (4) go there. Rinse, repeat. The main difference between those two situations is in how you do step 2. What you do when the drone gets there is another matter. Link to comment Share on other sites More sharing options...
JoelTyrone Posted August 29, 2017 Author Share Posted August 29, 2017 Thank you all for responding. I will certainly try what you hav suggested. Thank you for replying! Link to comment Share on other sites More sharing options...
Recommended Posts
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