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 07-16-2007, 06:59 AM
Cherrykao Cherrykao is offline
Banned
Join Date: Apr 2007
Posts: 37
Cherrykao is on a distinguished road
showing GUI for all players

according to my understanding, GUI's are clientside. i've been scratching my head for a while on how I could show a specific GUI for all players no matter where they are on the server.

In a specific level, a staff player chats "/commands" to bring up a GUI which has buttons with commands. On one of the buttons, he can click on it and it should show a GUI at the upper right hand corner of the screen for everyone on the server. This new GUI which appears has a button that allows players to click on it to warp into the room. This is like an event warper.

I have the actual code in a CLASS and the CLASS is attached to an NPC in a level using the "join" function: join staffcommand;

The script is around 500-700 lines of codes, so I don't think i'll post the code here. I'm just curious on how to get the GUI to show for everyone on the server if this is possible.
Reply With Quote
  #2  
Old 07-16-2007, 07:05 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
What you would do, is triggerserver in the weapon(this is for the person starting the warp thing), and then triggerclient all the players to display the GUI.
Reply With Quote
  #3  
Old 07-16-2007, 07:26 AM
Cherrykao Cherrykao is offline
Banned
Join Date: Apr 2007
Posts: 37
Cherrykao is on a distinguished road
can you show an example? i tried it before, but couldn't get it to work:

PHP Code:
function onActionServerside() {
  
player.triggerclient("Clientside",this.name,NULL);
}


//#CLIENTSIDE
function onPlayerChats() {
  if (
player.chat == "/commands") {
    
triggerserver("Serverside"this.name,NULL);
  }
}

function 
onActionClientside() {
  new 
GuiDrawingPanel("dp_eventgui") {
    
width 320;
    
height 64;
    
= ((screenwidth width) - 10);
    
10;
    
clearall();
    
drawimage(0,0,"imagegui.png");
    
canMove false;
    
canResize 0;
    
visible 1;
    
canClose 1;
    
canMaximize 0;
    
canMinimize 0;
    
    new 
GuiBitmapButtonCtrl("bmpbtn_joinevent") {
      
width 30;
      
height 30;
      
260;
      
21;
      
normalbitmap "button.png";
      
mouseoverbitmap "button1.png";
      
pressedbitmap "button.png";
    }
  } 
// gui end

Reply With Quote
  #4  
Old 07-16-2007, 07:34 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I don't know GS2 well enough, and I don't remember much about serverside.
But it'd be something like:
PHP Code:
for (i:playerscount) {
  
with(player.i).triggerclient("Clientside",this.name,NULL); 

Or something like that, I think I just butchered it, but I'm sure you get the idea. That, or wait for someone who knows to show up
Reply With Quote
  #5  
Old 07-16-2007, 07:41 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Nice try Dusty, but I recommend going with this instead:

PHP Code:
function onActionServerside() {
  for (
plallplayerspl.triggerClient("gui"name"");



EDIT: Make sure all players actually have the wNPC!
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #6  
Old 07-16-2007, 07:52 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by xXziroXx View Post
Nice try Dusty, but I recommend going with this instead:

PHP Code:
function onActionServerside() {
  for (
plallplayerspl.triggerClient("gui"name"");



EDIT: Make sure all players actually have the wNPC!


You don't need the "gui" while using triggerclient, or at least I've never used it and don't know if it makes a difference or not.

I've always done:

PHP Code:
player.triggerclient(name,params[0],params[1],etc...); 
Reply With Quote
  #7  
Old 07-16-2007, 07:54 AM
Cherrykao Cherrykao is offline
Banned
Join Date: Apr 2007
Posts: 37
Cherrykao is on a distinguished road
the thing is that this isn't a weapon. it's an NPC script attached to an actual NPC in a level, so i still can't get this to work.
Reply With Quote
  #8  
Old 07-16-2007, 07:55 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Cherrykao View Post
the thing is that this isn't a weapon. it's an NPC script attached to an actual NPC in a level, so i still can't get this to work.

You can't triggerclient in level NPCs, you'd have to use attr[]'s to communicate from server to client.
Reply With Quote
  #9  
Old 07-16-2007, 08:04 AM
Cherrykao Cherrykao is offline
Banned
Join Date: Apr 2007
Posts: 37
Cherrykao is on a distinguished road
can you post a simple example for me to work on?
Reply With Quote
  #10  
Old 07-16-2007, 08:10 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Cherrykao View Post
can you post a simple example for me to work on?


Just assign attr[] variables on the server. In the brackets, you put a number. attr[1] is automatically pre-defined for the player's hat, so you won't be able to use that. I believe attr[]'s go up to 30 or so. You can just do something like

PHP Code:
attr[10] = "Test"

on the serverside, and you'll be able to read attr[10] on the clientside.
Reply With Quote
  #11  
Old 07-16-2007, 10:11 PM
Cherrykao Cherrykao is offline
Banned
Join Date: Apr 2007
Posts: 37
Cherrykao is on a distinguished road
just curious if it is it possible to attach a class to every single level in a server through a script or do i have to manually edit every single level and attach "join class"; to an NPC??
Reply With Quote
  #12  
Old 07-16-2007, 10:24 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Why not just make it a WNPC in that case?
Reply With Quote
  #13  
Old 07-17-2007, 03:15 AM
bscharff bscharff is offline
Bloo
bscharff's Avatar
Join Date: Sep 2006
Location: San Antonio, Texas
Posts: 185
bscharff has a little shameless behaviour in the past
Send a message via AIM to bscharff Send a message via MSN to bscharff Send a message via Yahoo to bscharff
//ActionServerSide Stuff
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
//Insert The GUI Code Here
}}
//ClientSide Stuff
__________________
Trying to be nice now...
Reply With Quote
  #14  
Old 07-17-2007, 03:29 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Did anyone notice he used triggerserver wrong? O.o
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
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 02:10 PM.


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