Jump to content

Newbie: Missile Launcher with HUD Button


Ganthrithor
 Share

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

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

Recommended Posts

Ok. I've got a HUD button I named "Boom". I've got a rocket launcher attached to the R Shoulder named "Launcher". In its inventory is a missile named "Projectile". I'm trying to make a script that will rez "Projectile" at the position of "Launcher" in the rotation relative to "Launcher" and at a high forward velocity. I'm using a snippet of code from http://wiki.secondlife.com/wiki/Artillery for the llRezObject part. What I'm not clear on is the function required to make the "Launcher" script initiate upon Touching the HUD button "Boom". This is so I can terrorize my class on monday in SL.  :D

 

PS. I tried making the script respond to touching the actual "Launcher", but apparently it doesn't register as a "touch" if one is touching objects attached to one's person.

Link to comment
Share on other sites

There should be no problem detecting touches on attachments and that is the best way to go.  Since the HUD is a separate object the alternative is to have a script in the HUD that chats (llWhisper or llRegionSayTo) a message to the launcher when you click the 'boom' button.  The launcher script will need to listen (llListen) for the message and do all the work, since it has the projectile in its inventory.

(Or you can skip the HUD and just have the launcher listen to you, then do its thing when you say "FIre!" or some such)

Link to comment
Share on other sites

It should look like this:

In the HUD code in global variables:

COMCHAN = -6443634;                                              // or whatever number you like, negative number recommended

In the HUD code after button "Boom is touched:

 llWhisper(COMCHAN, "Boom");                               // whisper cuz you are not gonna be further than 10m from attachment

In the launcher code in global variables:

COMCHAN = -6443634;                                              // must be the same as in HUD

In the Launcher code in the state entry:

 llListen(COMCHAN, "","", "Boom")

NEW EVENT in the launcher code :

listen(integer chan, string name, key id, string mes)
{

     start_launcher_ from_here();

}

Link to comment
Share on other sites

partyOn(){llParticleSystem([ PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_DROP, PSYS_SRC_MAX_AGE, 0., PSYS_SRC_BURST_RATE, .01, PSYS_SRC_BURST_PART_COUNT, 6, PSYS_SRC_ACCEL, <0,0,0>, PSYS_SRC_ANGLE_BEGIN, 1., PSYS_SRC_ANGLE_END, 0., PSYS_SRC_OMEGA, <0.0,0.0,0.0>, PSYS_PART_MAX_AGE, 0.6,  PSYS_PART_START_COLOR, <.9,.7,0>, PSYS_PART_END_COLOR, <.9,.7,0>, PSYS_PART_START_ALPHA, 1, PSYS_PART_END_ALPHA, 0.3, PSYS_PART_START_SCALE, <0.3,0.3,0>, PSYS_PART_END_SCALE, <.01,.01,0>, PSYS_PART_FLAGS , 0 | PSYS_PART_EMISSIVE_MASK | PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK //| PSYS_PART_WIND_MASK]);}default{     land_collision(vector pos)     {          llDie();     }          collision (integer pos)    {        llDie();    }          on_rez(integer start_param) {       llSetTimerEvent(5.0);    }    timer() {        llDie();    }                            }

 

 Why doesn't my "Projectile" die? It just rolls around like an idiot not dying.

Die after land collision appear to work, but die after ordinary collision or after 5 second timer does not work.

 

I need them to disappear after a few seconds or if they hit something. How hard is that? I can't find any simple explanations anywhere.

 

Link to comment
Share on other sites

I'm in a Sandbox inside a world where there are no build priviledges except for in the Sandbox. Even then, I can fire missiles but when they collide with buildings they don't die (even when the building is within the sandbox). I also have trouble with the "llSetStatus(STATUS_DIE_AT_EDGE, TRUE);" on state entry function. They just don't die at the edge.

Link to comment
Share on other sites

Well, it's about as dirt simple as a script can get (Ignoring the particle function at the top, which doesn't do anything at all). There's nothing in the script to make it not work, so it's something that you have done to the object itself, or something in the environment.  If you made the object phantom, for example, it wouldn't respond to a collision event.  Firing it at a phantom building won't work either.  That timer will always work, though, unless it's in a no-script zone.  Same with STATUS_DIE_AT_EDGE.  If your projectile travels into a no-script zone beyond the sandbox, it will be incapacitated.

Link to comment
Share on other sites

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