Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Melee/Sword Script.

Leelu Diesel
Registered User
Join date: 13 Oct 2008
Posts: 2
04-13-2009 15:36
Basically all I am wanting to know is are you able to create a first person sword/melee script that is basically one click one swing (Like Unreal Tornament), Or direction then click to swing (Like Morrowind) would be good to use as well, I'm not wanting click hold and direction. I am also quite curious as to why there isn't really any about (not that i have found so far) or why it isn't in use.

I would also like some help in creating a sword/melee script that is click to swing as so far I have only seen the comand to hold the LMB and then Direction to swing but have not seen an imput for just clicking to swing or hold direction then click to swing.

Any help would be greatly appreciated, flamers will be ignored or if they wish to debate their point then I will be happy to do so via PM. ^_^
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
04-13-2009 15:46
There are plenty mouse-click Melee weopons. I've seen them for Spell-fire and Azora, but not DCS2.
Not sure why LMB is so popular, but I think it has more to do with the combat meters being use.
An example mouse-click sword script can be found here:
http://www.freescriptlibrarysl.co.uk/Sword-script.php
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
04-13-2009 19:48
The prevalence of LMB+Direction is due to that being the Triggers many Combat Systems use.

As for using only LMB it'd be a matter of modifying a LMB+Direction in a relatively simple manner.

if( Held & (CONTROL_LBUTTON|CONTROL_ML_LBUTTON) )
{//A bunch of if( Change & Held & button) go here.//
}

into

if( Change & Held & (CONTROL_LBUTTON|CONTROL_ML_LBUTTON) )
{//Some kind of animation selection goes here.//
}

You can either use a increment or random for your animation selection.

**global variables**
list AttackAnimations = ["atk1","atk2","atk3","atk4"];
integer AttackAnimsCount;
[If using increment]integer LastAnim;
**/global variables**

**default:state entry**
AttackAnimsCount = llGetListLength(AttackAnimations);
**/default:state entry**

One of two animation selection modes:

**increment**
Animation = llList2String(AttackAnimations, LastAnim);
llStartAnimation(Animation); //Assumes Anim is Non-Looped
++LastAnim;
if( LastAnim == AttackAnimsCount ) { LastAnim = 0; }
**/increment**

or

**random**
integer Roll = llFloor( llFrand(AttackAnimsCount) );
Animation = llList2String(AttackAnimations, Roll);
llStartAnimation(Animation); //Assumes Anim is Non-Looped
**/random**
Tanith Rosenbaum
Registered User
Join date: 10 Sep 2008
Posts: 42
04-14-2009 02:03
From: Leelu Diesel
Basically all I am wanting to know is are you able to create (...)


I'm sorry to say, but this forum is more for requests along the lines of "I tried to do X with this code here, but I need help with that" or "I'm having trouble using function so and so", and less for requests of the kind "I would like a finished script that does X, can someone make it for me?".

You'll have more success by asking in the "Help Wanted" forum on this board for someone to do it for you as commission.
Leelu Diesel
Registered User
Join date: 13 Oct 2008
Posts: 2
04-14-2009 03:22
Thank you to everyone for their replies.

"You'll have more success by asking in the "Help Wanted" forum on this board for someone to do it for you as commission."

Sorry if it did not sound clear enough but I was not requesting for someone to do it as commision I was just wondering if it was possible to be done. ^_^
Takuan Daikon
choppy choppy!
Join date: 22 Jun 2006
Posts: 305
04-14-2009 05:09
From: Leelu Diesel
I was just wondering if it was possible to be done. ^_^

And the short answer is yes, of course :)

This makes me wonder if that kind of control system would work nicely for a gamepad in SL? I've tried using a gamepad controller for some of the in-world melee combat systems, and it's okay I guess, but just didn't feel right.

I'm gonna have to experiment with this ;)
Tanith Rosenbaum
Registered User
Join date: 10 Sep 2008
Posts: 42
04-14-2009 08:35
From: Leelu Diesel
Thank you to everyone for their replies.

"You'll have more success by asking in the "Help Wanted" forum on this board for someone to do it for you as commission."

Sorry if it did not sound clear enough but I was not requesting for someone to do it as commision I was just wondering if it was possible to be done. ^_^


Oh. Well in that case I agree with Takuan, the answer is definitely yes. *smiles*

Faust pretty much outlined the how already, nothing one needs to add to his explanation.
Vidia Vargas
Registered User
Join date: 18 Feb 2006
Posts: 2
12-16-2009 03:19
can some one help me with this script i'm trying to use it but im getting syntax errors
Tharkis Olafson
I like cheese
Join date: 17 Nov 2004
Posts: 134
12-16-2009 06:15
Holy necro post batman!

What exactly are you having trouble with? The example isn't a full implementation so it's not going to work out of the box.
_____________________
Proprietor of Steel Wolf Forge.
All around nice guy, if I get my sleep.
Vidia Vargas
Registered User
Join date: 18 Feb 2006
Posts: 2
12-17-2009 21:12
never mind i figured it out