Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help with anti-grief devices please

Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
12-22-2004 16:07
I'm currently trying to make an Expel Bracelet for club owners that makes ejecting nasty people quick and easy. It works just like a gun, but the bullets call llTeleportAgentHome() or llEjectFromLand() upon collision.

The problem is, the bullets don't act as expected. The first version did work though... on the wielder of the bracelet ! Hence the forward offest in the RezObject function.

Bracelet:
From: someone
// Expel Gun script

integer gDesiredPerm;
// Indicates whether wearer has yet given permission
integer gHavePermissions;

// Bullet travel speed
float fairyvelocity = 32.0;

float timebetweenfairies = 0.05;
// how long it takes to reload when holding
float timebetweenmanyfairies = 1.0;

// HACK: how far away the eye is from the avatar's center (approximately)
vector eyedelta = <0.0, 0.0, 0.84>;

default
{
on_rez(integer start_param)
{
// HACK: try to compensate for height of avatar
// by changing firing position appropriately
vector size = llGetAgentSize(llGetOwner());
eyedelta.z = eyedelta.z * (size.z / 2.0);

// NOTE: can't do this if we want to attach by dragging from
// inventory onto the av, because the llResetScript(); clears
// all the callbacks, including attach()
// llResetScript();

// NOTE 2: This can be uncommented in 1.1 because you won't have
// to ask for permissions, you can just take them. But for now
// it pops up two dialog boxes if you drag onto the av, so I'll
// leave it out.
// Try to attach to the rezzer
// if ( !gHavePermissions )
// {
// llRequestPermissions(llGetOwner(), gDesiredPerm);
// }
}

state_entry()
{
gHavePermissions = FALSE;
// this should be initialized directly with the variable
// but I can't do that due to a bug
gDesiredPerm = (PERMISSION_TAKE_CONTROLS);
llResetTime();
}

// Player attaches us, either by dragging onto self or from pie menu
attach(key av_key)
{
if (av_key != NULL_KEY)
{
// Can't attach if we don't own it
if ( av_key != llGetOwner() )
return;

//
// Always request permissions on attach, as we may be re-rezzing on login
llRequestPermissions(av_key, gDesiredPerm);

// run_time_permissions() is executed after this call
} else
{
if ( gHavePermissions )
{
// we are being detached
llReleaseControls();
llSetRot(<0.0, 0.0, 0.0, 1.0>;);
gHavePermissions = FALSE;
}
}
}

// this is called whenever llRequestPermissions() returns
// i.e. the user has responded or dismissed the dialog
// perm is the permissions we now have
run_time_permissions(integer perm)
{
// see if we now have the permissions we need
if ( (perm & gDesiredPerm) == gDesiredPerm )
{
// we got the permissions we asked for
gHavePermissions = TRUE;
llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);
} else
{
llWhisper(0, "Didn't get permissions...";);
}
}


// the player has used the controls, process them
control(key owner, integer level, integer edge)
{
// has our gun reloaded?
float time = llGetTime();

// see if av has fired
// (edge & level) == down edges, (edge & !level) == up edges
// repeat rate is faster for tapping than holding
if ( ( ((edge & level) & CONTROL_ML_LBUTTON)
&& (time > timebetweenfairies) )
|| ( (time > timebetweenmanyfairies)
&& (level & CONTROL_ML_LBUTTON) ) )
{
llResetTime(); // we fired, set timer back to 0

// HACK: gun shoots from gun pos, mouselook looks
// from player's eye, so we try to move the gun
// up to the eye. but we really don't
// know where it is, so we guess (see eyedelta)
vector my_pos = llGetPos() + eyedelta;
rotation my_rot = llGetRot();
vector my_fwd = llRot2Fwd(my_rot);

// Rez a bullet!
llRezObject("Expel Bullet",
(my_pos + 5 * my_fwd),
my_fwd * fairyvelocity,
my_rot,
1);
}

} // control

} // default state


And the bullets, spheres with a radius of 0.1:
From: someone

integer flying = FALSE;

default
{
on_rez(integer sparam)
{
llSetStatus(STATUS_DIE_AT_EDGE, TRUE);
llSetBuoyancy(1.0);
if (sparam)
{
flying = TRUE;
}
llVolumeDetect(TRUE);
}

collision_start(integer total_number)
{
if (flying)
{
integer type = llDetectedType(0);
if (type & AGENT)
{
llTeleportAgentHome(llDetectedKey(0));
//llEjectFromLand(llDetectedKey(0));
}
llDie();
}
}

land_collision_start(vector pos)
{
if (flying)
{
llDie();
}
}
}


I gave one to the owner of the land I was on and had him shoot at me, and though the bullets were hitting me and pushing me slightly I wasn't teleported home. What am I doing wrong ? The bullets are set as Physics and Phantom.
Torley Linden
Enlightenment!
Join date: 15 Sep 2004
Posts: 16,530
12-22-2004 16:10
Jesrad, I can't help ya with your prob, but I did want to say: nice to meet you inworld, and it's nice to see you talking on here! Cheerio and thanks for the dagger and rose :)
_____________________
Siobhan Taylor
Nemesis
Join date: 13 Aug 2003
Posts: 5,476
12-22-2004 16:18
The trick is not to use a projectile.

steps.

1. listen on a secret channel for the owner for a command and the name of the av to remove
2. on start do a llSensor() to grab the matching av-key
3. call an llUnSit() on the target
4. call llTeleportAgentHome() on the target.
_____________________
http://siobhantaylor.wordpress.com/
Upshaw Underhill
Techno-Hobbit
Join date: 13 Mar 2003
Posts: 293
12-22-2004 16:44
The projectile system could work but what if you miss?
(the problem may be that the bullet is rezzing close enough to you to cause a collision, change the 'eyeoffset' to <1,0,.64>, but still if you miss and send a good patron home...)

I agree with Sio, and if this is just a script in an object of the club just take out the llGetOwner() and anyone who knows the channel can activate it. (you could also add code to check to make sure that they are part of the 'executive' group before actually ejecting)
CODE

integer i;
default
{
state_entry()
{
llListen(1,"",llGetOwner(),""); //listen only for you on hidden chat channel 1
}
listen(integer channel, string name, key id, string message)
{
llSensor(message,NULL_KEY,AGENT,20.0,PI); //fire the sensor for the AV named
}
sensor(integer total_number)
{
for ( i = 0; i < total_number; i++ ) //loop through number of detected AVs (not
// likely to be more than one but...)
{
llUnSit(llDetectedKey(i));
llTeleportAgentHome(llDetectedKey(i)); //or llEjectFromLand if you'd rather
llInstantMessage(llDetectedKey(i)," You've been kicked from Cubey's Clubbiest Club for Clubbing Clubbers because you're just not that Clubby.");
}
}
}


I'm composing at work so it's uncompiled, but this should work as long as you are on
your own land.

L8r,
UU
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
12-22-2004 17:54
Thanks all :) I should have looked for a function that can take an AV name as parameter instead of using a projectile for designation.

I'm also planning to make a very very small vehicle to sit on, which passes back controls to the avatar so that it looks not like you're sitting on something at all, but which makes your collision model so small you cannot realistically be hit. Could it work, now that the Phantom AV bug is plugged ?
Smokey Hornpipe
Registered User
Join date: 8 Mar 2005
Posts: 3
Reply
03-15-2005 14:47
[What am I doing wrong ? The bullets are set as Physics and Phantom.]

Correct me if I am wrong, but doesn't Phantom cause an object not to collide with any others? That would lead me to believe that there would be no collision events fired. I think unchecking this box may solve your problem.
Chage McCoy
Aerodrome Janitor
Join date: 23 Apr 2004
Posts: 336
03-15-2005 14:57
Keep in mind these we NOT work on group owned land. You need to have another object (which the aerodrome crew likes to call a passive banisher) which has the soul purpose in life to listen for authenticated requests, and then do the ejection or tp home. This object is group deeded, so its ownership is the same as the land.
Carson Hadlee
They're coming to take me
Join date: 18 Jun 2004
Posts: 60
Lock Tite Security Systems
03-15-2005 23:15
Our team has resolved all these issues with our Lock Tite Line...if anyone is interested.

User friendly, variable channel, variable angle, variable range, variable to eject or teleport, allows non-owners to run - all on nice menu driven buttons.

Individual or group land fine.

We have both Guardians and Bouncers.

We also do networked systems for large area coverage - up to entire sims.

Carson Hadlee
Lock Tite Systems
"Meaner than a Junkyard Dog"