Gun & Target
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
07-26-2009 15:45
Hi all.
I'm trying to make a gun & target that will work in any Script zone.
i have the "generic" gun script and can do basic moding to say a code word instead of a bullet.
however is it possible to make assign a channel number based on current time?
what are the distance limits of the various chat types:
Whisper, Say, Shout ?
Thanks again.
|
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
|
07-27-2009 01:32
llWhisper is 10m, llSay is 20m, and llShout is 100m, and llRegionSay is the sim its in if set the listen channel by time the time it took to listen may miss come commands why do you need to change the channels?
_____________________
L$ is the root of all evil videos work! thanks SL 
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
07-27-2009 01:55
Thanks for the distances i knew some of them but didn't know which were which. From: someone why do you need to change the channels?
i don't really but then i don't have to worry about conflicting channels with other items. i have sorta worked it out using llGetUnixTime / (seconds in a day). this way it only changes every 24 hours. ^^ is playing up at the moment so i'm going to stick with a static channel. i will post my severely messed up code later.
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
07-27-2009 04:33
If you're having problems with similar objects belonging to other players communicating on the same channel, listen(integer channel, string name, key id, string message){ if(llGetOwnerKey(id)==llGetOwner()) {//do stuff } }
should fix it. In English -- if the object I've just heard from either belongs to my owner or is my owner, then do what I'm told. Otherwise ignore it.
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
07-27-2009 10:15
one of the simplest methods for setting up a known channel that is mostly unique for use between two objects that are rezzed separately, but must communicate with each other is to use part of the owners key cast to an integer.... an example would be
channel = (integer)llGetSubString( (string)llGetOwner(), 0 , 7 );
this will produce the same channel for any item owned by the same avatar.
for communications between items where one rezzes the other, use the start parameter of the llRez* command to send the channel you are using, and set the channel in your rezzed object in the on rez event using the variable passed to it.
in cases where the owned object will have multiple copies that you don't want to conflict with each other you can either replace the llGetOwner call from above with llGetKey()
always remember yo filter your listens even if they are on a unique channel, since someone could randomly use that channel also, and you might end up with bad commands passed if you don't filter.
example filtering: if (! llSubStringIndex( message, "My Product" )){ //-- the message must start with "My Product" to be valid (index == 0) }
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
07-27-2009 15:20
only just saw you message Void. sorta get the idea but this is for two different items with two different owners: gun= Joe Bloggs, Target = Jane Bloggs. From: someone listen(integer channel, string name, key id, string message){ if(llGetOwnerKey(id)==llGetOwner()) {//do stuff } }
should fix it. In English -- if the object I've just heard from either belongs to my owner or is my owner, then do what I'm told. Otherwise ignore it. i understand that BUT i want to have a GUN & a TARGET. Person A GUN shoots Person B TARGET Gun is owned by A. Target is owned by B. what i want and i've mostly done is a mini combat system. A shoots B (wearing target) effect happens. A shoots anyone else or B not in range NOTHING HAPPENS. also with particles can you target something that is NOT linked to the emitter. [NOT CODE] shoot particle @ ItemName "UBERCOOLNECKLACE" if in llsay range else llownersay "too far dumbass" [/NOT CODE]
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
07-27-2009 18:00
in the case of items tha have to interact between different avs, perhaps the same trick, only using llGetCreator?
and yes, you can target another object with particles *IF* you know it's uuid (which in the case of someone elses attachment will have to be advertised some way)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
07-27-2009 18:07
The gun will know the UUID of the projectile it's just rezzed, from the object_rez event, and the target will know the UUID of what's just hit it. Maybe you could do something with that?
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
07-27-2009 18:29
From: Innula Zenovka The gun will know the UUID of the projectile it's just rezzed, from the object_rez event, and the target will know the UUID of what's just hit it. Maybe you could do something with that? the whole idea is to make a particle only gun to use in no rez areas. also this way i only nee to have a small target to detect the "hit". From: someone and yes, you can target another object with particles *IF* you know it's uuid (which in the case of someone elses attachment will have to be advertised some way) would this work in an on_rez and either IM or llSay on some ridiculously high channel?
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
07-28-2009 00:11
From: Innula Zenovka The gun will know the UUID of the projectile it's just rezzed, from the object_rez event, and the target will know the UUID of what's just hit it. Maybe you could do something with that? given the bit about targets and guns having different owners, I'm thinking laser tag... in which case a worn attachment isn't going to get those collisions. you could use on_rez to do it... but here's the problem I see... that means the target has to rez AFTER the gun, or the gun misses the announcement... instead perhaps a system that listens for a command and then spits it's uuid out when it hears it... you could do it at firing time (possibly prone to slight delays) after registration time (say everone wears their gear and touch an object that send out the command, and then all weapons register new uuids for each target except theirs), or by constantly advertising their uuid on a timer not reccomended but avoids problems with logoffs, or rewears, and doesn't need a registration setup)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
07-28-2009 01:37
This is supposed to work in no-rez areas, right? So... where's this projectile coming from? Unless somebody knows some magic: no rez => no projectile => no collision, so can't use collisions to know that a target has been "hit".
For this to work, I think either the "gun" or the "target" has to decide whether there's a hit at time of firing, to determine whether or not the gun should emit particles. That would have to be based on some assessment of aiming accuracy to target, range, and any ballistics and dynamics one feels like throwing into the calculation.
I'm pretty sure the gun will know the target's UUID somehow in order to do this "hit or not" calculation, so one could use the first 7 hex chars of that UUID as the channel to chat between the target and gun, to isolate the chat from a combat system broadcast channel.
Although it's certainly possible to target particles to an attachment (example: particle leashes), it's just a viewer-side effect that an attachment has any location in world distinct from the agent to whom it's attached. That is to say, server-side targeting accuracy is necessarily in terms of the agent's location--so if the attachment just identifies the fact that a particular agent is a potential target, the gun could decide if it's aimed accurately enough at that agent to score a hit, and then tell the attachment about it.
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
07-28-2009 05:43
Yeah.. I hadn't fully appreciated this was a bulletless gun. Ordinal Malaprop has some code that might be of interest at http://ordinalmalaprop.com/engine/code/forward-avatar-intersect Tweak that for the range and to look for a scripted object called "target" and you're almost there, particularly because it offers a way of knowing if you've actually aimed at your target. Then shoot particles at llDetectedKey(0) if you've hit it. Afterthought -- actually, if the other av is wearing the target, you can't aim at that if you're using a sensor, can you? How would it be to start by broadcasting a message on a channel used by all targets, and then you build a list of the avatars whose targets respond, and shoot them rather than the target?
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
07-28-2009 10:06
From: Innula Zenovka Yeah.. I hadn't fully appreciated this was a bulletless gun. Ordinal Malaprop has some code that might be of interest at http://ordinalmalaprop.com/engine/code/forward-avatar-intersect Tweak that for the range and to look for a scripted object called "target" and you're almost there, particularly because it offers a way of knowing if you've actually aimed at your target. Then shoot particles at llDetectedKey(0) if you've hit it. Afterthought -- actually, if the other av is wearing the target, you can't aim at that if you're using a sensor, can you? How would it be to start by broadcasting a message on a channel used by all targets, and then you build a list of the avatars whose targets respond, and shoot them rather than the target? if the targets respond, you have their key, and don't need the av's for the particle targeting since their position and the particles will be client side effects... and if you run llGetOwnerKey on thos you have the av wearing the target too for the hit of miss calculations on that av's bounding box. somewhere here on the forums there is code for intersecting a bounding box, but I think the simplest would be calculate distance between the avs, and check if the offset point at that distance is within ~.5m of the detected av's position? not horribly accurate, but pretty close.
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
Update
07-28-2009 16:47
thanks guys/girls/other(SL is weird).
i have the gun working now. i'm going to take the easy way out and just use an generic door switch script (highly modded). where possible i'm using Link Messages to cut down on channel conflicts.
Reading through the posts the Laser Tag analogy is basically the PG version. (i might make one later based on this though.)
For the Communication between Gun & Target i'm using the generic switch again but i've generated a random 7 digit number and using a HEX code word. (try & conflict that.)
the only problem now is animation but i'm working through that with trial & error.
Thanks for all the help.
|