More acurate old kings system

Post Reply
Drkepper
Posts: 3
Joined: Fri Jan 03, 2014 8:38 pm

More acurate old kings system

Post by Drkepper » Sat Sep 26, 2015 3:28 pm

Currently the way the zone scripts for behemoth/fafnir/adamantoise and their HQ versions sets their respawn timer to a random number between 21 hours and 24 hours. Well back when they did spawn, they had spawn windows every 30 minutes between 21-24 hours. So, they had a chance at spawn at 21 hours, 21.5 hours, 22 hours, 22.5 hours, 23 hours, 23.5 hours, or 24 hours. This means the script isn't exactly correct. Instead I've changed my scripts for the kings to spawn at 21 hours + 30 mins * (a random number between 0 and 6). Here is an example for behemoth's script:

Code: Select all

-----------------------------------
-- Area: Behemoth's Dominion
--  HNM: Behemoth
-----------------------------------

require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/globals/status");

-----------------------------------
-- onMobInitialize
-----------------------------------

function onMobInitialize(mob)
end;

-----------------------------------
-- onMobDeath
-----------------------------------

function onMobDeath(mob, killer)
    killer:addTitle(BEHEMOTHS_BANE);
end;

-----------------------------------
-- onMobDespawn
-----------------------------------

function onMobDespawn(mob)
    local Behemoth      = mob:getID();
    local King_Behemoth = 17297441;
    local ToD     = GetServerVariable("[POP]King_Behemoth");
    local kills   = GetServerVariable("[PH]King_Behemoth");
    if (LandKingSystem_HQ == 0 or LandKingSystem_HQ == 2) then
        if (ToD <= os.time(t) and GetMobAction(King_Behemoth) == 0) then
            if (math.random((1),(5)) == 3 or kills > 6) then
                DeterMob(Behemoth, true);
                DeterMob(King_Behemoth, false);
                UpdateNMSpawnPoint(King_Behemoth);
                GetMobByID(King_Behemoth):setRespawnTime(75600 + 1800 * math.random(0, 6)); --UPDATED FOR 30 MIN SPAWN WINDOWS
            elseif (LandKingSystem_NQ == 0 or LandKingSystem_NQ == 2) then
                UpdateNMSpawnPoint(Behemoth);
                mob:setRespawnTime(75600 + 1800 * math.random(0, 6)); --UPDATED FOR 30 MIN SPAWN WINDOWS
                SetServerVariable("[PH]King_Behemoth", kills + 1);
            end
        end
    elseif (LandKingSystem_NQ == 0 or LandKingSystem_NQ == 2) then
        UpdateNMSpawnPoint(Behemoth);
        mob:setRespawnTime(75600 + 1800 * math.random(0, 6));          --UPDATED FOR 30 MIN SPAWN WINDOWS
        SetServerVariable("[PH]King_Behemoth", kills + 1);
    end
end;


Of course, the setRespawnTime commands have to be changed for the zone scripts for all of the kings and their hq counter parts.

Post Reply