Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   obj.scriptdone(); (https://forums.graalonline.com/forums/showthread.php?t=134261266)

xAndrewx 12-08-2010 02:34 AM

obj.scriptdone();
 
It tells the server that the object is not needed on serverside (Static Objects) and still display it clientside.

Pretty simple, but comes in handy for repeated NPCs. (Era Trees or Shrubs etc)

Cubical 12-08-2010 02:43 AM

Oh cool, what's the difference between that and letting the script finish itself?

xAndrewx 12-08-2010 02:44 AM

It's not storing it on the serverside once it's finished haha.
(On each update etc)

Tigairius 12-08-2010 08:53 AM

Yes, this is used on GK for our trees. :)

ffcmike 12-10-2010 07:19 PM

Could there perhaps be a server option to do this by default where any level NPC has no serverside script or set variables?

xAndrewx 12-10-2010 07:43 PM

Quote:

Originally Posted by ffcmike (Post 1615717)
Could there perhaps be a server option to do this by default where any level NPC has no serverside script or set variables?

It should automatically do this- but the NPC-Server was out of date (was checking for "if (created) {}". Stefan updated it though, you may need to restart NPC-Server :)

ffcmike 12-10-2010 09:02 PM

Quote:

Originally Posted by xAndrewx (Post 1615719)
It should automatically do this- but the NPC-Server was out of date (was checking for "if (created) {}". Stefan updated it though, you may need to restart NPC-Server :)

Actually yeah just noticed this was already happening, surprised it's doing it by default as it also seems to be happening with npcs that have a serverside image, you'd now have to always set a shape on things you'd want to block things like serverside baddy or projectile movement.

Would also be nice if Stefan would publish these efficiency related updates when they become available rather than having to wait on enlightenment from somebody he has told individually, appreciate it though.

Admins 12-10-2010 11:01 PM

This was already in the server for 5-6 or more years :D The only problem is that it's only detecting if (created) {} scripts by default, while npcs with function onCreated() are not 'optimized away' right now. So you have to call this.scriptdone(); yourself on those objects.
The big advantage is that those npcs don't appear in level.npcs[] anymore, which speeds up findareanpcs() or scanning levels.npcs[].


All times are GMT +2. The time now is 07:04 AM.

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