Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-17-2006, 08:07 AM
upsilon upsilon is offline
Shmoo
upsilon's Avatar
Join Date: Dec 2005
Location: Birmingham, Alabama
Posts: 58
upsilon is on a distinguished road
Control-NPC

I've noticed some weird behavior from the Control-NPC script. I was playing around, testing out what is and isnt saved to the npc database ,by setting up some objects in Control-NPC's onCreated event. heres the code:

in the Control-NPC script...
PHP Code:

function onCreated() {
  
sendtorc("Control-NPC has been reset");
  
this.testobj = new TGraalVar();
  
this.testobj.join("test");

in the 'test' class' script...

PHP Code:
function onCreated() {
  
sendtorc("new test object created...");

Whats happening, is on the first reset, the message in Control-NPC's onCreated event is printed, then when test class is joined, the message in its onCreated event is printed aswell.. which makes sense.

Now...

On subsequent resets, the message in Control-NPC's onCreated event is still printed, but the one in the test class is not. If i add a new variable to Control-NPC, with a different name than before, joining the test class to it triggers the test classes onCreated event again, but like in the first case, it isnt triggered on subsequent resets.

Why? How does this make any sense? I was thinking it would be a good place to put recovery code, for when the npc server is restarted (in Control-NPC's onInitialized() event), or for setting things into motion that dont logically make any sense being tied to when a level is loaded, a player connects, or a player enters a level. But i dont see how this is possible.

I understand that Control-NPC is usually used to detect when a projectile lands, or when a player connects to the server. But what is its purpose in general? and how does it benifit from this behavior?

Someone told me NEVER EVER to reset Control-NPC, but i don't understand how i could do that, when its reset everytime its edited, and there are legitimate reasons for editing it.
__________________
Health nuts are going to feel really stupid someday, lying in hospitals dying of nothing. - Redd Foxx
Reply With Quote
 


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 08:56 AM.


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