Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-07-2015, 07:55 PM
Kirko Kirko is offline
Registered Guest
Join Date: Dec 2014
Location: Texas
Posts: 61
Kirko has a spectacular aura aboutKirko has a spectacular aura about
getting level npcs problem

I'm having trouble trying to get all the npcs in a single level. Right now I'm just trying to change the npcs chat. When ever I attempt to change their chat only two npcs in the level get found and their chat doesnt change until I grab them.

here is what im using to find the level npcs
Graal Script Code:
function onActionServerSide(cmd){
  switch(
cmd){
    case
"start":
      
player.chat "start";
      
temp.npcs findlevel(params[1]).npcs;
      for(
temp.i:temp.npcs){
        
temp.i.chat "testing  123";
        
player.chat temp.i.x SPC temp.i.chat;
        
//waitfor("","idk",.5);
      
}
      break;
  }

Reply With Quote
  #2  
Old 05-07-2015, 08:04 PM
Jakov_the_Jakovasaur Jakov_the_Jakovasaur is offline
Deleted by Darlene159
Jakov_the_Jakovasaur's Avatar
Join Date: Sep 2013
Location: Deleted by Darlene159
Posts: 353
Jakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud of
hello!

several years ago the npc-server was updated so that variables within npcs only synchronise to players clients upon an event occurring

if you add:

Graal Script Code:
  temp.i.trigger("Update"); 
within the for loop (the event function does not have to actually exist, though i would personally change the npcs chat variable within the event just for clarity) it should force the chat to synchronise
__________________
This signature has been deleted by Darlene159.
Reply With Quote
  #3  
Old 05-07-2015, 08:15 PM
Kirko Kirko is offline
Registered Guest
Join Date: Dec 2014
Location: Texas
Posts: 61
Kirko has a spectacular aura aboutKirko has a spectacular aura about
Thank you, it worked but I still have the problem where only 2 npcs are affected. I have a total of 4 npcs in the level but only two of them get changed.

Reply With Quote
  #4  
Old 05-07-2015, 08:21 PM
Jakov_the_Jakovasaur Jakov_the_Jakovasaur is offline
Deleted by Darlene159
Jakov_the_Jakovasaur's Avatar
Join Date: Sep 2013
Location: Deleted by Darlene159
Posts: 353
Jakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud of
Quote:
Originally Posted by Kirko View Post
Thank you, it worked but I still have the problem where only 2 npcs are affected. I have a total of 4 npcs in the level but only two of them get changed.

do the other 2 npcs have any custom serverside code or a setshape?

npcs which dont have any code beyond default synchronisation variables are actually considered un-necessary by the npc-server, and are therefore automatically removed from level.npcs[] serverside (as these are usually only necessary clientside)
__________________
This signature has been deleted by Darlene159.
Reply With Quote
  #5  
Old 05-07-2015, 08:32 PM
Kirko Kirko is offline
Registered Guest
Join Date: Dec 2014
Location: Texas
Posts: 61
Kirko has a spectacular aura aboutKirko has a spectacular aura about
okay now it works perfect, thank you again!
I had some client side script in the two npcs and just deleted it since it wasn't needed.
Reply With Quote
Reply

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 01:54 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.