Change the player's speed?

Discussion in 'Plugin Development' started by ChrizC, May 22, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    ChrizC

    Hey guys,

    I'm working on adding a feature to my plugin EatSugar, where when you eat sugar, you enter a "sugar rush" which increases your speed 1.5 times.

    How do I change the player's speed effectively? I've been playing about with Vectors and setVelocity and setX() etc. for about an hour now, and so far all I've accomplished is flinging my player half-way across the map and to it's death.

    Cheers

    Chris
     
    garbagemule likes this.
  2. Offline

    garbagemule

    Hey Chris!

    First of all,
    LOL.

    If you are familiar with vector multiplication, you can try multiplying the velocity vector by a new Vector with coordinates (1.1, 1, 1.1) for starters, and then increase those decimals until you get the desired effect. I wrongly thought a (1,2,1) vector would throw my players a couple of blocks up in the air when I was testing my snowball plugin, and the result was a lot of people flying up in the air with low health and falling down to be greeted with a Respawn button.

    I'm not sure exactly how you apply the vector, though, so be careful. This might actually accelerate the player indefinitely, if you apply it more than once. Let me know how it goes!
     
  3. Offline

    ChrizC

    Thanks for the reply, gm.

    That does nothing to effect my player's speed.
    Are you available on IRC?

    Chris
     
Thread Status:
Not open for further replies.

Share This Page