I'm still a little fuzzy on how exactly my functions, but I think it you declare my $cast at the beginning of the script, before sub EVENT_SPAWN, it will allow only that script to use it, and it will carry through all of the subs.
Then again, this:
Code:
if ($cast=1) {
if ($ulevel >= 5) {
if (defined($qglobals{illusion})) {
}
else {
quest::playerrace(quest::ChooseRandom(14,27,42,43,46,58,60,62,63,66,75,82,85,89,95,108,120,123,150,151,153,161,209,210,211,212,356,367,433,436,454,455,456,458,464,469,470,472,473));
quest::playertexture(quest::ChooseRandom(1,2,3,4,5));
quest::movepc(152, quest::ChooseRandom(-30,-25,-20,-15,-10,-5,0,5,10,15,20,25,30,35),quest::ChooseRandom(-30,-25,-20,-15,-10,-5,0,5,10,15,20,25,30,35),-30);
quest::setglobal("illusion", 1, 1, "M10");
}
}
}
Should probably be this:
Code:
if ($cast==1) {
if ($ulevel >= 5) {
if (!defined($qglobals{illusion})) {
quest::playerrace(quest::ChooseRandom(14,27,42,43,46,58,60,62,63,66,75,82,85,89,95,108,120,123,150,151,153,161,209,210,211,212,356,367,433,436,454,455,456,458,464,469,470,472,473));
quest::playertexture(quest::ChooseRandom(1,2,3,4,5));
quest::movepc(152, quest::ChooseRandom(-30,-25,-20,-15,-10,-5,0,5,10,15,20,25,30,35),quest::ChooseRandom(-30,-25,-20,-15,-10,-5,0,5,10,15,20,25,30,35),-30);
quest::setglobal("illusion", 1, 1, "M10");
}
}
}
Otherwise, all you're doing is seeing if a variable can set to be a value, which will always return true. The second part is just making the script a little simpler.
Hope this at least points you in the right direction.
|