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-26-2008, 01:14 AM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
Detecting Updates

Hi,

is there any way to detect if a weapon has been added/updated/whatever?
__________________
Reply With Quote
  #2  
Old 01-26-2008, 01:25 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Since you gave no real information, I'd say just have an updateid var. It checks itself against the server and updates itself if the server has a higher number.
Reply With Quote
  #3  
Old 01-26-2008, 02:45 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Explain.

You could just use onCreated, if you mean when someone hits UPDATE in RC?
__________________
Reply With Quote
  #4  
Old 01-26-2008, 02:51 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Well, you have these:
PHP Code:
function onCreated() {
}

function 
onPlayerEnters() {
}

function 
onInitialized() {

__________________
Reply With Quote
  #5  
Old 01-26-2008, 03:27 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Chompy View Post
Well, you have these:
PHP Code:
function onCreated() {
}

function 
onPlayerEnters() {
}

function 
onInitialized() {

I've never needed onPlayerEnters in a script. onCreated works fine for me.

Not exactly sure what onInitialized is.
__________________
Reply With Quote
  #6  
Old 01-26-2008, 03:45 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
onInitialized is when the code is first executed on server start, I believe.

onCreated is fired whenever the NPC is saved/updated.
Reply With Quote
  #7  
Old 01-26-2008, 03:49 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by cbkbud View Post
I've never needed onPlayerEnters in a script.
Hmm, I used it in my baddy script :o In the timeout, when there's no players it will set timeout to 0 and don't execute anything. So, in the onPlayerEnters() event I restart the timeout again etc. :o

I think it's pretty nice
__________________
Reply With Quote
  #8  
Old 01-26-2008, 04:23 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Chompy View Post
Hmm, I used it in my baddy script :o In the timeout, when there's no players it will set timeout to 0 and don't execute anything. So, in the onPlayerEnters() event I restart the timeout again etc. :o

I think it's pretty nice
Sorry, I meant in a weapon, like I assume he is talking about.

EDIT: On second thought, I used it once to make a zone system (meaning PK and No-PK zones).
__________________
Reply With Quote
  #9  
Old 01-26-2008, 05:58 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I use it for map-related instances.
Reply With Quote
  #10  
Old 01-26-2008, 11:23 AM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
i meant if theres a way to detect that a weapon has been added/updated(any weapon in rc)(from a weapon or dbnpc)(without changing the actual weapon you check)
__________________
Reply With Quote
  #11  
Old 01-26-2008, 12:47 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
The only way to detect if a weapon has been updated is to put something in its onCreated() area which is called when updated.
__________________
Reply With Quote
  #12  
Old 01-26-2008, 02:56 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
well i just wanna do a non-anonymous echo()(that it adds the weapon name)
but i need to know if a new weapon has been added xD
__________________
Reply With Quote
  #13  
Old 01-26-2008, 03:28 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by projectigi View Post
well i just wanna do a non-anonymous echo()(that it adds the weapon name)
but i need to know if a new weapon has been added xD
Err, you want to detect from one wnpc that an other wnpc has been updated?
__________________
Reply With Quote
  #14  
Old 01-26-2008, 03:59 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
no, that a new wnpc has been added
__________________
Reply With Quote
  #15  
Old 01-26-2008, 05:30 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Like added to the player?

in a loop something like:
PHP Code:
if ( this.oldWeps != player.weapons )
{
  
// ...
}
this.oldWeps player.weapons
?
__________________
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 05:59 PM.


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