HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Looking into the preload scripts

07-17-2007, 11:57 AM#1
Anitarf
When I took a look at the racial melee game preload scripts (.pld files) in war3.mpq, they didn't make much sense to me. They seem to preload a lot of icons, a few textures, most of the soundset of the race's worker, a few more icons, textures and sounds that seem general rather than race specific like armour type icons, and for some reason they all preload the Units\\Human\\HeroArchMage\\HeroArchMageWhat1.wav file. What they don't preload, although one would expect them to, are the models, textures and complete soundsets of all the race's units. There may be other oddities, but I haven't looked that much into it yet.

Can anyone make any sense of why the preload files are the way they are - disorganised, incomplete, random?
An example of what I'm talking about, NightElfMelee.pld

function PreloadFiles takes nothing returns nothing

call Preload( "units\\nightelf\\Wisp\\Wisp.mdx" )
call Preload( "Textures\\star2_32.blp" )
call Preload( "Textures\\Shockwave10.blp" )
call Preload( "Textures\\Dust3.blp" )
call Preload( "ReplaceableTextures\\Weather\\CloudSingleFlat.blp" )
call Preload( "Textures\\Dust5.blp" )
call Preload( "Textures\\GenericGlow2c.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNNightElfBUild.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNNightElfBUild.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNTreeOfLife.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNTreeOfLife.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNMoonWell.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNMoonWell.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNChimaeraRoost.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNChimaeraRoost.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNAncientOfTheEarth.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNAncientOfTheEarth.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNAltarOfElders.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNAltarOfElders.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNAncientOfTheMoon.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNAncientOfTheMoon.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNAncientOfLore.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNAncientOfLore.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNHuntersHall.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNHuntersHall.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNTreant.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNTreant.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNWispSplode.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNWispSplode.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNWispHealOn.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNWispHealOn.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNWispHealOff.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNWispHealOff.blp" )
call Preload( "units\\nightelf\\Wisp\\Wisp_portrait.mdx" )
call Preload( "units\\NightElf\\Wisp\\Wisp.blp" )
call Preload( "ReplaceableTextures\\PassiveButtons\\PASBTNPillage.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISPASBTNPillage.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNRepairOn.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNRepairOn.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNGatherGold.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNGatherGold.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNAttack.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNAttack.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNStop.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNStop.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNMove.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNMove.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNPatrol.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNPatrol.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNHoldPosition.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNHoldPosition.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNBasicStruct.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNBasicStruct.blp" )
call Preload( "UI\\Widgets\\Console\\Human\\infocard-neutral-attack-melee.blp" )
call Preload( "UI\\Widgets\\Console\\Human\\infocard-neutral-armor-medium.blp" )
call Preload( "Units\\NightElf\\Wisp\\WispWhat1.wav" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNNightElfBUild.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNNightElfBUild.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNWispSplode.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNWispSplode.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNWispHealOn.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNWispHealOn.blp" )
call Preload( "Sound\\Interface\\MouseClick1.wav" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNCancel.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNCancel.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNTreeOfLife.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNTreeOfLife.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNMoonWell.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNMoonWell.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNChimaeraRoost.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNChimaeraRoost.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNAncientOfTheEarth.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNAncientOfTheEarth.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNAltarOfElders.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNAltarOfElders.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNAncientOfTheMoon.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNAncientOfTheMoon.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNAncientOfLore.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNAncientOfLore.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNHuntersHall.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNHuntersHall.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNTreant.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNTreant.blp" )
call Preload( "buildings\\nightelf\\MoonWell\\MoonWell.mdx" )
call Preload( "Textures\\MoonWell.blp" )
call Preload( "SharedModels\\NEBirth.mdx" )
call Preload( "SharedModels\\NightElfBirth2.blp" )
call Preload( "Textures\\rainTail.blp" )
call Preload( "Textures\\Leaf.blp" )
call Preload( "Textures\\Wirlwinds.blp" )
call Preload( "Textures\\Green_Glow2.blp" )
call Preload( "Textures\\RibbonNE1_blue.blp" )
call Preload( "Textures\\Star7b.blp" )
call Preload( "Textures\\star4_32.blp" )
call Preload( "Textures\\grad2d.blp" )
call Preload( "SharedModels\\RootsBuild.blp" )
call Preload( "Sound\\Buildings\\Shared\\BuildingPlacement.wav" )
call Preload( "Units\\NightElf\\Wisp\\WispYes1.wav" )
call Preload( "ReplaceableTextures\\Splats\\NightElfUberSplat.blp" )
call Preload( "Abilities\\Spells\\NightElf\\MoonWell\\MoonWellTarget.mdx" )
call Preload( "ReplaceableTextures\\TeamGlow\\TeamGlow02.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNManaRechargeOn.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNManaRechargeOn.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNManaRechargeOff.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNManaRechargeOff.blp" )
call Preload( "ReplaceableTextures\\Shadows\\ShadowMoonWell.blp" )
call Preload( "Sound\\Buildings\\NightElf\\NightElfBuildingLoop.wav" )
call Preload( "Units\\Human\\WaterElemental\\SummonWaterElementalCaster.wav" )
call Preload( "Sound\\Buildings\\NightElf\\HuntressBuildingComplete1.wav" )
call Preload( "Units\\NightElf\\Wisp\\WispWhat3.wav" )
call Preload( "UI\\Widgets\\ToolTips\\Human\\ToolTipGoldIcon.blp" )
call Preload( "UI\\Widgets\\ToolTips\\Human\\ToolTipLumberIcon.blp" )
call Preload( "buildings\\nightelf\\AncientOfWar\\AncientOfWar.mdx" )
call Preload( "buildings\\NightElf\\AncientOfWar\\AncientOfWar1.blp" )
call Preload( "Textures\\rootbase.blp" )
call Preload( "Units\\NightElf\\Wisp\\WispYes2.wav" )
call Preload( "ReplaceableTextures\\Splats\\AncientUberSplat.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNArcher.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNArcher.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNHuntress.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNHuntress.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNBallista.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNBallista.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNSentinel.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNSentinel.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNImprovedBows.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNImprovedBows.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNMarksmanship.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNMarksmanship.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNUpgradeMoonGlaive.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNUpgradeMoonGlaive.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNImpalingBolt.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNImpalingBolt.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNEatTree.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNEatTree.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNRoot.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNRoot.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNUproot.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNUproot.blp" )
call Preload( "ReplaceableTextures\\Shadows\\ShadowAncientofWar.blp" )
call Preload( "buildings\\nightelf\\AncientOfWar\\AncientOfWar_portrait.mdx" )
call Preload( "Units\\NightElf\\Wisp\\WispWhat2.wav" )
call Preload( "buildings\\nightelf\\TreeofLife\\TreeofLife.mdx" )
call Preload( "buildings\\NightElf\\TreeOfLife\\TreeofLife.blp" )
call Preload( "Units\\NightElf\\Wisp\\WispYes3.wav" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNWisp.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNWisp.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNNaturesBlessing.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNNaturesBlessing.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNTreeOfAges.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNTreeOfAges.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNGoldMine.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNGoldMine.blp" )
call Preload( "Abilities\\Spells\\NightElf\\TreeofLifeUpgrade\\TreeofLifeUpgradeTargetArtHand.mdx" )
call Preload( "Abilities\\Spells\\NightElf\\TreeofLifeUpgrade\\TreeofLifeUpgradeTargetArt.mdx" )
call Preload( "Textures\\RibbonNE1_White.blp" )
call Preload( "Textures\\ButterFly.blp" )
call Preload( "Textures\\RibbonNE1.blp" )
call Preload( "ReplaceableTextures\\Shadows\\ShadowTreeofLife.blp" )
call Preload( "buildings\\nightelf\\TreeofLife\\TreeofLife_portrait.mdx" )
call Preload( "Buildings\\NightElf\\TreeOfLife\\TreeOfLifeWhat3.wav" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNRallyPoint.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNRallyPoint.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNUproot.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNUproot.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNWisp.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNWisp.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNNaturesBlessing.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNNaturesBlessing.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNTreeOfAges.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNTreeOfAges.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNGoldMine.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNGoldMine.blp" )
call Preload( "UI\\Widgets\\Console\\Human\\infocard-neutral-armor-fortified.blp" )
call Preload( "Buildings\\NightElf\\AncientOfWar\\AncientOfTheMoonWhat2.wav" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNArcher.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNArcher.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNHuntress.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNHuntress.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNBallista.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNBallista.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNSentinel.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNSentinel.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNImprovedBows.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNImprovedBows.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNMarksmanship.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNMarksmanship.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNUpgradeMoonGlaive.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNUpgradeMoonGlaive.blp" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNImpalingBolt.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNImpalingBolt.blp" )
call Preload( "Buildings\\NightElf\\MoonWell\\MoonWellWhat1.wav" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNManaRechargeOn.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNManaRechargeOn.blp" )
call Preload( "Units\\Human\\HeroArchMage\\HeroArchMageWhat1.wav" )
call Preload( "ReplaceableTextures\\CommandButtons\\BTNSkillz.blp" )
call Preload( "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNSkillz.blp" )
call Preload( "UI\\Widgets\\Console\\Human\\infocard-armor-hero.blp" )
call Preload( "UI\\Widgets\\Console\\Human\\infocard-heroattributes-int.blp" )
call PreloadEnd( 2.5 )
endfunction

07-17-2007, 12:36 PM#2
CommanderZ
Are you sure this script is really used by the game? Maybe they (Blizzard) found another, better solution. This wouldn't help much to the game.
07-17-2007, 01:04 PM#3
Rao Dao Zao
I'm not even sure preload scripts actually work, to be honest.
07-17-2007, 02:57 PM#4
blu_da_noob
I wonder if importing one into a map can override that one. You could try with a blank one and see if there appears to be a change in load time (or a huge one and check the same). Although the change should be pretty small. But yeah. That might give you an idea of if it's even used/works. Perhaps you can overwrite it and prevent it loading stuff you don't use.

As for the original question, could be laziness. Who knows.
07-17-2007, 03:14 PM#5
CommanderZ
They seem to be ordinary JASS functions. You can put there something what you will be able to see ingame (create unit...).

Does the Preload function work in normal JASS?
07-17-2007, 03:53 PM#6
Toadcop
yes it works.
the Preloader feature is to call some custom code out of it ^^ + i can call only functions out of common.j (including custom one after native declaration)
well it gives some awesome possibilitys ;)

Preload at self suxx.
07-17-2007, 05:33 PM#7
CommanderZ
So I can use this in my init scipt:
Collapse JASS:
call Preload("pathtothemodel\\themodel.mdx")
and it won't lag when used first time?
07-17-2007, 06:12 PM#8
Toadcop
CommanderZ well maybe ^^ how i have read... yes. but i am not 100% sure
07-17-2007, 11:53 PM#9
Anitarf
Well the racial preload files are executed from the starting melee unit creation functions so deleting the melee initialization trigger means they are never called, so stuff like gold resource icon is never preloaded and yet this has no adverse effects on custom maps without such a trigger. I'm just thinking of removing preloading from my custom melee initialization functions entirely, if I get lag spikes when training units I'll do the usual preplace-units-to-avoid-creation-lag thing.
07-17-2007, 11:56 PM#10
Whitehorn
Is this is possible, it would open up some cool venues. So many of those textures can't be replaced due to that script.

For example, you could destroy all team colour glows by overwriting them with black.