Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. require('internal/util')
  2. require('gamemode')
  3. require('timers')
  4.  
  5. function Precache( context )
  6. --[[
  7. This function is used to precache resources/units/items/abilities that will be needed
  8. for sure in your game and that will not be precached by hero selection. When a hero
  9. is selected from the hero selection screen, the game will precache that hero's assets,
  10. any equipped cosmetics, and perform the data-driven precaching defined in that hero's
  11. precache{} block, as well as the precache{} block for any equipped abilities.
  12.  
  13. See GameMode:PostLoadPrecache() in gamemode.lua for more information
  14. ]]
  15.  
  16. DebugPrint("[BAREBONES] Performing pre-load precache")
  17.  
  18. -- Particles can be precached individually or by folder
  19. -- It it likely that precaching a single particle system will precache all of its children, but this may not be guaranteed
  20. PrecacheResource("particle", "particles/econ/generic/generic_aoe_explosion_sphere_1/generic_aoe_explosion_sphere_1.vpcf", context)
  21. PrecacheResource("particle_folder", "particles/test_particle", context)
  22.  
  23. -- Models can also be precached by folder or individually
  24. -- PrecacheModel should generally used over PrecacheResource for individual models
  25. PrecacheResource("model_folder", "particles/heroes/antimage", context)
  26. PrecacheResource("model", "particles/heroes/viper/viper.vmdl", context)
  27. PrecacheModel("models/heroes/viper/viper.vmdl", context)
  28. --PrecacheModel("models/props_gameplay/treasure_chest001.vmdl", context)
  29. --PrecacheModel("models/props_debris/merchant_debris_chest001.vmdl", context)
  30. --PrecacheModel("models/props_debris/merchant_debris_chest002.vmdl", context)
  31.  
  32. -- Sounds can precached here like anything else
  33. PrecacheResource("soundfile", "soundevents/game_sounds_heroes/game_sounds_gyrocopter.vsndevts", context)
  34.  
  35. -- Entire items can be precached by name
  36. -- Abilities can also be precached in this way despite the name
  37. PrecacheItemByNameSync("example_ability", context)
  38. PrecacheItemByNameSync("item_example_item", context)
  39.  
  40. -- Entire heroes (sound effects/voice/models/particles) can be precached with PrecacheUnitByNameSync
  41. -- Custom units from npc_units_custom.txt can also have all of their abilities and precache{} blocks precached in this way
  42. PrecacheUnitByNameSync("npc_dota_hero_ancient_apparition", context)
  43. PrecacheUnitByNameSync("npc_dota_hero_enigma", context)
  44. end
  45.  
  46. -- Create the game mode when we activate
  47. function Activate()
  48. GameRules.GameMode = GameMode()
  49. GameRules.GameMode:_InitGameMode()
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement