I found a topic about it while searching, but I still don't exactly understand. I know it has something to do with applying velocity. Does it function similarly to the add velocity function? I'm trying to make something like a black hole. What does it do? What are its uses?
Is this the code to drag something to a position?
%impulseVec = VectorSub(%targetObject.getWorldBoxCenter(), %position);
%impulseVec = VectorNormalize(%impulseVec);
%impulseVec = VectorScale(%impulseVec, %impulse * %distScale);
%targetObject.applyImpulse(%position, %impulseVec);
Can someone explain it to me? What exactly are they trying to do?
Impulses are similar to the add velocity function in that they both add motion.
The main and crucial thing to remember is that impulses add the velocity relative to a location.

In this example, the dot at the top is this code
BlackDot1.addVelocity("5 0 0");While the dot at the bottom is
BlackDot1.applyImpulse(RedDot.getPosition(),"500 0 0");This is why the 1st blue dot goes directly right, and the 2nd is skewered
The force isn't being applied directly, rather it's being applied slightly below and to the left, so it leaves the dot slightly higher than it would if the position was right behind the black dot.
This is also the reason why Rocket Launchers don't always give people the same blast. They do a radius search for the people hit, and blast them away from the center of the explosion, which in many cases, results in different knock backs due to different positions.
In the example code, a negative force is created which infact would pull people toward the center given enough strength from the impulse and other factors. If you want me to go more indepth just ask.
Edit: Another problem is that I'm creating this class, similar to Overwatch's Tracer, where your special ability is to go back in time. Your position/health/weapons/ammo gets restored. I was wondering what the most efficient way to do this was. In order to teleport back, would I have to individually save the player's position every second? Or is there an easier way?
The best solution would probably be to have a loop or some way of checking every second yes.
Proceed to store ammo / health / position / weapons everytime the loop is run. If anyone else has a cleaner idea, go ahead.
Also, is there a setHealth command?
I'm sure there's a %player.setHealth(amount); command since it's an event and all events can be called through code. You might want to also look into the functions %player.setDamageLevel(); (This is setHealth but on a more basic and raw level) and %player.getDamageLevel(); (This is getHealth but on a more basic and raw level). DamageLevels are essentially how much damage you've taken thus far vs how much health you're missing thus far.
Another one, is there a way to easily stop momentum on a player, or do I just have to addVelocity in the opposite direction?
%player.setVelocity("0 0 0"); ?