Author Topic: Aligning a client to a postion, and measuring distance.  (Read 804 times)

Alright.  So this is what I want:

A player will build a village far in the distance. Then they will type summat like /village Blockland. Then, a different player can be like, "Hey, I wanna go to Blockland!". So then he can type /travel Blockland. Then, somehow, the player will twist until they are facing Blockland, and then start walking. Once they are to the point someone marked, they will stop. Don't worry about them getting stuck in between, I've got that covered.

I don't need you to write the whole script for me, but if you want, go ahead :D . But I can still use it as I please...

It's not done yet

Code: [Select]
new SimGroup(VillageGroup);

function serverCmdVillage(%client, %name) {
   if( isObject(%client.village) ) {
      messageClient(%client, '', '\c2You have already created \'%1\'', %client.village.name);
      return;
   }

   %client.village = new ScriptObject() {
      name = %name;
      position = %client.player.getPosition();
   };

   VillageGroup.add(%client.village);

   messageAll('', '\c2%1 created a new village: %2!', %client.name, %name);
}

function serverCmdTravel(%client, %name) {
   %village = -1;

   for(%i = 0; %i < VillageGroup.getCount(); %i++) {
      %v = VillageGroup.getObject(%i);
      if( %v.name $= %name ) {
         %village = %v;
         break;
      }
   }

   if( %village < 0 ) {
      messageClient(%client, '', '\c2There is no village named \'%1\'', %name);
      return;
   }

   %pos = %village.position;
   %client.player.aimAt(%pos);   
}

function Player::aimAt(%this, %position) {
   // To do...
}

Nice :D . Yeah, it's the aiming part that'll be the most trouble.

I've got a project underway, but it's not gonna be very public, wanna help?