Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-08-2009, 07:58 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
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.
__________________
*Sum41Freeeeek
*Frankie
Reply With Quote
  #2  
Old 05-08-2009, 08:38 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
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?
__________________

Reply With Quote
  #3  
Old 05-08-2009, 08:48 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
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);

Reply With Quote
  #4  
Old 05-08-2009, 03:40 PM
The_Blue_Cracka The_Blue_Cracka is offline
Blonk
The_Blue_Cracka's Avatar
Join Date: Nov 2004
Location: Pennsylvania
Posts: 147
The_Blue_Cracka is on a distinguished road
Send a message via AIM to The_Blue_Cracka
Why not use client strings?
__________________
2 kewl 4 an sigantrur!1
Reply With Quote
  #5  
Old 05-08-2009, 03:50 PM
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
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();
  }

__________________
*Sum41Freeeeek
*Frankie
Reply With Quote
  #6  
Old 05-08-2009, 07:41 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Frankie View Post
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().

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.
Reply With Quote
  #7  
Old 05-08-2009, 09:18 PM
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
ah okay. thanks for the help
__________________
*Sum41Freeeeek
*Frankie
Reply With Quote
  #8  
Old 05-09-2009, 10:03 AM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
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();
}
Reply With Quote
  #9  
Old 05-09-2009, 01:36 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by [email protected] View Post
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.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #10  
Old 05-09-2009, 04:15 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by LoneAngelIbesu View Post
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)
__________________
Reply With Quote
  #11  
Old 05-11-2009, 07:27 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
Thanks Crow
Reply With Quote
Reply


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 08:18 PM.


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