Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   NPC Triggers (https://forums.graalonline.com/forums/showthread.php?t=134266889)

Fysez 07-28-2012 11:51 PM

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!

Crow 07-28-2012 11:58 PM

Quote:

Originally Posted by Fysez (Post 1700462)
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.

ffcmike 07-29-2012 12:03 AM

Quote:

Originally Posted by Crow (Post 1700463)
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);



Crow 07-29-2012 12:19 AM

Quote:

Originally Posted by ffcmike (Post 1700466)
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.

Fysez 07-29-2012 12:29 AM

Nevermind,
I was asking this for a purpose on a script,
But I figured it out already ^_^
Thanks for helping, though!


All times are GMT +2. The time now is 05:42 AM.

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