Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

working on a combat boat game (ideas)

Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
06-24-2008 13:13
i started a game a long time ago when i was still in tg with my one friend i desided to get back into it and i kinda lost my touch with sensors

here is my plan and what i got done/need help with

as of right now i just have a basic sensor down to finding the objects, it will send out a sensor repeat looking for the boats when it spots it, it will love by about .1 untill it is within range then fire at it but i have no idea how id detect its range

basic sensing script

CODE

default
{
state_entry()
{
llSensorRepeat("Boat", "",PASSIVE, 10.0, PI, 1);
}
sensor(integer num_detected)
{
llLookAt(llDetectedPos(0),3.0, 1.0);
llSetText("!",<1,0,0>,1);
// llSetPos(llGetPos()+ ?); or llMoveToTarget ?
// what to d for detecting if within X ammount of m of the boat
}
no_sensor()
{
llSetText("",<1,1,1>,1);
llStopLookAt();
}
}
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
06-24-2008 13:40
Just some thoughts :)
What if there is more than one object named "boat" in the combat zone? Will the other "boat" also be looking for an object named "boat"?
Maybe a menu aligned with the sensor to give a choice as to what object to go after and fire upon?
How ever you do it it sounds like fun.
Good luck
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
06-24-2008 13:44
ya there will be more objects named boat but id going to work in a way to define the boats so they dont get over confused, i figured out a small problem but i still cant figure out a way to make it stop X ammout of m away from the boat
i was looking at llTarget but it dosent tell you crap on lslwiki.net and wikilsecondlife seams to be down atm

CODE

default
{
state_entry()
{
llSensorRepeat("Boat", "",PASSIVE, 10.0, PI, 1);
}
sensor(integer num_detected)
{
llSetText("!",<1,1,1>,1);
llLookAt(llDetectedPos(0),3.0, 1.0);
llMoveToTarget(llDetectedPos(0),10);
}
no_sensor()
{
llSetText("",<1,1,1>,1);
llStopLookAt();
}
at_target(integer number, vector targetpos, vector ourpos)
{
llStopMoveToTarget();
// fire at other boat
}
}