that's exactly what quest::setglobal() does with the different option sets.
Code:
+--------+---------+---------+----------+
| 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 |
+--------+---------+---------+----------+