Script runs twice
Re: Script runs twice
Tab out your ifs and elseifs?
Code: Select all
function onGameHour()
local monk=GetMobAction(17682442);
local horror=GetMobAction(17682446);
local rough = math.random(1,50);
print("Random Number = "..rough);
print("Is Spawned Monk = "..monk);
print("Is Spawned Horror = "..horror);
if(monk ==0) and (rough <=3) and (horror ==0) then
SpawnMob(17682442);
elseif (monk ==0) and (horror ==0) and (rough >=49) then
SpawnMob(17682446);
elseif (monk ~=0) and (horror ==0) and (rough >=49) then
DespawnMob(17682442);
SpawnMob(17682446);
end
end;
Re: Script runs twice
!
Last edited by tabitaru on Sun Oct 18, 2015 7:15 am, edited 1 time in total.
Re: Script runs twice
Code: Select all
function onGameHour()
local monk = GetMobAction(17682442);
local horror = GetMobAction(17682446);
local rough = math.random(1,50);
print("Random Number = "..rough);
print("Is Spawned Monk = "..monk);
print("Is Spawned Horror = "..horror);
if (monk == 0 and rough <=3 and horror == 0) then
SpawnMob(17682442);
elseif (monk == 0 and horror == 0 and rough >= 49) then
SpawnMob(17682446);
elseif (monk ~= 0 and horror == 0 and rough >= 49) then
DespawnMob(17682442);
SpawnMob(17682446);
end
end;
And I see no reason why this code would exec twice on the same game hour trigger.. /shrug
* While lua is not a whitespace sensitive language, its much more difficult on my eyes when ppl mess it up..
Hi, I run The Demiurge server.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
DO NOT PRIVATE MESSAGE ME ABOUT BUGSPLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE