Special Sword prototype

Author Topic: Special Sword prototype  (Read 2020 times)

I am trying to create a sword that has a couple of functions, and I am using a couple of existing codes as a base, namely Gravity Cat's Cutlass from his Flintlock Weapons pack, and the Reflector Pixel from a certain Pixel Spells pack.

My goals are to create a Melee weapon capable of not only being able to block and parry other weapons, but also not be able to defend its user in a gun fight. #Don'tBringAGunToASwordFight
No. This will not be a lightsaber, since Trogtor is already working on that.

But I see a number of issues that may develop, even before completely finishing the code. Since there may be an unbalancing issue, I will place an energy function to this.
Namely, the parry function is what is bothering me the most. Unlike the block function, which protects the user from harm so as long as the user is holding the specific button, parrying is only supposed to last as long as the sword swing resolves. How would I manage to avoid a situation like that in which the code breaks, and the blocking is continuous?

Code is here, just for reference.

"This is a private paste"


This is cool. WHY THE forget DIDN'T ANYONE THINK OF THIS stuff BEFORE?!
« Last Edit: April 14, 2016, 12:46:48 PM by cooolguy32 »

This is cool. WHY THE forget DIDN'T ANY THINK OF THIS stuff BEFORE?!

If there is anything BL seems to offer, it's the fact that Melee combat is more lackluster than Gun fighting itself, and so, no one wants to improve it, considering that this entire mod might be composed of alternating swing animations, blocks, and deflects.

Correct me if I am wrong though.

I've always wanted to improve it. But no one seemed interested in helping. I was offering to script everything but couldn't find anyone to do the animations.

I've always wanted to improve it. But no one seemed interested in helping. I was offering to script everything but couldn't find anyone to do the animations.

Filipe does some, for a small price. I, in the meantime will try to learn myself in my own downtime.

This code I have provided is to act as a basis for the countless melee weapon ideas I have in store.
If you want to collaborate on this, I'd be more than happy to do so.

Some of your vector math is really oddly scripted (if not wrong)

You do this to get the projectile's speed
Code: [Select]
%velAvg = (mAbs(getWord(%proj.getVelocity(), 0)) + mAbs(getWord(%proj.getVelocity(), 1)) + mAbs(getWord(%proj.getVelocity(), 2))) / 3;You actually need to take the square root of the sum of the squares of the components (i.e., (x2+y2+z2)1/2), but this function does all of that for you concisely:
Code: [Select]
%velAvg = vectorLen(%proj.getVelocity());
This function will get the angle between two vectors for you
Code: [Select]
function getVectorAngle(%vec1, %vec2)
{
%vec1n = VectorNormalize(%vec1);
%vec2n = VectorNormalize(%vec2);

%vdot = VectorDot(%vec1n, %vec2n);
%angle = mACos(%vdot);

// convert to degrees and return
%degangle = mRadToDeg(%angle);
return %degangle;
}

There's a much quicker way to do this part:
Code: [Select]
if(%repelForce > %proj.origVelocity * 2.25)
   %repelForce = (2.25 * %proj.origVelocity); //We have to cap it at some point.
if(%repelForce <= %proj.getDatablock().muzzleVelocity / 2)
   %repelForce = (%proj.getDatablock().muzzleVelocity / 2); //Also imposing a minimum.
mClampF(%num, %min, %max) will force %num to be between %min and %max ("clamping" the range of values), so you can shorten the above to
Code: [Select]
%repelForce = mClampF(%repelForce, %proj.getDatablock().muzzleVelocity / 2, %proj.origVelocity * 2.25);

... parrying is only supposed to last as long as the sword swing resolves. How would I manage to avoid a situation like that in which the code breaks, and the blocking is continuous?
All you need to do here is make sure to construct the image datablock so that the states involved in parrying don't allow the player to change images and make sure the only transition from the parry start state is to the parry stop state.

Filipe does some, for a small price. I, in the meantime will try to learn myself in my own downtime.

This code I have provided is to act as a basis for the countless melee weapon ideas I have in store.
If you want to collaborate on this, I'd be more than happy to do so.
like what? a lewinsky? wait he does? how much and if there is link?

like what? a lewinsky? wait he does? how much and if there is link?
It's in the General Discussion. Shouldn't be too hard to miss.