Login
Register
Menu
Home
Forum
JassDoc
Types
Functions
Variables
Help
Chat
Media
Search
Search posts
WC3 JASS.com
"The Jass Vault" plus vJASS and Zinc
WC3 Modding Information Center
Forum
Warcraft (WC3) Modding
Warcraft III Resources
Warcraft III Spells and Systems
Codes & Snippets
AbilityPreload
Warcraft III:
Maps
Models
Skins
Icons
Spells / Systems
Tools
Tutorials
Snippets
JASS vJASS Spells and Systems
Tutorials
Chat @Discord
vJASS & Zinc Documentation
For the latest documentation about how it works vJASS and Zinc language layers for Warcraft III, please follow these links:
Jasshelper documentation
-
Zinc documentation
-
WC3 Optimizer documentation
AbilityPreload
Codes & Snippets
Started by
moyack
Views
1729
Replies
0
Users
1
1
Pages:
1
Go Down
0 Members and 2 Guests are viewing this topic.
Rating
Average Score
- 5 / 5
«
Created: January 04, 2018, 11:26:25 PM by moyack
»
grim001
Recognized User
Posts:
3
WC3 Models: 0
WC3 Tutorials: 0
WC3 Tools: 0
WC3 Maps: 0
WC3 Skins: 0
WC3 Icons: 0
WC3 Spells: 0
Reputation:
50
requires vJass
AbilityPreload
on:
March 21, 2012, 03:44:14 AM
Category:
Execution
Language:
vJASS
Requires vJass
This library gives you one new function:
call
AbilityPreload(abilityid)
. It will remove the delay the first time an ability is loaded into the game. Vexorian's xe system includes a preload module, but it has not been available as a script until now.
Code: jass
library
AbilityPreload
//===========================================================================
// Information:
//==============
//
// Preloading removes the noticeable delay the first time an ability
// is loaded in a game. If an ability was not already on a pre-placed unit
// or a unit that was created during initialization, preloading is needed
// to prevent a delay.
//
//===========================================================================
// AbilityPreload API:
//=====================
//
// AbilityPreload(abilityid) :
// Call this before any time has elapsed to preload a specific
// ability. If debug mode is enabled, you will see an error message
// if you call this after initialization, or if you try to preload
// an ability that does not exist. Will inline to a UnitAddAbility
// call if debug mode is disabled.
//
// AbilityRangePreload(start, end) :
// Same as AbilityPreload, but preloads a range of abilities.
// It will iterates between the two rawcode values and preload
// every ability along the way. It will not show an error message
// for non-existent abilities.
//
//===========================================================================
// Configuration:
//================
globals
private
constant
integer
PreloadUnitRawcode =
'zsmc'
//This is the rawcode for "Sammy!". It is never used and has no model,
//which makes an ideal preloading unit. Change it if you want to.
endglobals
//===========================================================================
globals
private
unit
PreloadUnit
endglobals
function
AbilityPreload
takes
integer
abilityid
returns
nothing
static
if
DEBUG_MODE
then
if
GetUnitTypeId
(PreloadUnit) == 0
then
call
BJDebugMsg
(
"AbilityPreload error: Can't preload an ability after initialization"
)
return
endif
endif
call
UnitAddAbility
(PreloadUnit, abilityid)
static
if
DEBUG_MODE
then
if
GetUnitAbilityLevel
(PreloadUnit, abilityid) == 0
then
call
BJDebugMsg
(
"AbilityPreload error: Attempted to preload a non-existent ability"
)
endif
endif
endfunction
function
AbilityRangePreload
takes
integer
start,
integer
end
returns
nothing
local
integer
i = 1
static
if
DEBUG_MODE
then
if
GetUnitTypeId
(PreloadUnit) == 0
then
call
BJDebugMsg
(
"AbilityPreload error: Can't preload an ability after initialization"
)
return
endif
endif
if
start > end
then
set
i = -1
endif
loop
exitwhen
start > end
call
UnitAddAbility
(PreloadUnit, start)
set
start = start + i
endloop
endfunction
//===========================================================================
private
struct
Init
extends
array
private
static
method
onInit
takes
nothing
returns
nothing
set
PreloadUnit =
CreateUnit
(
Player
(15), PreloadUnitRawcode, 0., 0., 0.)
call
UnitApplyTimedLife
(PreloadUnit, 0, .001)
call
ShowUnit
(PreloadUnit,
false
)
call
UnitAddAbility
(PreloadUnit,
'Aloc'
)
endmethod
endstruct
endlibrary
«
Last Edit: January 04, 2018, 11:26:40 PM by moyack
»
Print
Pages:
1
Go Up
« previous
next »
WC3 Modding Information Center
Forum
Warcraft (WC3) Modding
Warcraft III Resources
Warcraft III Spells and Systems
Codes & Snippets
AbilityPreload
PortaMx-SEF 1.54
|
PortaMx © 2008-2015
,
PortaMx corp.
Search
Username
Password
Always stay logged in
Forgot your password?