Author Topic: More Creative Playertypes  (Read 946 times)

^^^

- I want a playertype that onTrigger will add your velocity...

/discuss

we need a mega man playertype

Are we talking about armor::onTrigger? If so, what do you mean? That command is called on for many things, such as jumping, right and left clicking, and jetting. If it's any of those (or the others i'm missing), this doesn't have to be an entire playertype but simply a two-minute script. Here, actually:
package TriggerType
{
   function armor::onTrigger(%armor, %player, %slot, %value)
   {
      if(%slot == 1) //This is the slot that it will be activated for. Change this to your needs.
      {
         %player.addVelocity("0 100 0"); //Change this to your needs. You could use addRelativeVelocity if you have that add-on installed.
      }
      parent::onTrigger(%armor, %player, %slot, %value);
   }
};
activatePackage(TriggerType);

You can also add velocity based in the direction you are going, or forward velocity.

forward velocity.
Code: [Select]
%fVec = %pl.getForwardVector();
%fX = getWord(%fVec,0);
%fY = getWord(%fVec,1);
%eyeVec = %pl.getEyeVector();
%eX = getWord(%eyeVec,0);
%eY = getWord(%eyeVec,1);
%eZ = getWord(%eyeVec,2);
%eXY = mSqrt(%eX*%eX+%eY*%eY);
%aimVec = (%fX*%eXY) @ " " @ (%fY*%eXY) @ " " @ %eZ;
%obj.setVelocity(vectorAdd(%pl.getVelocity(),vectorScale(%aimVec,"25")));


Code: [Select]
package TriggerType
{
function armor::onTrigger(%armor, %player, %slot, %value)
{
if(%slot == 1 && getSimTime()-%player.lastTriggerLaunch > 5000)
{
%player.lastTriggerLaunch = getSimTime();
%fVec = %player.getForwardVector();
%fX = getWord(%fVec,0);
%fY = getWord(%fVec,1);
%eyeVec = %player.getEyeVector();
%eX = getWord(%eyeVec,0);
%eY = getWord(%eyeVec,1);
%eZ = getWord(%eyeVec,2);
%eXY = mSqrt(%eX*%eX+%eY*%eY);
%aimVec = (%fX*%eXY) @ " " @ (%fY*%eXY) @ " " @ %eZ;
%obj.setVelocity(vectorAdd(%player.getVelocity(),vectorScale(%aimVec,"25")));
}
parent::onTrigger(%armor, %player, %slot, %value);
}
};
activatePackage(TriggerType);
« Last Edit: May 19, 2015, 02:47:36 AM by Swollow »

Quote
package TriggerType
{
   function armor::onTrigger(%armor, %player, %slot, %value)
   {
      if(%slot == 1 && getSimTime()-%player.lastTriggerLaunch > 5000)
      {
         %player.lastTriggerLaunch = getSimTime();
         %fVec = %player.getForwardVector();
         %fX = getWord(%fVec,0);
         %fY = getWord(%fVec,1);
         %eyeVec = %player.getEyeVector();
         %eX = getWord(%eyeVec,0);
         %eY = getWord(%eyeVec,1);
         %eZ = getWord(%eyeVec,2);
         %eXY = mSqrt(%eX*%eX+%eY*%eY);
         %aimVec = (%fX*%eXY) @ " " @ (%fY*%eXY) @ " " @ %eZ;
         %obj.setVelocity(vectorAdd(%player.getVelocity(),vectorScale(%aimVec,"25")));
      }
      parent::onTrigger(%armor, %player, %slot, %value);
   }
};
activatePackage(TriggerType);
I tested this script, but when i right click, nothing happens

presumably because you never said 'on right click'

presumably because you never said 'on right click'
wtf, i thought onTrigger was right click. Every1 forgive me

onTrigger is when you right click, click, crouch or jet. (Correct me if I missed them all instead of saying "that's wrong")

On that code, you can see if the slot is 4, not sure why it is 1. I think swollow forgot something.

onTrigger is when you right click, click, crouch or jet. (Correct me if I missed them all instead of saying "that's wrong")

On that code, you can see if the slot is 4, not sure why it is 1. I think swollow forgot something.
%slot:
0 = Activate
1 = Unused
2 = Jump
3 = Crouch
4 = Jet

when johnny blockhead had used slot 1 i assumed it would work with something,
my bad with assuming rather than looking it up

also make sure %value is equal to true when doing this or the click and the release will be counted