Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   regarding setshape2 on clientside (https://forums.graalonline.com/forums/showthread.php?t=85497)

Frankie 05-08-2009 07:58 AM

regarding setshape2 on clientside
 
I'm making an invisible barrier (setshape2 on clientside)

I have it so only certain accounts can pass through, BUT, I want to make it so I can open/close the barrier to let people through that aren't listed, but I'm not sure how to do this since the script is clientside. if I add an open command, won't it only disable for the person opening it and not for the people I'm trying to let through since it's clientside? I hope I'm making sense here.

is there anyway around that? how can I make a blocking setshape on the serverside instead? that would be a solution.

haven't really scripted in a long time so I'm finding problems with such little things. thanks.

oo_jazz_oo 05-08-2009 08:38 AM

You could have a script clientside that if a certain attribute, say this.attr[15] is set equal to true, that any account can pass.

And then have a script serverside that allows you to say open or close that would switch this.attr[15] from true to false?

Gambet 05-08-2009 08:48 AM

Here you go, just customize it from here:

PHP Code:

function onPlayerChats()
{
 if (
player.chat == "open")
  {
   
dontBlock();
   
this.chat "Open";
   
scheduleEvent(2"BlockEntry""");
  }
}

function 
onBlockEntry()
{
 
blockAgain();
 
this.chat "Closed";
 
scheduleEvent(2"ClearChat""");
}

function 
onClearChat()
{
 
this.chat "";
}

//#CLIENTSIDE
function onCreated()
{
 
this.chat "";
 
setshape(13232);



The_Blue_Cracka 05-08-2009 03:40 PM

Why not use client strings?

Frankie 05-08-2009 03:50 PM

yours works great Gambet, but it wasn't really what I was looking for.

I eventually just worked out the problem myself. I have 2 actiongrabs, one on clientside, one on serverside. the one on clientside lets you go through personally. the one on serverside allows you to open the barrier for other people.

PHP Code:

function onCreated()
{
  
setshape(12*166*16);
}

function 
onActionGrab()
{
  if (
player.account in {"Sum41Freeeeek""The411"})
  {
    if (
player.chat == "open")
    {
      
dontblock();
      
sleep(2);
      
blockagain();
    }
  }
  else {
    
blockagain();
  }
}

//#CLIENTSIDE
function onCreated()
{
  
setshape(12*166*16);
}

function 
onActionGrab()
{
  if (
player.account in {"Sum41Freeeeek""The411"})
  {
    
dontblock();
    
sleep(2);
    
blockagain();
  }
  else {
    
blockagain();
  }



Gambet 05-08-2009 07:41 PM

Quote:

Originally Posted by Frankie (Post 1490268)
yours works great Gambet, but it wasn't really what I was looking for.

Your new version is exactly like mine with the dontBlock() and blockAgain(). :p

That's really all that I was trying to show you, you didn't need to take everything that I used line-by-line I just made it like that for my own debugging purposes to make sure it worked and to show you how it worked. From my example, you were supposed to use the method as you saw fit and customize it to whatever you needed it to do, as you did. :)

Frankie 05-08-2009 09:18 PM

ah okay. thanks for the help :D

[email protected] 05-09-2009 10:03 AM

Might want to use save strings for the accounts, here's how

HTML Code:

function onCreated() {
  save[0] = "Sum41Freeeeek,The411";
}

function onActionGrab() {
  if (!(player.account in save[0].tokenize(","))) return;
  if (player.chat != "open") return;
  this.dontblock();
  setTimer(2);
}
function onTimeout() {
  this.blockagain();
}
//#CLIENTSIDE
function onCreated() {
  this.setshape(1, 2*16, 6*16);
}
function onActionGrab() {
  if (!(player.account in save[0].tokenize(","))) {
    temp.timer = 0;
  } else {
    this.dontblock();
    temp.timer = 2;
  }
  setTimer(temp.timer);
}
function onTimeout() {
  this.blockagain();
}


LoneAngelIbesu 05-09-2009 01:36 PM

Quote:

Originally Posted by [email protected] (Post 1490427)
Might want to use save strings for the accounts, here's how

What does that do, aside from creating an unnecessary global variable and extra checks? I've never seen nor heard of a predefined save array.

Crow 05-09-2009 04:15 PM

Quote:

Originally Posted by LoneAngelIbesu (Post 1490437)
I've never seen nor heard of a predefined save array.

It's about time then.

Edit: Extract from commands.rtf:
HTML Code:

save[0],..,save[9]              built-in variables that work in online mode (integer values >=0, <=220)

[email protected] 05-11-2009 07:27 PM

Thanks Crow ^^


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

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