• 🏆 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!

Preload units and abilities

Status
Not open for further replies.
Level 9
Joined
Mar 26, 2017
Messages
376
On my map I observe lag spikes when creating custom units for the first time, or when adding a big hero skill (25 levels) for the first time.

I would like to remove these spikes by making use of preloading. I'd prefer to make use of the function Preloader, which is described to preload the entire contents of a folder.

Is this the right approach? And what pathnames must I use for the folders that contain
-All custom textures
-All custom models
-All custom abilities

Many thanks!
 
Level 9
Joined
Mar 26, 2017
Messages
376
I mean this:

upload_2019-4-16_18-42-17.png


Using preplaced units would be my last resort if I cannot get this to work, but it seems to me all I need is the path name where the resources are stored.
 

Attachments

  • upload_2019-4-16_18-42-9.png
    upload_2019-4-16_18-42-9.png
    13.8 KB · Views: 25
Using preplaced units would be my last resort if I cannot get this to work, but it seems to me all I need is the path name where the resources are stored.
blizzard melee preloader only preloads stuff that can be adressed with a file path. Abilities are content in a file so one preloads them by adding them to an living unit or having preplaced units on the map with that abilities.

A preloader file is an name.pld file, it is imported into your map. The plds text content should somehow look like that:
JASS:
function PreloadFiles takes nothing returns nothing
    call Preload( "Abilities\\Spells\\Other\\Repair\\PeonRepair1.wav" )
    call Preload( "Abilities\\Spells\\Other\\Repair\\PeonRepair2.wav" )
    call Preload( "Abilities\\Spells\\Other\\Repair\\PeonRepair3.wav" )
    call Preload( "buildings\\Human\\AltarOfKings\\AltarOfKings.blp" )
    call Preload( "buildings\\human\\AltarofKings\\AltarofKings.mdx" )
    call Preload( "buildings\\Human\\AltarOfKings\\TrevSmokeA.blp" )
    call Preload( "Units\\Human\\Peasant\\PeasantYes4.wav" )
    call PreloadEnd( 6.0 )
endfunction
 
Last edited:
Level 9
Joined
Mar 26, 2017
Messages
376
So do I understand correctly I would need to merge my assets into a .pld file and then import that?
Or is a .pld file simply a text file that contains a script with a bunch of 'call Preload //' function calls?

If the latter is true, then I do not really see why you wouldn't simply put that same logic in a trigger.
 
Status
Not open for further replies.
Top