Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Missle!

Galicon Lemieux
Registered User
Join date: 21 Jul 2005
Posts: 9
12-09-2005 16:02
hey, umm i found this on the fourum /54/d2/50368/1.html#post791845 And suck at scripting so I need to know how to put this all together. Itl be dropped from a plane, and be awesome. Any help would be helpful.

Sorry yall, thought noone would see my reply because it was far at the bottom of the list, but now its near the top! well, whatev, im not good at fourums.
_____________________
If it doesn't fit, get a big hammer.
Kage Seraph
I Dig Giant Mecha
Join date: 3 Nov 2004
Posts: 513
12-09-2005 20:05
Hi, Galicon,

You might try this thread for a (very simple, no frills) guided missile script. There are certainly other and better ways of doing it. Heck, just to get the missile to the victim, you could use llPushObject, llSetForce, llApplyImpulse, or llMoveToTarget for a physical missile or llSetPos for a nonphysical one.

Regarding a simple bomb, you could try something along the lines of the following (this is what I currently use). Essentially, it is nothing more than a common particle script that is triggered by collision events. I encourage you to look at this script and see how it works, then give it your own shot. You'll learn a lot better that way. As you can see, I didn't do the piecework myself, and I cheated myself some learning doing it that way:


CODE
// Particle Script 0.3
// Created by Ama Omega
// 10-10-2003

// Mask Flags - set to TRUE to enable
integer glow = FALSE; // Make the particles glow
integer bounce = FALSE; // Make particles bounce on Z plan of object
integer interpColor = TRUE; // Go from start to end color
integer interpSize = TRUE; // Go from start to end size
integer wind = FALSE; // Particles effected by wind
integer followSource = FALSE; // Particles follow the source
integer followVel = TRUE; // Particles turn to velocity direction

// Choose a pattern from the following:
// PSYS_SRC_PATTERN_EXPLODE
// PSYS_SRC_PATTERN_DROP
// PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
// PSYS_SRC_PATTERN_ANGLE_CONE
// PSYS_SRC_PATTERN_ANGLE
integer pattern = PSYS_SRC_PATTERN_EXPLODE;

// Select a target for particles to go towards
// "" for no target, "owner" will follow object owner
// and "self" will target this object
// or put the key of an object for particles to go to
key target = "";

// Particle paramaters
float age = 2; // Life of each particle
float maxSpeed = 4; // Max speed each particle is spit out at
float minSpeed = 3; // Min speed each particle is spit out at
string texture ="fire"; // Texture used for particles, default used if blank
float startAlpha = 1; // Start alpha (transparency) value
float endAlpha = 0; // End alpha (transparency) value
vector startColor = <1,1,1>; // Start color of particles <R,G,B>
vector endColor = <0.5,0.5,0.5>; // End color of particles <R,G,B> (if interpColor == TRUE)
vector startSize = <5,5,5>; // Start size of particles
vector endSize = <0,0,0>; // End size of particles (if interpSize == TRUE)
vector push = <0,0,5>; // Force pushed on particles

// System paramaters
float rate = 0.1; // How fast (rate) to emit particles
float radius = 2; // Radius to emit particles for BURST pattern
integer count = 15; // How many particles to emit per BURST
float outerAngle = 1.54; // Outer angle for all ANGLE patterns
float innerAngle = 1.55; // Inner angle for all ANGLE patterns
vector omega = <0,0,10>; // Rotation of ANGLE patterns around the source
float life = 0; // Life in seconds for the system to make particles

// Script variables
integer flags;

updateParticles()
{
flags = 0;
if (target == "owner") target = llGetOwner();
if (target == "self") target = llGetKey();
if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
if (wind) flags = flags | PSYS_PART_WIND_MASK;
if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;

llParticleSystem([ PSYS_PART_MAX_AGE,age,
PSYS_PART_FLAGS,flags,
PSYS_PART_START_COLOR, startColor,
PSYS_PART_END_COLOR, endColor,
PSYS_PART_START_SCALE,startSize,
PSYS_PART_END_SCALE,endSize,
PSYS_SRC_PATTERN, pattern,
PSYS_SRC_BURST_RATE,rate,
PSYS_SRC_ACCEL, push,
PSYS_SRC_BURST_PART_COUNT,count,
PSYS_SRC_BURST_RADIUS,radius,
PSYS_SRC_BURST_SPEED_MIN,minSpeed,
PSYS_SRC_BURST_SPEED_MAX,maxSpeed,
PSYS_SRC_TARGET_KEY,target,
PSYS_SRC_INNERANGLE,innerAngle,
PSYS_SRC_OUTERANGLE,outerAngle,
PSYS_SRC_OMEGA, omega,
PSYS_SRC_MAX_AGE, life,
PSYS_SRC_TEXTURE, texture,
PSYS_PART_START_ALPHA, startAlpha,
PSYS_PART_END_ALPHA, endAlpha
]);
}
killparticles()
{
llParticleSystem([]);
}




// Bullet // Ready Jack // 6.23.04 // 1.3
integer gTimeToDie = 10;

default
{
state_entry()
{
llSetPrimitiveParams([PRIM_TEMP_ON_REZ, TRUE]); // unreliable
llSetStatus(STATUS_PHYSICS | STATUS_DIE_AT_EDGE, TRUE);
//llSetBuoyancy(1.0); // uncomment for slow bullets
}

on_rez(integer start_param)
{
llPreloadSound("rocket explode");
if (!start_param) return;
llCollisionFilter("", llGetOwner(), FALSE);
llSetDamage((float)start_param);
llCollisionSound("", 1.0); // cancel default sound
llSetTimerEvent(gTimeToDie);
}

collision_start(integer count)
{
llMessageLinked(LINK_SET,0,"collision","");
integer type = llDetectedType(0);
if (type & AGENT) {
llWhisper(11235814,(string)llGetOwner() + " NULL_KEY 100");
llPlaySound("rocket explode",1);
llMessageLinked(LINK_SET,0,"collision","");
llSetStatus(STATUS_PHYSICS, FALSE);
// tricky stuff like proprietary damage goes here
llDie();
}
else
{
llWhisper(11235814,(string)llGetOwner() + " NULL_KEY 100");
llPlaySound("rocket explode",1);
llMessageLinked(LINK_SET,0,"collision","");
llSetStatus(STATUS_PHYSICS, FALSE);
updateParticles();
llSleep(2);
killparticles();
llDie(); // uncomment to disallow ricochet, unreliable
}
}

land_collision_start(vector pos)
{
llWhisper(11235814,(string)llGetOwner() + " NULL_KEY 100");
llPlaySound("rocket explode",1);
llMessageLinked(LINK_SET,0,"collision","");
llSetStatus(STATUS_PHYSICS, FALSE);
updateParticles();
llSleep(2);
killparticles();
llDie(); // uncomment for no-bounce, unreliable
}

timer()
{
llDie();
}
}
Jase Byrne
Eater of Paint Chips
Join date: 30 Jun 2004
Posts: 121
12-09-2005 20:51
Trust me Gallicon, the man KNOWS what hes talking about...


I've been his practice target for ..oh the past year.....

Good thing avies don't need insurance.


Peace and Brownies

Jase :cool:


ps: kage old son..until now I knew jack DIDDLY about scripting bombs...I figure you got a years worth of backpay comin...heh heh heh
_____________________
"There is no spoon-you will have to eat your cereal with your fingers..."
Kage Seraph
I Dig Giant Mecha
Join date: 3 Nov 2004
Posts: 513
12-09-2005 23:44
From: Jase Byrne
Trust me Gallicon, the man KNOWS what hes talking about...


I've been his practice target for ..oh the past year.....

Good thing avies don't need insurance.


Peace and Brownies

Jase :cool:


ps: kage old son..until now I knew jack DIDDLY about scripting bombs...I figure you got a years worth of backpay comin...heh heh heh


Sonofa... That's gonna leave a mark. x.x
Galicon Lemieux
Registered User
Join date: 21 Jul 2005
Posts: 9
Sup kage
12-10-2005 06:52
Kage, does that thing push and/or kill ? I need to know so i dont go firing it in the sandbox.:p Also thnx a lot for the script. How is it triggered?Just tested it, it says "syntax error"
_____________________
If it doesn't fit, get a big hammer.
Kage Seraph
I Dig Giant Mecha
Join date: 3 Nov 2004
Posts: 513
12-10-2005 08:32
From: Galicon Lemieux
Kage, does that thing push and/or kill ? I need to know so i dont go firing it in the sandbox.:p Also thnx a lot for the script. How is it triggered?Just tested it, it says "syntax error"


No, these munitions don't push. Damage isn't enabled in the sandboxen, so that's moot. As far as the syntax error, doublecheck the copying and pasting? I pulled these scripts out of my working weps. And really, this whole exercise will be waaay more valuable to you if you only use my scripts as a (goofy) template or proof of concept example.