Quote:
Originally Posted by spider661
is there a way to set a variable on an npc or the server that other npcs can read?
|
Quote:
Originally Posted by spider661
is there a way to save and read them from the database or something?
|
Quote:
Originally Posted by spider661
how hard would it be to add a new quest command copy the setglobal and get globals and customize them to write to a new table setting a server wide variable that an npc could read.
|
What you're trying to do it already in the source. All you have to do it utilize the options when you set a global. From the
Wiki:
Code:
quest::setglobal([varname],[value],[options],[duration]);
Quote:
Command Parameters
[varname] the name of the variable you want to save. Do not include the variable prefix as part of the name. When the quest for the npc who recieves this variable begins, a variable with the name that you here preceeded by a "$" will be available. For example, if [varname] is "genius" then a variable named $genius will be available to the quest script of the npc with whatever you specified in it. Variables are cached and won't be reloaded unless the cache cleared or the variable is undefined. So make sure to use $variable = undef; after the variable was used, especially if you have multiple persons using the quest.
[value] this is what the variable will contain when the quest script begins.
[options] value determines the availability of global variables to NPCs when a quest begins -- this way you can decide what mobs can "see" the variable.
[duration] the amount of time this variable will be available. After this time, the variable goes away!
|
Quote:
Example for option:
-----------------------------------------
| value | npcid | player | zone |
-----------------------------------------
| 0 | this | this | this |
| 1 | all | this | this |
| 2 | this | all | this |
| 3 | all | all | this |
| 4 | this | this | all |
| 5 | all | this | all |
| 6 | this | all | all |
| 7 | all | all | all |
-----------------------------------------
In other words, the following values can be ORed together:
NPC_ALL = 1
PLAYER_ALL = 2
ZONE_ALL = 4
Example: NPC_ALL | PLAYER_ALL = 3
|
In other words, use 1 instead of 0 and all NPCs will be able to read the quest global.