Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-12-2007, 10:42 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Player-Block Warper

PHP Code:
//Player-Block Warper
//Automatically warps a player around another player to prevent blocking.
//By: Gambet

//#CLIENTSIDE
function onCreated()
{
 
onTimeOut();
}

function 
onTimeOut()
{
 for (
aplayers)
  {
   if (
a.account != player.account)
    {
     if (
player.x in |a.x-2.5,a.x+2.5| && player.y in |a.y-2.5,a.y+2.5|)
      {
       
this.distance = ((((a.player.x) ^ 2) + ((a.player.y) ^ 2)) ^ 0.5);
       if (
this.distance in |1,3|)
        {
         switch(
player.dir)
          {
           case 
"0":
            if (!(
onwall(a.x+1.5,a.y)))
             {
              if (
keydown(0))
               {
                
player.a.2;
               }
             }
            break;
           case 
"1":
            if (!(
onwall(a.x-0.5,a.y+2)))
             {
              if (
keydown(1))
               {
                
player.a.2;
               }
             }
            break;
           case 
"2":
            if (!(
onwall(a.x+1.5,a.y+3)))
             {
              if (
keydown(2))
               {
                
player.a.2;
               }
             }
            break;
           case 
"3":
            if (!(
onwall(a.x+3.5,a.y+2)))
             {
              if (
keydown(3))
               {
                
player.a.2;
               }
             }
            break;
          }
        }
      }
    }
  }
 
setTimer(0.05);


I havn't tested it with a wide majority of players having the system, so I'm not sure if it would need adjusting or not. If it does, then you can adjust the values yourself, the core of the system is already done anyways, so some simple coordinate check-changes shouldn't be a problem.


NOTE: You can add level restrictions and level-coordinate restrictions and so forth yourself to fit your own sparring arenas or battle arenas that you may not want this to affect the players in.



Hope it helps.

Last edited by Gambet; 07-12-2007 at 10:59 PM..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:12 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.