- Joined
- Apr 27, 2011
- Messages
- 272
ItemPreload is a map utility that will allow you to preload items in order to eliminate the lag they cause during gameplay when picked up.
JASS:
library ItemPreload initializer ItemPreload_ini
/*
* ItemPreload by Alain.Mark (please give credits when used)
*
* -Info-
* -Dumps the little lag caused by picking up items at map initialization instead, to ensure a smooth gameplay.
*
* -API-
* -function PreloadItem takes itemTypeID returns nothing
*
*/
/*
* CONFIGURATION SECTION
*/
globals
private constant player PRELOADER_UNIT_OWNER = Player(15)
private constant integer PRELOADER_UNIT_ID = 'n000' // Be sure that the unit has an "Unit Inventory" ability!
private constant real PRELOADER_UNIT_X = 0.00
private constant real PRELOADER_UNIT_Y = 0.00
endglobals
/*
* SYSTEM CODE
*/
globals
private unit ITEM_PRELOADER=null
endglobals
function PreloadItem takes integer itemTypeId returns nothing
call RemoveItem(UnitAddItemById(ITEM_PRELOADER,itemTypeId)) //inline friendly
endfunction
private function ItemPreload_ini takes nothing returns nothing
set ITEM_PRELOADER=CreateUnit(PRELOADER_UNIT_OWNER,PRELOADER_UNIT_ID,PRELOADER_UNIT_X,PRELOADER_UNIT_Y,0.00)
endfunction
endlibrary
Last edited: