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 01-20-2007, 06:45 AM
konidias konidias is offline
Old Bee
konidias's Avatar
Join Date: Jul 2001
Location: Orlando, FL
Posts: 7,222
konidias will become famous soon enough
Send a message via AIM to konidias
How to check if a level is updated?

Is there a way to tell via npc if a level has been updated?

I have some putnpc's that I want to destroy if the level gets updated and I don't know of any way to go about doing this.
__________________

Put this image in your sig if you support Bomy Island! (g2k1 revision)
play bomberman while you wait!


Reply With Quote
  #2  
Old 01-20-2007, 07:03 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by konidias View Post
Is there a way to tell via npc if a level has been updated?

I have some putnpc's that I want to destroy if the level gets updated and I don't know of any way to go about doing this.
function onCreated()

If an NPC is in a level, it gets created whenever the level is updated.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #3  
Old 01-20-2007, 07:08 AM
konidias konidias is offline
Old Bee
konidias's Avatar
Join Date: Jul 2001
Location: Orlando, FL
Posts: 7,222
konidias will become famous soon enough
Send a message via AIM to konidias
No. "put npc"

Meaning it's not being created when the level is updated. It stays put.

edit: "created" doesn't tell when a level is updated either. just when an npc was created. I can't very well have the npc destroy when it's created, now can I?
__________________

Put this image in your sig if you support Bomy Island! (g2k1 revision)
play bomberman while you wait!


Reply With Quote
  #4  
Old 01-20-2007, 08:10 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by konidias View Post
No. "put npc"

Meaning it's not being created when the level is updated. It stays put.

edit: "created" doesn't tell when a level is updated either. just when an npc was created. I can't very well have the npc destroy when it's created, now can I?
Technically, you can.
HTML Code:
function onCreated()
{
  this.curMode = !this.curMode; //Makes it true first time around...
  if (!this.curMode)
  {  
    this.destroy(); //Destroy once 'this.curMode' is back to false
  }
}
However, I am not too sure if this would work. Would be better if there were a function.
Reply With Quote
  #5  
Old 01-20-2007, 04:31 PM
konidias konidias is offline
Old Bee
konidias's Avatar
Join Date: Jul 2001
Location: Orlando, FL
Posts: 7,222
konidias will become famous soon enough
Send a message via AIM to konidias
Yeah but my problem is that these npcs were placed in the level with putnpc2. So they are only created one time, no matter how many times you update the level. It's quite an important feature I'd be surprised if there isn't some way of detecting an update level via script...

I'll try to get in touch with Stefan I guess.
__________________

Put this image in your sig if you support Bomy Island! (g2k1 revision)
play bomberman while you wait!


Reply With Quote
  #6  
Old 01-20-2007, 08:46 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
After another think of this, I figured you could do it through
HTML Code:
function onPlayerChats()
{
  if (player.chat != "levelUpdate")
  {
    return false;
  }
  requesttext("options", "");
}
function onReceiveText(texttype, textoption, textlines) 
{
  for (temp.curLine = 0; temp.curLine < textlines.size(); temp.curLine++) 
  {
    if (textlines[temp.curLine].starts("staff=")) 
    {
      temp.curStaff = textlines[temp.curLine].tokenize(); 
      if (player.account in temp.curStaff)
      {
         temp.hasFound = true;
         break;
      }
    }
  }
  if (temp.hasFound)
  {
    this.onCreated(); 
  }
}
Not really tried it, but I guess it could work, pretty pointless though...
Upon inspection, it didn't work at all... My conclusion being "Script koni_test deleted by Chandler"
Reply With Quote
  #7  
Old 01-20-2007, 09:03 PM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
Quote:
Originally Posted by Chandler View Post
After another think of this, I figured you could do it through

Not really tried it, but I guess it could work, pretty pointless though...
Upon inspection, it didn't work at all... My conclusion being "Script koni_test deleted by Chandler"
It may work, but it wouldn't catch if you uploaded the level, or used an RC command to do it.
Reply With Quote
  #8  
Old 01-20-2007, 10:01 PM
konidias konidias is offline
Old Bee
konidias's Avatar
Join Date: Jul 2001
Location: Orlando, FL
Posts: 7,222
konidias will become famous soon enough
Send a message via AIM to konidias
Actually it's been pointed out to me that "if (updatelevel)" or "function onUpdateLevel()" actually works and does exactly what I need.

Thanks for the help though! Glad to know there is actually a feature for this.

So just for anyone that might be searching for a way to do this months from now.

if (updatelevel) checks to see if the level has been updated (not if an npc has been initialized or created) So that you can have database npcs know if a level was updated or changed.
__________________

Put this image in your sig if you support Bomy Island! (g2k1 revision)
play bomberman while you wait!


Reply With Quote
  #9  
Old 01-20-2007, 10:02 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by konidias View Post
Actually it's been pointed out to me that "if (updatelevel)" or "function onUpdateLevel()" actually works and does exactly what I need.

Thanks for the help though! Glad to know there is actually a feature for this.

So just for anyone that might be searching for a way to do this months from now.

if (updatelevel) checks to see if the level has been updated (not if an npc has been initialized or created) So that you can have database npcs know if a level was updated or changed.
Oh woah, so there is such a thing! Thanks
Reply With Quote
  #10  
Old 01-22-2007, 10:24 PM
konidias konidias is offline
Old Bee
konidias's Avatar
Join Date: Jul 2001
Location: Orlando, FL
Posts: 7,222
konidias will become famous soon enough
Send a message via AIM to konidias
Okay, Stefan answered my PM. (I feel bad now that I already know the answer) But he also mentioned it's for dbnpcs... So I'm not sure the updatelevel event will work in level npcs or weapons...
__________________

Put this image in your sig if you support Bomy Island! (g2k1 revision)
play bomberman while you wait!


Reply With Quote
  #11  
Old 01-22-2007, 10:34 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by konidias View Post
Okay, Stefan answered my PM. (I feel bad now that I already know the answer) But he also mentioned it's for dbnpcs... So I'm not sure the updatelevel event will work in level npcs or weapons...
Level NPCs are refreshed on update level and therefore will experience onCreated. Database NPCs, being stuck on a layer on top of the level, if you like, will receive onUpdateLevel.
__________________
Skyld
Reply With Quote
  #12  
Old 01-22-2007, 10:43 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
What a bizarre turn of events!
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 11:34 PM.


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