[T2] Vengeance mod

Got that. I don't think I'll do it right now (it's 0:30 am), but sometime later today probably... turns out I'll have to do a lot of parsing to get it right... not too complicated, just a lot of work, which I already had enough of yesterday and today. :) Night all, and just to make you suffer a bit too, you can think about how to prove that 0 is neither positive or negative. :D
 
Tried it out, it is a bit too powerfull on the reeling in side but is definatly more like the one in T:V. GJ so far.
 
ZOD said:
Tried it out, it is a bit too powerfull on the reeling in side but is definatly more like the one in T:V. GJ so far.

It is powerfull. With a little focus on my part, I came to sort of like it. True, there is no room for slacking. But the results can be ... well ... interesting. I think perhaps with reel acceleration bound to a key, it would provide enough variability to be useful from lazy swinging to aggressive catapulting. Sort of interesting IMO. It provides one potential answer to the question of replacing what will be the missing 3000 meter speed ski route.
 
Hmm, I finially got around to taking a look this morning Zod. Looks promising. On a side note, if you remember Jebus from your Ren days, I trained him last night at work.. :roller:
 
I modified Amadeus's grapplinghook.cs

// We cancel schedules when player switches to another weapon -
// WeaponImage::eek:nUnmount and DefaultGame::eek:nClientKilled

datablock TargetProjectileData(GrappleBeam)
{
directDamage = 0.0;
hasDamageRadius = false;
indirectDamage = 0.0;
damageRadius = 0.0;
velInheritFactor = 1.0;

maxRifleRange = 250;
beamColor = "0.1 1.0 0.1";

startBeamWidth = 0.30;
pulseBeamWidth = 0.20;
beamFlareAngle = 3.0;
minFlareSize = 0.0;
maxFlareSize = 400.0;
pulseSpeed = 6.0;
pulseLength = 0.150;

textureName[0] = "special/nonlingradient";
textureName[1] = "special/flare";
textureName[2] = "special/pulse";
textureName[3] = "special/expFlare";
beacon = false;
};

datablock ItemData(GrapplingHook) : TargetingLaser
{
image = GrapplingHookImage;
pickUpName = "a grappling hook";
computeCRC = false;
};

datablock ShapeBaseImageData(GrapplingHookImage) : TargetingLaserImage
{
item = GrapplingHook;
projectile = GrappleBeam;
usesEnergy = true;
minEnergy = 5;
cutOffEnergy = 10;

stateName[3] = "Fire";
stateEnergyDrain[3] = 3;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateTransitionOnTriggerUp[3] = "ReelIn";
stateTransitionOnNoAmmo[3] = "ReelIn";
stateSound[3] = TargetingLaserPaintSound;
//stateTimeoutValue[3] = 2.0;
//stateTransitionOnTimeout[3] = "Deconstruction";

stateTimeoutValue[5] = 1.5;

stateName[6] = "ReelIn";
stateFire[6] = true;
stateSound[6] = TargetingLaserPaintSound;
stateAllowImageChange[6] = false;
stateScript[6] = "onReelIn";
stateTransitionOnTriggerDown[6] = "Deconstruction";
//stateTimeoutValue[6] = 2.0;
//stateTransitionOnTimeout[6] = "Deconstruction";
};

function GrapplingHookImage::eek:nFire(%data, %obj, %slot)
{
//error("GrapplingHookImage::eek:nFire(" SPC %data.getName() SPC %obj.client.nameBase SPC %slot SPC ")");
%p = Parent::eek:nFire(%data, %obj, %slot);
if(isObject(%p))
{
%obj.grapplePos = %p.getTargetPoint();
$GrapplePoint = %obj.grapplePos;
%dist = vectorDist(%obj.grapplePos , %obj.getPosition());
if(%dist > 250)
{
%p.delete();
%obj.lastProjectile = "";
%obj.grapplePos = "";
return;
}
//$rad = %dist;
%obj.grappleObject();
%p.schedule(300, "delete");
}
}

function Player::grappleObject(%obj)
{
if(isObject(%obj))
{
if(isEventPending(%obj.grappleSchedule))
cancel(%obj.grappleSchedule);

if(%obj.getState() !$= "Dead")
{
// %obj.setVelocity("0 0 5");
%vel = %obj.getVelocity();
%mass = %obj.getDatablock().mass;
%pos = %obj.getWorldBoxCenter();
%rad = VectorSub($GrapplePoint, %pos);
//%radRec = (1 / getWord(%rad, 0)) SPC (1 / getWord(%rad, 1)) SPC (1 / getWord(%rad, 2));
%dist = VectorDist(%pos, $GrapplePoint);
%force = VectorScale(%rad, %mass / (8.5*%dist));
%newVel = VectorAdd(%vel, %force);
%obj.setVelocity(%newVel);
echo("***********" NL "pos:" SPC %pos NL "GP:" SPC $GrapplePoint NL
"rad:" SPC %rad NL "radRec:" SPC %radrec NL "vel:" SPC %vel NL
"force:" SPC %force NL "***********");

%obj.grappleSchedule = %obj.schedule(250, "grappleObject");
}
}
}

function GrapplingHookImage::eek:nReelIn(%data, %obj, %slot)
{
if(isObject(%obj))
{
if(isEventPending(%obj.grappleSchedule))
cancel(%obj.grappleSchedule);

%dist = vectorDist(%obj.grapplePos , %obj.getPosition());
if(%dist > 250)
{
%data.deconstruct(%obj, %slot);
return;
}
%obj.reelIn();
}
}

// was 5
$TractorPower = 5;
function Player::reelIn(%obj)
{
if(isObject(%obj))
{
if(isEventPending(%obj.reelSchedule))
cancel(%obj.reelSchedule);

if(%obj.getState() !$= "Dead")
{
//%vec = VectorNormalize(VectorSub(%obj.grapplePos, %obj.getMuzzlePoint($WeaponSlot)));
//%targetermass = %obj.getDatablock().mass;
//%targetmass = 20000;
//%mul = $TractorPower - ($TractorPower * %targetermass) / (%targetmass + %targetermass);
//%nvec = vectorScale(%vec, %mul);
//%obj.setVelocity(%nvec);
%vel = %obj.getVelocity();
%mass = %obj.getDatablock().mass;
%pos = %obj.getWorldBoxCenter();
%rad = VectorSub($GrapplePoint, %pos);
//%radRec = (1 / getWord(%rad, 0)) SPC (1 / getWord(%rad, 1)) SPC (1 / getWord(%rad, 2));
%dist = VectorDist(%pos, $GrapplePoint);
%force = VectorScale(%rad, %mass / (8.5*%dist));
%tracVel = VectorScale(VectorNormalize(%rad), $TractorPower);
// %newVel = VectorAdd(VectorAdd(%vel, %force), %tracVel);
//JLB vvvvvvvvvvv
%newVel = VectorAdd(%vel, %tracVel);
%obj.setVelocity(%newVel);
%obj.reelSchedule = %obj.schedule(250, "reelIn");
}
}
}

function GrapplingHookImage::deconstruct(%data, %obj, %slot)
{
if (isObject(%obj.lastProjectile))
{
%obj.lastProjectile.delete();
%obj.lastProjectile = "";
}
%obj.grapplePos = "";
if(isEventPending(%obj.grappleSchedule))
cancel(%obj.grappleSchedule);

if(isEventPending(%obj.reelSchedule))
cancel(%obj.reelSchedule);

%obj.use(%obj.prevWeapon);
}


It behaves a little better. (less forcefull by default). However, you can still generate great speed by either continuing to hold the 'fire' on the hook or by jetting. You can get a gentler 'swing' by firing the hook and releasing immediately. The reel force is weak. You must provide initial momentum.

We could try something like this while Amadeus finishes his work on his new approach.
 
Actually, that new approach seems to be rather buggy and also a pain in the ass, so I think I'll get back to this one and make some enchancements to it. Right now I have both versions saved on my comp as well as the original, and if I get fed up with one of them I'll work on the other one. :D
 
Amadeu5 said:
Actually, that new approach seems to be rather buggy and also a pain in the ass, so I think I'll get back to this one and make some enchancements to it. Right now I have both versions saved on my comp as well as the original, and if I get fed up with one of them I'll work on the other one. :D


Try the new hook. (Very minor change. I initialed it).
 
Amadeu5 said:
What exactly did you change?

// %newVel = VectorAdd(VectorAdd(%vel, %force), %tracVel);
//JLB vvvvvvvvvvv
%newVel = VectorAdd(%vel, %tracVel);


%vel is effected by forces from gravity to jets anyway. Plus, I believe the reelin function is interatively called until the 'fire key' is released. Which would result in %newvel iteratively increasing. The %force was too much and I'm not sure why it was being used. Were you trying to simulate gravity? Isnt that embedded in %vel?
 
Last edited:
I see.


This approach calculates the force needed to keep the player on track and adds it to his original speed. The other one would calculate the speed and direction the player should be traveling in and set his speed to that, regardless of his former speed (which of course is still part of the calculation). I think I'll be going with the first one, although there are some elements in the second one that will come in handy, so at leat it wasn't a complete waste of time.
 
Amadeu5 said:
I see.


This approach calculates the force needed to keep the player on track and adds it to his original speed. The other one would calculate the speed and direction the player should be traveling in and set his speed to that, regardless of his former speed (which of course is still part of the calculation). I think I'll be going with the first one, although there are some elements in the second one that will come in handy, so at leat it wasn't a complete waste of time.

I edited my post. And did you try it? :)
 
I didn't try it, but there is still much to put in there to make it better. (taking gravity into account for example). It still doesn't watch a lot of things it should.
 
Amadeu5 said:
I didn't try it, but there is still much to put in there to make it better. (taking gravity into account for example). It still doesn't watch a lot of things it should.

Consider the hook massless. Your attempt to include that additional force was the problem. %vel already has been modified by the application of gravity. If you jump off a building, %vel will reflect the force of gravity from point in time to point in time. You dont need to do a thing with it I dont believe other than add %vel to what is basically reel velocity. Which is what my minor change did.

By adding that additional force you are creating an impulse.
 
%vel is the speed the player is going. Mid-swing, the direction of this velocity is tangent. To keep the object on a circular path, you need to apply the right amount of radial force (%force) to it. In the reelIn function, I add $TractorPower to %force (which should be just enough to keep the player on path with the same radius) to get the player closer and closer to the grapple point.


btw, isn't there an arcSin() in T2? It would make my job sooo much easier... :(
 
Amadeu5 said:
%vel is the speed the player is going. Mid-swing, the direction of this velocity is tangent. To keep the object on a circular path, you need to apply the right amount of radial force (%force) to it. In the reelIn function, I add $TractorPower to %force (which should be just enough to keep the player on path with the same radius) to get the player closer and closer to the grapple point.


btw, isn't there an arcSin() in T2? It would make my job sooo much easier... :(

%vel is a 'speed'. But it is generated as the product of applied forces like gravity and jets. (From point in time to point in time). the velocity of the player (%vel) added to the velocity of the reel (applied force of the reel which produces an implied velocity) produces a net velocity (%newvel). Gravity is applied else where to produce a new %vel. And you can change the 'force' applied by the reel by releasing 'fire' later. Try it. %vel represents the net effect of all forces in the game except for the force of the reel. The force of the reel can be dealt with simply as an implied velocity. Not numerically accurate, but as a general model it is. (I believe).
 
Method #3.


I first set the player on a tangential path, then apply the force needed to keep him on the track. Doing the math for it on paper right now, we'll see how it turns out...
 
I updated again. Now at Beta 5.30.04

Armors have been tweaked a bit. Worked out some bugs and made AI work better with the mod. New hook is in with some syntax changes so it can be used on a server.
 
ZOD said:
I updated again. Now at Beta 5.30.04

Armors have been tweaked a bit. Worked out some bugs and made AI work better with the mod. New hook is in with some syntax changes so it can be used on a server.
Let me guess, %vel[%obj] instead of %vel throughout the whole script, with all the other variables too. :)
 
I think I'm on to something this time...

Right now it doesn't handle the z axis, but it's pretty neat on the horizontal plane, even though it can only rotate you in one direction as of yet. Once I get that fixed and throw the z axis in the calculation it's gonna be near perfect.
 
Back
Top