PDA

View Full Version : Adding qglobal point


Randymarsh9
07-19-2009, 04:34 PM
I am just trying to make something where if a monster dies and that person's qglobals are in the right range, it will increase it by 1. I check to make sure the monster has qglobals set to 1. This quest doesn't seem to do anything as the value just stays the same

sub EVENT_KILLED_MERIT{
if ($qglobals{mmed} >=3 && $qglobals{mmed}) <=6){
quest::setglobal("mmed", $qglobals{mmed}+1, 5, "F");
}
}

joligario
07-19-2009, 06:35 PM
Make sure the NPC being killed has qglobals enabled in the database.

Oh, and get rid of the extra close parenthesis.

Capheus
07-19-2009, 09:51 PM
It might be having problems recalculating the new value when setting the global itself. I tested the script below in sub EVENT_SAY and it works fine. If it doesn't work in sub EVENT_KILLED_MERIT then there is something not working with that event. And as joligario said, make sure you have qglobals set to 1 on this NPC in the database.


sub EVENT_KILLED_MERIT {

if (($qglobals{mmed}>=3) && ($qglobals{mmed}<=6)){
$new = $qglobals{mmed}+1;
quest::setglobal("mmed", $new, 5, "F");
}

}