• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

What affect the loading speed of a map?

Not open for further replies.
Level 12
Aug 12, 2008
I've been working on a map and I found out that my map load quite slow although the file size is small (400kb+).
Does the loading speed depends on the triggers that I used? Or it depends on how many triggers that I used?

Besides that, I used the below trigger in setup like map initialization and Multiboard initialization. Does the below trigger actually helps in reducing the lag during the game?
  • Custom script: call DestroyTrigger( GetTriggeringTrigger() )
Well, let's say I want a trigger created specifically for the target unit of a spell. Instead of bloating a global trigger with multiple events, I can use a local one.
function A takes nothing returns nothing
    local unit u = GetTriggerUnit()
    //Actions Here
    call DestroyTrigger (GetTriggeringTrigger())
    set u = null

function Actions takes nothing returns nothing
    local unit u = GetSpellTargetUnit()
    local trigger tri = CreateTrigger()
    call TriggerRegisterUnitEvent (tri, u, EVENT_UNIT_DAMAGED)
    call TriggerAddAction (tri, function A)
    set u = null
    set tri = null
This example creates a local trigger for the target unit, with the event of "Unit takes damage". Once the unit takes damage, the trigger is not needed (if we wanted the unit to be damaged only once and trigger the effects), so we destroy it.

As for the variables, if you declare loads of them under the "Map Initialization" events, it will become slow indeed. Distribute them with the event of "Elapsed time game is 0.00 seconds".


Code Reviewer
Level 26
Mar 19, 2008
Since there was ton of threads like this, I'll just recommend reading that - it will help you reducing/optimizing the map (enter both 'this' links).

Loading time can be lowered by replacing event 'Map initialization' with Time - Elapsed time is 1.00 (it doesn't have to be exactly 1.00 second, you can enter any other value here too, but let it be small enought so triggers will be loaded 'at the begining of the game').
Not open for further replies.