Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Non-Player Block (https://forums.graalonline.com/forums/showthread.php?t=134259482)

xAndrewx 06-12-2010 02:37 PM

Non-Player Block
 
Is there any way to make the player none blocking? So the player is still there but you can walk through them (without making the level nopkzone)

DustyPorViva 06-12-2010 02:56 PM

Nope :(

xAndrewx 06-12-2010 03:09 PM

Ah x-x

damn

Entrok 06-12-2010 03:52 PM

Something like this?

Anti-Blocking Script

was posted 07-16-2007 by HolySheepy

Quote:

Originally Posted by HolySheepy (Post 1331198)
Hi,

so there was this Spar Room, but outside of the Spar the people where annoyed because they were blocked by other people. So i made this script.

Credits
  • Misconception - for helping me with testing it
  • kc/KirbyZen - for helping me with testing it
  • Tortoise - for allowing me to make it public
  • The people on these forums, that told me to use player.level.name instead of player.level :p

This Script was made for Delteria and was first used there. But you can use it on your server if you want.

If you find any bugs, let me know.

This script was styled with the /style command of the rc, so don't blame me for styling :P

this.includelevels = if you have this.exmode = 1; this is a list of levels where the script will be enabled

this.excludelevels = if you have this.exmode = 0; this is a list of levels where the script will be disabled

this.disabledzones = a list of arrays
format for each array: { level, startx, starty, endx, endy }
if the players x and y are in startx/starty and endx/endy then the script will be disabled

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
this.oldx = -1;
  
this.oldy = -1;
  
this.oldkeydown = { 000};
  
this.includelevels = { "kaljun_sparcomplexmain.nw" };
  
this.excludelevels = { };
  
this.disabledzones = { { "kaljun_sparcomplexmain.nw"17.51743.532 } };
  
this.exmode 1;
  
// Ex Modes:
  // 0 - Used in every Level except for those in this.excludelevels
  // 1 - Used only in Levels of this.includelevels
  
setTimer0.05 );
}
function 
onTimeout() {
  
this.speed player.shieldpower == 0.6 0.5;
  
this.modx = { 0, -this.speed0this.speed };
  
this.mody = { -this.speed0this.speed};
  
this.cmodx = { 000};
  
this.cmody = { 002};
  
this.mods = { "y""x""y""x" };
  if ( 
checkLevel() == true ) {
    if ( 
checkDisabled() == true) {
      
setTimer0.05 );
      return ;
    }
    for ( 
0this.modx.size(); i++ ) {
      if ( 
keydown) ) {
        if ( 
this.oldkeydown] == ) {
          
this.oldkeydown] = 1;
        } else {
          if ( 
this.(@ "old" this.mods] ) == player.(@ this.mods] )) {
            if ( !
onwall3player.0.5 this.modx], player.this.mody], 2) && testplayer2player.0.5 this.modx] + this.cmodx], player.this.mody] + this.cmody] ) != -) {
              if ( 
player.ani != "walk" ) {
                if ( 
player.ani == "grab" || player.ani == "pull" ) {
                  if ( 
keydown) ) {
                    
setTimer0.05 );
                    return ;
                  }
                }
                if ( 
checkTiletypesplayer.0.5 this.modx], player.this.mody], 22, { } ) == true ) {
                  
setani"sit""");
                }
                else if ( 
checkTiletypesplayer.0.5 this.modx], player.this.mody], 22, { 1112 } ) == true ) {
                  
setani"swim""" );
                }
                else {
                  
setani"walk""" );
                }
              }
              
player.+= this.modx];
              
player.+= this.mody];
            }
          }
        }
      } else {
        if ( 
this.oldkeydown] == )
          
this.oldkeydown] = 0;
      }
    }
  }
  
this.oldx player.x;
  
this.oldy player.y;

  
setTimer0.05 );
}

function 
checkDisabled() {
for ( 
czthis.disabledzones ) {
    if ( 
cz] == player.level.name ) {
      if ( 
player.x in cz], cz] | && player.y in cz], cz] | )
        return 
true;
    }
  }
  return 
false;
}

function 
checkLevel() {
  switch ( 
this.exmode ) {
    case 
0: {
        return ( !( 
player.level.name in this.excludelevels ) );
      }
      break;
    case 
1: {
        return ( 
player.level.name in this.includelevels );
      }
      break;
  }
  return 
false;
}

function 
onwall3startxstartycheckwcheckh ) {
  return ( 
checkTiletypesstartxstartycheckwcheckh, { 202122 } ) );
}

function 
checkTiletypesstartxstartycheckwcheckhtilec ) {
  
this.foundw 0;
  if ( 
tiletypestartxstarty in tilec ) {
    
this.foundw 1;
  }
  if ( 
this.foundw == ) {
    for ( 
cx startxcx startx checkwcx += 0.1 ) {
      for ( 
cy startycy starty checkhcy += 0.1 ) {
        if ( 
tiletypecxcy in tilec ) {
          
this.foundw 1;
          break;
        }
      }
    }
  }
  return ( 
this.foundw );
}

function 
testplayer2checkxchecky ) {
for ( 
pplayers ) {
    if ( 
player.id != p.id )
      if ( 
checkx in p.1.5p.| && checky in p.0.5p.| )
        return ( 
p.id );
  }
  return ( -
);


p.s.: maybe i will do some optimization and post a updated version


xAndrewx 06-12-2010 05:20 PM

hmm, thanks. that's like a custom movement though

fowlplay4 06-12-2010 05:24 PM

Stefan really needs to implement:

player.blockagain() and player.dontblock()

Then a lot of door-blocking problems could be fixed and not require a GP to settle it.

xAndrewx 06-12-2010 05:34 PM

Yeah, I agree ^^

cbk1994 06-12-2010 08:23 PM

Quote:

Originally Posted by fowlplay4 (Post 1581546)
Stefan really needs to implement:

player.blockagain() and player.dontblock()

Then a lot of door-blocking problems could be fixed and not require a GP to settle it.

Or better yet, player.setShape.

salesman 06-12-2010 08:27 PM

all of the above

Lance 01-13-2011 07:44 AM

Pardon the necromancy, but did any player-(non)blocking functions get added since this post? Even something simple like clientside functions to control whether or not other players are blocking without having to declare the whole level a clientside nopkzone would be fantastic.

Tigairius 01-13-2011 07:44 AM

Quote:

Originally Posted by Lance (Post 1622433)
Pardon the necromancy, but did any player-(non)blocking functions get added since this post? Some clientside function to control whether or not other players are blocking without having to declare the whole level a clientside nopkzone would be fantastic.

To my knowledge, no they haven't.

DustyPorViva 01-13-2011 07:49 AM

noplayeronwalls() doesn't even work clientside, it sucks :/

Lance 01-13-2011 07:55 AM

Quote:

Originally Posted by Tigairius (Post 1622434)
To my knowledge, no they haven't.

Drat!

Quote:

Originally Posted by DustyPorViva (Post 1622437)
noplayeronwalls() doesn't even work clientside, it sucks :/

Even something simple like that (as long as I could toggle it on and off at will, anyway) would be fine for my purposes. Stefan, please add it!

Cloven 01-13-2011 08:07 AM

Quote:

Originally Posted by fowlplay4 (Post 1581546)
Stefan really needs to implement:

player.blockagain() and player.dontblock()

Then a lot of door-blocking problems could be fixed and not require a GP to settle it.

Quote:

Originally Posted by cbk1994 (Post 1581591)
Or better yet, player.setShape.

^The above pretty much sums it up. This would be very useful and help to make gameplay much more dynamic.

adam 01-13-2011 08:40 AM

Nice features. Please add.


All times are GMT +2. The time now is 12:35 PM.

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