Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 05:41 PM.


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