[T2] Vengeance mod

ZOD said:
Well first thing is, vectorDist returns the distance in meters between two vectors, it doesn't return a vector. So getWord on it won't return anything but the first word.

You don't need to use posFromTransform, just use %obj.getPosition or %obj.getWorldBoxCenter().

It looks as though you are appling way to much impulse, the engine no likey that and will freeze on you. I would use setVelocity instead, but will also crash if it is above 1200.
Yes, well, I have yet to find a place that EXPLAINS the functions and not just lists them... all I'd really need is what functions use and return... more exactly the vector functions and applyImpulse, I don't think I'd need anything besides those...


Anyway, SetVelocity won't work, because you still need to keep the player moving in the direction he originally went. Just apply some force to him to keep him on track.

I'll give it another shot... btw what's that Tribal IDE thing do exactly?
 
I used a standalone version of it. That one was a syntax aware editor with color highlighting and syntax checking. It also had some vl2 awareness I think also.

This version appears to be a vl2 which would explain why it would be able to provide some debuging abilities.

There were about 3 different indexed lists of function online. None of them appear to be up.
 
Last edited:
Hooray!


Looks like it actually was the amount of force... I just divided it by 5000 and it works... as in doesn't freeze immediately. It's still buggy as hell, but at least now I can work with it.


One question: can I use VectorSub to get the vector between the grapple point and the player? Or are vectors and positions different in T2? (don't see why they would be...)

And another one: how would I, for example, apply upward momentum to the player in game via console?
 
JimBodkins said:
I used a standalone version of it. That one was a syntax aware editor with color highlighting and syntax checking. It also had some vl2 awareness I think also.

This version appears to be a vl2 which would explain why it would be able to provide some debuging abilities.

There were about 3 different indexed lists of function online. None of they appear to be up.
For coding, I use TribalCoder. It has color coding, but no syntax checks (which I don't really lack that much).


I already found a list of functions by Zear, but it's a) quite incomplete (no vector functions for example), b) doesn't give any explanation on the functions, not even what type of parameters they need and what they return. Btw what does VectorNormalize do?
 
Plasmatic said:
Reduces the vector so all components are < 1. Essentially scales it down.
more correctly, it scales it down so the length is equal to 1. result is called a normal vector.. with that, you could (for example) multiply it by 15 and youd get a vector that represents a 15 meter difference
 
Making progress!


Right now it's way too strong (the passive function pulls you in the center in a few moments), but it's definately resembling a circular path. I'm working on it right now, and if God wants it too then it'll be ready this evening. :bigthumb:
 
Amadeu5 said:
Making progress!


Right now it's way too strong (the passive function pulls you in the center in a few moments), but it's definately resembling a circular path. I'm working on it right now, and if God wants it too then it'll be ready this evening. :bigthumb:

:)

BTW, you will need to arrange for hosting. Maybe KillerONE.

Also, name/version this (beta-amadeus-1) so it will remain distinct. Comment your code so you can identify modifications that are exclusively yours. (Initial them //Amadeus ) Your code or someone elses will need to be blended with ZOD's inevitable updates.
 
Last edited:
I'll be heading out for the weekend.. better get it to me in the next few hours if you want it hosted. I can also have Exit Wound do it after.. I'm not sure of his schedule though. The sooner the better!!! :)

I'll be unavailable after 5pm CST.
 
Okay, I'll post it now but continue working on it. This is the whole GrapplingHook.cs. I did not sort out all the junk yet.


Code:
// We cancel schedules when player switches to another weapon - 
// WeaponImage::onUnmount and DefaultGame::onClientKilled

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::onFire(%data, %obj, %slot)
{
   //error("GrapplingHookImage::onFire(" SPC %data.getName() SPC %obj.client.nameBase SPC %slot SPC ")");
   %p = Parent::onFire(%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::onReelIn(%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();
   }
}

$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);
	%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);
}

Note that I didn't give this excessive testing. It's still has much to work on, but at least it doesn't freeze you. Imo it's way too rubbery and I have no idea how it works with med/heavy armor, but it's def. better than what it was so far. ;)
 
Starting a whole new method now... I tried messing around with the above, but I couldn't make it any significantly better. The second version should be much more accurate: at first it won't allow any rope stretching (subject to change), and it won't pull you in if you're closer to the grapple point than you were when you grappled. Some nasty vector math, but I'm hoping to be able to make it in an hour so Killer can upload it. :)
 
Amadeu5 said:
Starting a whole new method now... I tried messing around with the above, but I couldn't make it any significantly better. The second version should be much more accurate: at first it won't allow any rope stretching (subject to change), and it won't pull you in if you're closer to the grapple point than you were when you grappled. Some nasty vector math, but I'm hoping to be able to make it in an hour so Killer can upload it. :)

I just tried (local hosting) the version you are replacing. I like it. (Better than the original). Additive speeds. Arcs etc. Nice.

I'm not sure what you didnt like.
 
JimBodkins said:
I just tried (local hosting) the version you are replacing. I like it. (Better than the original). Additive speeds. Arcs etc. Nice.

I'm not sure what you didnt like.
I'm a maximalist prick. I want it to be VERY CLOSE to that in T:V. That version is not close enough to it. :)
 
HO would love this. Generates major speed for all armors. Not that this community is interested in speed. :)

The first hook will kill you and/or speed you to the point of passing meteor unless you demonstrate skill in controlling speed. That is good also. I have killed myself and placed myself out of position due to excessive speed any number of times. But I have also properly used speed on occasion. Not as much at this point. But I suspect this will be a skill issue.

I hope the new one is as energetic. I'm saving the old one just in case.

P.S.
You could take the reel acceleration from the move forward or backward keys. (Or maybe map a new key for reel acceleration).
 
Last edited:
JimBodkins said:
HO would love this. Generates major speed for all armors. Not that this community is interested in speed. :)

The first hook will kill you and/or speed you to the point of passing meteor unless you demonstrate skill in controlling speed. That is good also. I have killed myself and placed myself out of position due to excessive speed any number of times. But I have also properly used speed on occasion. Not as much at this point. But I suspect this will be a skill issue.

I hope the new one is as energetic. I'm saving the old one just in case.
Well, judging from the speed the new one throws you off in a completely different way you should be going, I think you'll be satisfied. :)
 
Back
Top