Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

how to use the llDamage parameter?

Robert Brearly
Sword Crafter
Join date: 15 Feb 2005
Posts: 8
02-24-2005 12:07
How do you use it, I want my swords to be able to damage people in my sim, but i have no idea how to use llDamage, I'll post my Sword Script so you can tell me where I need to insert llDamage script.

integer sleep = 7;

float DELAY = 0.2;
integer SWORD = 1;
integer strike_type;

integer have_permissions = FALSE;


integer armed = TRUE;

fire()
{
if (armed)
{

armed = FALSE;
llStartAnimation("throw_R";);
llSleep(0.5);
llSetTimerEvent(0.25);
strike_type = SWORD;
armed = TRUE;
}
}

default
{
state_entry()
{
llListen(5,"",llGetOwner(),"";);
if (!have_permissions)
{
llRequestPermissions(llGetOwner(),
PERMISSION_TRIGGER_ANIMATION| PERMISSION_TAKE_CONTROLS);
}
}
on_rez(integer param)
{
llResetScript();
}

listen(integer channel, string name, key id, string message)
{
if (message == "s";)
{
fire();
}
}

timer()
{
if ((strike_type == SWORD))
{
llSensor("", "", ACTIVE | AGENT | PASSIVE, 4.0, PI_BY_TWO*0.5);
}
else
{
llSensor("", "", ACTIVE | AGENT | PASSIVE, 3.0, PI_BY_TWO*0.5);
}
llSetTimerEvent(0.0);
}

sensor(integer tnum)
{
vector dir = llDetectedPos(0) - llGetPos();
dir.z = 0.0;
dir = llVecNorm(dir);
rotation rot = llGetRot();
if (strike_type == SWORD)
{
//llTriggerSound("crunch", 0.5);
dir += llRot2Up(rot);
dir *= 200.0;
llPushObject(llDetectedKey(0), dir * 2, <0,0,0>, FALSE);
}
strike_type= 0;
}

run_time_permissions(integer permissions)
{
if (permissions == PERMISSION_TRIGGER_ANIMATION| PERMISSION_TAKE_CONTROLS)
{
llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);
//llStartAnimation("hold_R_handgun";);
have_permissions = TRUE;
}
}

attach(key attachedAgent)
{
if (attachedAgent != NULL_KEY)
{
llRequestPermissions(llGetOwner(),
PERMISSION_TRIGGER_ANIMATION| PERMISSION_TAKE_CONTROLS);
}
else
{
if (have_permissions)
{
//llStopAnimation("hold_R_handgun";);
//llStopAnimation("aim_R_handgun";);
llReleaseControls();
llSetRot(<0,0,0,1>;);
have_permissions = FALSE;
}
}
}

control(key name, integer levels, integer edges)
{
if ( ((edges & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON)
&&;((levels & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON) )
{
fire();
}
}

touch_end(integer num)
{
if (have_permissions)
{

}
else
{

}
}

}
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
02-24-2005 12:49
All weapons that do damage via llDamage are projectile weapons, including swords. They rez a small projectile that hits hte target agent doing damage.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Kyrah Abattoir
cruelty delight
Join date: 4 Jun 2004
Posts: 2,786
02-25-2005 00:01
dont forget in order to mkae your sword ok to destroy the "sword bullet" shortly after releasing it for keeping a close combat range
_____________________

tired of XStreetSL? try those!
apez http://tinyurl.com/yfm9d5b
metalife http://tinyurl.com/yzm3yvw
metaverse exchange http://tinyurl.com/yzh7j4a
slapt http://tinyurl.com/yfqah9u