Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   NPC setimg() from another NPC (https://forums.graalonline.com/forums/showthread.php?t=134258679)

Switch 04-07-2010 09:11 PM

NPC setimg() from another NPC
 
It seems as though NPCs don't update their image on a player's screen until actually interacting with the NPC (onCreated(), onPlayer____()). At least, this is seen on Unholy Nation with their Event Doors. Is there any way to get the image to update with a (public) function called from another NPC?

Edit: Seems like they don't update anything (to the player) unless an interaction with the player is done.

DrakilorP2P 04-07-2010 09:35 PM

Maybe it's just asleep and you need to wake it by triggering an event?

fowlplay4 04-07-2010 09:50 PM

All you need to do is..

this.trigger("Update", "");

Which will force an update (Any event will do not just Update)

Switch 04-07-2010 09:51 PM

Quote:

Originally Posted by DrakilorP2P (Post 1567705)
Maybe it's just asleep and you need to wake it by triggering an event?

It's triggering a function from the other NPC. The problem is that it won't update to the player, though is updated on the server, until player interaction occurs (onPlayerTouchsMe, onPlayerEnters).

Edit: Seems like having a timeout triggering (starting from onCreated) can update the NPC to the player.

Edit: That worked too, Jer, and will be more efficient, thanks. Still pretty weird that it needs this in the first place.

cbk1994 04-07-2010 10:20 PM

Quote:

Originally Posted by fowlplay4 (Post 1567708)
All you need to do is..

this.trigger("Update", "");

Which will force an update (Any event will do not just Update)

No need for the second parameter now :)

PHP Code:

this.trigger("update"); 


fowlplay4 04-07-2010 10:51 PM

Another note to my post, originally Novo had stored clan data and so on in a DB but we experienced a random data loss when the server restarted/crashed. To counter this:

PHP Code:

function saveData() {
  
// Just setting a test variable
  
this.variable "lolwhatever";

  
// Forces the DB to update/save to the HDD (from what I understood from Stefan)
  
this.trigger("Update");




All times are GMT +2. The time now is 06:17 AM.

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