Just thought I'd share this very small bit of code, mainly because while small, it can make a big difference in how well made a server can look.
What it does, is 'slide' the player to a new position. Anyways, here's the script. I'll post it so you can put it in a weapon, but if you know what you're doing I'm sure you can crop out the unneeded stuff and fix it into your own systems.
Anyways, what you do is...
core.goto(newx,newy);
And it will 'slide' the player to the new coordinates given. So you could do something like this in a shovel script...
PHP Code:
//#CLIENTSIDE
function onWeaponfired() {
core.goto(int(player.x+.5),int(player.y+.5));
//This will move the player to the nearest integer tile coordinate before
//digging your hole, lining up the player with the hole
//shovel stuff goes here...
}
So here's the script.
PHP Code:
//#CLIENTSIDE
function onCreated() {
core=this;
}
public function goto(newx,newy) {
dist=((newx-player.x)^2+(newy-player.y)^2)^.5;
while(dist>.1) {
player.x+=(newx-player.x)/5;
player.y+=(newy-player.y)/5;
dist=((newx-player.x)^2+(newy-player.y)^2)^.5;
sleep(0.05);
}
}
As for what it's useful for? Just making the game look a little more professional. I get tired of seeing players just 'jump' to a near area, or seeing a hole dug up offset from the shovel. You could incorporate it into many different things like opening doors. You could slide the player in front of the door and set their animation to a door opening gani.
Well, maybe I'm glorifying something too simple to be worth it, but I'd like to see more servers doing something along the lines of this!