Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

sword script

Billybob Street
Registered User
Join date: 18 Aug 2004
Posts: 26
03-20-2005 12:38
i am trying to make a sword script that kills ppl in 1 hit any one know how to do that
Foolish Frost
Grand Technomancer
Join date: 7 Mar 2005
Posts: 1,433
03-20-2005 12:45
From: Billybob Street
i am trying to make a sword script that kills ppl in 1 hit any one know how to do that


Er... I didn't even know you could 'kill' people in SL. Wouldn't you need them to be wearing a scripted item to allow themselves to be affected?

Then it's just a matter of have the sword's script trigger the worn item to run a death animation on the wearer.
Spuds Milk
Registered User
Join date: 28 Sep 2004
Posts: 94
03-20-2005 13:43
You have to be in certain sims, or on land set kill_ok (I don't remember the real flag).

Check out the inventory library, there's some weapons there that show how it's done.
Damanios Thetan
looking in
Join date: 6 Mar 2004
Posts: 992
03-20-2005 15:19
http://secondlife.com/badgeo/wakka.php?wakka=llSetDamage
Billybob Street
Registered User
Join date: 18 Aug 2004
Posts: 26
03-20-2005 19:00
heres the script i got were do i add the set damage thing at


integer SWORD = 1;
integer PUNCH12 = 2;
integer PUNCHL = 3;
integer KICK = 4;
integer FLIP = 5;

integer strike_type;

default
{
state_entry()
{
llSetStatus(STATUS_BLOCK_GRAB, TRUE);
}
run_time_permissions(integer perm)
{
if (perm)
{
llTakeControls(CONTROL_ML_LBUTTON | CONTROL_LBUTTON | CONTROL_UP | CONTROL_FWD | CONTROL_BACK | CONTROL_ROT_LEFT | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_ROT_RIGHT | CONTROL_DOWN, TRUE, TRUE);
}
}

attach(key on)
{
if (on != NULL_KEY)
{
integer perm = llGetPermissions();

if (perm != (PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION))
{
llRequestPermissions(on, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
}
else
{
llTakeControls(CONTROL_ML_LBUTTON | CONTROL_LBUTTON | CONTROL_UP | CONTROL_FWD | CONTROL_BACK | CONTROL_ROT_LEFT | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_ROT_RIGHT, TRUE, TRUE);
}

}
else
{
llSay(0, "releasing controls";);
llTakeControls(FALSE, TRUE, TRUE);
}
}

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

control(key owner, integer level, integer edge)
{
if (level & (CONTROL_ML_LBUTTON | CONTROL_LBUTTON))
{
if (edge & CONTROL_UP)
{
llApplyImpulse(<0,0,3.5>,FALSE);
llStartAnimation("backflip";);
llTriggerSound("sword effect 1", 0.5);
llSetTimerEvent(0.25);
strike_type = FLIP;
}
if (edge & CONTROL_FWD)
{
llStartAnimation("sword_strike_R";);
llSleep(0.5);
llTriggerSound("sword effect 1", 0.5);
llSetTimerEvent(0.25);
strike_type = SWORD;
}
if (edge & (CONTROL_LEFT | CONTROL_ROT_LEFT))
{
llStartAnimation("punch_L";);
llTriggerSound("punch", 0.5);
llSetTimerEvent(0.25);
strike_type = PUNCHL;
}
if (edge & (CONTROL_RIGHT | CONTROL_ROT_RIGHT))
{
llStartAnimation("punch_onetwo";);
llTriggerSound("punch", 0.5);
llSetTimerEvent(0.25);
strike_type = PUNCH12;
}
if (edge & CONTROL_BACK)
{
llStartAnimation("kick_roundhouse_R";);
llTriggerSound("punch", 0.5);
llSetTimerEvent(0.25);
strike_type = KICK;
}
if (edge & CONTROL_DOWN)
{
llMoveToTarget(llGetPos(), 0.25);
llSleep(1.0);
llStopMoveToTarget();
}
}
}

sensor(integer tnum)
{
vector dir = llDetectedPos(0) - llGetPos();
dir.z = 0.0;
dir = llVecNorm(dir);
rotation rot = llGetRot();
if (strike_type == SWORD)
{
llTriggerSound("sword effect 1", 0.5);
dir += llRot2Up(rot);
dir *= 200.0;
llPushObject(llDetectedKey(0), dir, ZERO_VECTOR, FALSE);
}
else if (strike_type == PUNCH12)
{
llTriggerSound("punch", 0.2);
dir += dir;
dir *= 100.0;
llPushObject(llDetectedKey(0), dir, ZERO_VECTOR, FALSE);
}
else if (strike_type == PUNCHL)
{
llTriggerSound("punch", 0.2);
dir -= llRot2Left(rot);
dir *= 100.0;
llPushObject(llDetectedKey(0), dir, ZERO_VECTOR, FALSE);
}
else if (strike_type == KICK)
{
llTriggerSound("punch", 0.2);
dir += dir;
dir *= 100.0;
llPushObject(llDetectedKey(0), dir, ZERO_VECTOR, FALSE);
}
else if (strike_type == FLIP)
{
llTriggerSound("punch", 0.5);
llPushObject(llDetectedKey(0), <0,0,150>, ZERO_VECTOR, FALSE);
}
strike_type= 0;
}
}