Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old 07-08-2008, 04:27 AM
kodster200 kodster200 is offline
One Globals Love To Hate
kodster200's Avatar
Join Date: Aug 2006
Posts: 17
kodster200 is an unknown quantity at this point
Awsome
Reply With Quote
  #3  
Old 07-08-2008, 04:41 AM
Frankie Frankie is offline
xChugxLifex
Frankie's Avatar
Join Date: Feb 2008
Location: New York
Posts: 1,610
Frankie is a jewel in the roughFrankie is a jewel in the rough
Send a message via AIM to Frankie Send a message via MSN to Frankie
this is really neat
good job
__________________
*Sum41Freeeeek
*Frankie
Reply With Quote
  #4  
Old 07-08-2008, 05:09 PM
kodster200 kodster200 is offline
One Globals Love To Hate
kodster200's Avatar
Join Date: Aug 2006
Posts: 17
kodster200 is an unknown quantity at this point
VERY useful no more do i get pms about door blockers
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 02:13 AM.


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