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-28-2012, 11:51 PM
Fysez Fysez is offline
Banned
Join Date: Apr 2012
Posts: 89
Fysez has a little shameless behaviour in the past
NPC Triggers

Is it possible to Trigger ServerSide to ClientSide on NPC's?
I know it's possible for ClientSide to ServerSide:
PHP Code:
function onActionTest() {
this.chat params[0];
}
//#CLIENTSIDE
function onCreated() {
triggeraction(this.xthis.y"Test""TestChat!");

But it their a way to convert this where it is something like:
PHP Code:
function onCreated() {
triggeraction(this.xthis.y"Test""TestChat!");
}
//#CLIENTSIDE
function onActionTest() {
this.chat params[0];

this?
I know this does not work, But how would I make it work???

-Thanks!
Reply With Quote
  #2  
Old 07-28-2012, 11:58 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 Fysez View Post
I know this does not work, But how would I make it work?
You can't. Triggering NPCs from server- to clientside won't work. Use a weapon NPC to help you.
Reply With Quote
  #3  
Old 07-29-2012, 12:03 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Crow View Post
You can't. Triggering NPCs from server- to clientside won't work. Use a weapon NPC to help you.
This is partially true, a serverside triggeraction on an NPC is now received from every player who's using the V6 client. As a result, when updating attr values serverside I'm using it as an optimisation for V6 users, while using a timeout for V5 users:

PHP Code:
function updateSomething(){
  
this.attr[3] = timevar2;
  
triggeraction(this.1this.1"Update"NULL);
}

//#CLIENTSIDE
function onCreated(){
  if(
graalversion 6){
    
this.setTimer(0.05);
  }
}

function 
onPlayerEnters(){
  if(
graalversion >= 6){
    
this.checkUpdate();
  }
}

function 
onTimeout(){
  
this.checkUpdate();
  
this.setTimer(0.05);
}

function 
checkUpdate(){
  if(
this.updatetime != this.attr[3]){
    
this.onActionUpdate();
  }
}

function 
onActionUpdate(){
  
this.updatetime this.attr[3];
  
//stuff

Might also be worth noting that for an NPC to receive a triggeraction, it requires a shape, which can be set by:

PHP Code:
//#CLIENTSIDE
function onCreated(){
  
//32 pixels would be equal to 2 tiles
  
this.setshape(13232);


Last edited by ffcmike; 07-29-2012 at 12:17 AM..
Reply With Quote
  #4  
Old 07-29-2012, 12:19 AM
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 ffcmike View Post
This is partially true, a serverside triggeraction on an NPC is now received from every player who's using the V6 client.
Hm, that's interesting. Didn't know about that.
Reply With Quote
  #5  
Old 07-29-2012, 12:29 AM
Fysez Fysez is offline
Banned
Join Date: Apr 2012
Posts: 89
Fysez has a little shameless behaviour in the past
Nevermind,
I was asking this for a purpose on a script,
But I figured it out already ^_^
Thanks for helping, though!
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 04:26 AM.


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