Why do some abilities cause fatals when preloaded at map init?

Reaction score
91
So far I've experienced this for Engineering Upgrade and Spell book. It seems that adding them at map initialization to a unit causes the game to crash with a fatal error while loading. I was wondering if anybody had an answer to this one..
 
Reaction score
91
The Engineering Upgrade I am preloading does not give any ability improvements. I just use it for movement speed bonus. (yes, I've preloaded it individually and it still crashes)

As for the spell book, it contains that same Engineering Upgrade...
 

SanKakU

Member
Reaction score
21
well...if you preload the spellbook and it has the engineering upgrade...i think the engineering upgrade gets proloaded automatically since you preloaded the spell book? maybe not... i haven't done much preloading to be honest i haven't learned about it until recently which is kindof a bad thing but whatever...
 
Reaction score
91
So basically only Engineering Upgrade causes a crash at map initialization. Oh well, if it's just for one spell I don't mind - I'll preload it 0 seconds later. I was just wondering why it makes a fatal with no apparent reason.
 

SanKakU

Member
Reaction score
21
you said engineering upgrade gives movement speed bonus, but you haven't talked about the trigger that using it. if there is no trigger using it, why are you preloading it?
 
Reaction score
91
I'm preloading it because a trigger is using it.
Which has nothing to do with map initialization and triggers when a spell is cast.
However, the preload is at map init (as it should be) and I need it to be there, otherwise it creates a nasty little spike during play.
 

SanKakU

Member
Reaction score
21
I'm preloading it because a trigger is using it.
Which has nothing to do with map initialization and triggers when a spell is cast.
However, the preload is at map init (as it should be) and I need it to be there, otherwise it creates a nasty little spike during play.

so...is your preloading in the same trigger as your spell's trigger? that's where i put it. maybe if you read the preloading tutorial there's something you missed. how many skills have you successfully preloaded anyway?

there's no need to do it at 0 game time lol...

my preloading looks like this
JASS:

scope spellsEPUSE initializer I

globals
private integer i
private constant string DIVINITYSTART_EFFECT = "Abilities\\Spells\\Orc\\Reincarnation\\ReincarnationTarget.mdl"
private constant string DIVINITYREAPPEAR_EFFECT = "Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl"
endglobals

private function epuseherospells takes nothing returns nothing
    local real ux = GetUnitX(GetTriggerUnit())
    local real uy = GetUnitY(GetTriggerUnit())
    local unit u = null
    local unit ut = null
    local real rms
    local effect s = null
    //additionalmovespeedreductiondebilitate
    if i == 'A02P' then
    call TriggerSleepAction( 7.00 )
    call SetUnitMoveSpeed( GetSpellTargetUnit(), ( GetUnitMoveSpeed(GetSpellTargetUnit()) - 135.00 ) )
    call TriggerSleepAction( 4.00 )
    call SetUnitMoveSpeed( GetSpellTargetUnit(), ( GetUnitMoveSpeed(GetSpellTargetUnit()) + 135.00 ) )
    else
    //whirlwindsith
    if i == 'A02Z' then
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o005', GetUnitX(GetSpellTargetUnit()), GetUnitY(GetSpellTargetUnit()), 270.00)
    call SetUnitAbilityLevel(u, 'A02Y', GetUnitAbilityLevel(GetSpellAbilityUnit(),'A02Z'))
    call IssueImmediateOrder(u, "whirlwind")
    call UnitApplyTimedLife(u, 'BTLF', 5.0)
    else
    //maelstromsith
    if i == 'AMaE' then
    set ut = GetSpellTargetUnit()
    set u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'o005', GetUnitX(ut), GetUnitY(ut), 270.00)
    call TriggerSleepAction(0.015)
    if GetUnitAbilityLevel(GetTriggerUnit(),'AMaE') == 1 then
    call ShowUnit (ut, false)
    set rms = GetUnitMoveSpeed(u) - GetUnitMoveSpeed(ut)
    call SetUnitMoveSpeed(ut, GetUnitMoveSpeed(ut) + rms)
    call UnitApplyTimedLife(u, 'BTLF', 5.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(ut) - ux, GetUnitY(ut) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(ut) - ux, GetUnitY(ut) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(0.95)
    call ShowUnit (ut, true)
    call SetUnitMoveSpeed(ut, GetUnitMoveSpeed(ut) - rms)
    elseif GetUnitAbilityLevel(GetTriggerUnit(),'AMaE') == 2 then
    call ShowUnit (ut, false)
    set rms = GetUnitMoveSpeed(u) - GetUnitMoveSpeed(ut)
    call SetUnitMoveSpeed(ut, GetUnitMoveSpeed(ut) + rms)
    call UnitApplyTimedLife(u, 'BTLF', 6.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(ut) - ux, GetUnitY(ut) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(ut) - ux, GetUnitY(ut) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(0.95)
    call ShowUnit (ut, true)
    call SetUnitMoveSpeed(ut, GetUnitMoveSpeed(ut) - rms)
    elseif GetUnitAbilityLevel(GetTriggerUnit(),'AMaE') == 3 then
    call ShowUnit (ut, false)
    set rms = GetUnitMoveSpeed(u) - GetUnitMoveSpeed(ut)
    call SetUnitMoveSpeed(ut, GetUnitMoveSpeed(ut) + rms)
    call UnitApplyTimedLife(u, 'BTLF', 7.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(ut) - ux, GetUnitY(ut) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(ut) - ux, GetUnitY(ut) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(0.95)
    call ShowUnit (ut, true)
    call SetUnitMoveSpeed(ut, GetUnitMoveSpeed(ut) - rms)
    elseif GetUnitAbilityLevel(GetTriggerUnit(),'AMaE') == 4 then
    call ShowUnit (ut, false)
    set rms = GetUnitMoveSpeed(u) - GetUnitMoveSpeed(ut)
    call SetUnitMoveSpeed(ut, GetUnitMoveSpeed(ut) + rms)
    call UnitApplyTimedLife(u, 'BTLF', 8.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(ut) - ux, GetUnitY(ut) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(ut) - ux, GetUnitY(ut) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(1.0)
    set ux = GetUnitX(GetTriggerUnit()) - GetUnitX(u)
    set uy = GetUnitY(GetTriggerUnit()) - GetUnitY(u)
    call IssuePointOrder(u, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call IssuePointOrder(ut, "move", GetUnitX(u) - ux, GetUnitY(u) - uy)
    call TriggerSleepAction(0.95)
    call ShowUnit (ut, true)
    call SetUnitMoveSpeed(ut, GetUnitMoveSpeed(ut) - rms)
    endif
   // call TriggerSleepAction(2.5)
   // call SetUnitPosition(ut, GetUnitX(u), GetUnitY(u))
    else
    //sleepunitjeditrance
    if i == 'A030' then
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'e000', GetUnitX(GetSpellTargetUnit()), GetUnitY(GetSpellTargetUnit()), 270.00)
    call UnitAddAbility(u, 'A03B')
    call IssueTargetOrder(u, "sleep", GetSpellTargetUnit() )
    call UnitApplyTimedLife(u, 'BTLF', 2.0)
    else
    //frozen divinity spell
    if i == 'A03N' then
    call TriggerSleepAction( 1.267 )//the animation duration for spellcasting
    call ShowUnit (GetTriggerUnit(), false)
    set s = AddSpecialEffect(DIVINITYSTART_EFFECT, ux, uy)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o006', ux, uy, GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 1.80 + (1.00 * GetUnitAbilityLevel(GetTriggerUnit(), 'A03N')))
    call SetUnitAnimation( u, "Birth" )
    call TriggerSleepAction( 1.30 )
    call SetUnitAnimationWithRarity( u, "Stand", RARITY_FREQUENT )
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o008', ux, uy, GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 0.50 + (1.00 * GetUnitAbilityLevel(GetTriggerUnit(), 'A03N')))
    call SetUnitAnimation( u, "birth" )
    call TriggerSleepAction( 0.50 )
    call SetUnitAnimationWithRarity( u, "stand", RARITY_FREQUENT )
    call TriggerSleepAction( 1.00 * GetUnitAbilityLevel(GetTriggerUnit(), 'A03N') )
    call DestroyEffect(AddSpecialEffect(DIVINITYREAPPEAR_EFFECT, ux, uy))
    call DestroyEffect(s)
    call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.00, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 100.00, 100.00, 0 )
    call ShowUnit( GetTriggerUnit(), true )
    call SelectUnitForPlayerSingle(GetTriggerUnit(), GetOwningPlayer(GetTriggerUnit()))
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o00A', ux + GetRandomReal(150.00, 800.00) * Cos(GetRandomReal(0, 360) * bj_DEGTORAD), uy + GetRandomReal(150.00, 800.00) * Sin(GetRandomReal(0, 360) * bj_DEGTORAD), GetRandomReal(0, 360))
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'o007', ux + 200 * Cos(270 * bj_DEGTORAD), uy + 200 * Sin(270 * bj_DEGTORAD), GetRandomReal(0, 360))
    call SetUnitAbilityLevel(u, 'A03M', GetUnitAbilityLevel(GetTriggerUnit(),'A03N'))
    call SetUnitAnimationWithRarity( u, "Stand Upgrade First", RARITY_FREQUENT )
    call UnitApplyTimedLife(u, 'BTLF', 30.00)
    else
    //ice nova slow effect
    if i == 'A03O' then
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o009', ux, uy, 270.00)
    call SetUnitAbilityLevel(u, 'A03L', GetUnitAbilityLevel(GetSpellAbilityUnit(),'A03O'))
    call IssueImmediateOrder( u, "thunderclap" )
    call UnitApplyTimedLife(u, 'BTLF', 3.0)
    else
    //graphics for searing light spell
    if i == 'A03P' then
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o00B', ux + 400.00 * Cos(45.00 * bj_DEGTORAD), uy + 400.00 * Sin(45.00 * bj_DEGTORAD), 270.00)
    call UnitApplyTimedLife(u, 'BTLF', 3.0)
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o00B', ux + 400.00 * Cos(45.00 * bj_DEGTORAD), uy + 400.00 * Sin(45.00 * bj_DEGTORAD), 180.00)
    call UnitApplyTimedLife(u, 'BTLF', 3.0)
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o00B', ux + 400.00 * Cos(45.00 * bj_DEGTORAD), uy + 400.00 * Sin(45.00 * bj_DEGTORAD), 225.00)
    call UnitApplyTimedLife(u, 'BTLF', 3.0)
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o00B', ux + 400.00 * Cos(135.00 * bj_DEGTORAD), uy + 400.00 * Sin(135.00 * bj_DEGTORAD), 270.00)
    call UnitApplyTimedLife(u, 'BTLF', 3.0)
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o00B', ux + 400.00 * Cos(135.00 * bj_DEGTORAD), uy + 400.00 * Sin(135.00 * bj_DEGTORAD), 0.00)
    call UnitApplyTimedLife(u, 'BTLF', 3.0)
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o00B', ux + 400.00 * Cos(135.00 * bj_DEGTORAD), uy + 400.00 * Sin(135.00 * bj_DEGTORAD), 315.00)
    call UnitApplyTimedLife(u, 'BTLF', 3.0)
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o00B', ux + 400.00 * Cos(225.00 * bj_DEGTORAD), uy + 400.00 * Sin(225.00 * bj_DEGTORAD), 90.00)
    call UnitApplyTimedLife(u, 'BTLF', 3.0)
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o00B', ux + 400.00 * Cos(225.00 * bj_DEGTORAD), uy + 400.00 * Sin(225.00 * bj_DEGTORAD), 0.00)
    call UnitApplyTimedLife(u, 'BTLF', 3.0)
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o00B', ux + 400.00 * Cos(225.00 * bj_DEGTORAD), uy + 400.00 * Sin(225.00 * bj_DEGTORAD), 45.00)    
    call UnitApplyTimedLife(u, 'BTLF', 3.0)
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o00B', ux + 400.00 * Cos(315.00 * bj_DEGTORAD), uy + 400.00 * Sin(315.00 * bj_DEGTORAD), 90.00)
    call UnitApplyTimedLife(u, 'BTLF', 3.0)
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o00B', ux + 400.00 * Cos(315.00 * bj_DEGTORAD), uy + 400.00 * Sin(315.00 * bj_DEGTORAD), 180.00)
    call UnitApplyTimedLife(u, 'BTLF', 3.0)
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'o00B', ux + 400.00 * Cos(315.00 * bj_DEGTORAD), uy + 400.00 * Sin(315.00 * bj_DEGTORAD), 135.00)    
    call UnitApplyTimedLife(u, 'BTLF', 3.0)
    //flame storm slow effect
    else
    if i == 'A00M' then
    if GetFloatGameState(GAME_STATE_TIME_OF_DAY) < 18.00 then
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'e000', ux, uy, 270.00)
    call UnitAddAbility(u, 'A00Z')
    call SetUnitAbilityLevel(u, 'A00Z', GetUnitAbilityLevel(GetSpellAbilityUnit(),'A00M'))
    call UnitApplyTimedLife(u, 'BTLF', 5.0)
    endif
    else
    //coldstorm slow effect
    if i == 'A00K' then
    if GetFloatGameState(GAME_STATE_TIME_OF_DAY) >= 18.00 then
    set u = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'e000', ux, uy, 270.00)
    call UnitAddAbility(u, 'A00Y')
    call SetUnitAbilityLevel(u, 'A00Y', GetUnitAbilityLevel(GetSpellAbilityUnit(),'A00K'))
    call UnitApplyTimedLife(u, 'BTLF', 5.0)
    endif
    endif
    endif
    endif
    endif
    endif
    endif
    endif
    endif
    endif
set s = null
set u = null
set ut = null
endfunction

private function A takes nothing returns nothing
set i = GetSpellAbilityId()
    if i == 'A00M' or i == 'A00K' or i == 'A03P' or i == 'A03O' or i == 'A03N' or i == 'A030' or i == 'A02P' or i == 'A02Z' or i == 'AMaE' then
    call epuseherospells()
    endif
endfunction

//===========================================================================
private function I takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction( t, function A )
    call Preload(DIVINITYSTART_EFFECT)     
    call Preload(DIVINITYREAPPEAR_EFFECT)
    //preloading the ability       
    set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'e008', 380, 380, 0)    
    call UnitAddAbility(bj_lastCreatedUnit, 'A03N')        
    call KillUnit(bj_lastCreatedUnit)
    set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'e008', 380, 380, 0)    
    call UnitAddAbility(bj_lastCreatedUnit, 'A00M')        
    call KillUnit(bj_lastCreatedUnit)
    set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'e008', 380, 380, 0)    
    call UnitAddAbility(bj_lastCreatedUnit, 'A00K')        
    call KillUnit(bj_lastCreatedUnit)
    set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'e008', 380, 380, 0)    
    call UnitAddAbility(bj_lastCreatedUnit, 'A03P')        
    call KillUnit(bj_lastCreatedUnit)
    set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'e008', 380, 380, 0)    
    call UnitAddAbility(bj_lastCreatedUnit, 'A03O')        
    call KillUnit(bj_lastCreatedUnit)
    set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'e008', 380, 380, 0)
    call UnitAddAbility(bj_lastCreatedUnit, 'A03B')
    call KillUnit(bj_lastCreatedUnit)
    set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'e008', 380, 380, 0)
    call UnitAddAbility(bj_lastCreatedUnit, 'A030')
    call KillUnit(bj_lastCreatedUnit)
    set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'e008', 380, 380, 0)
    call UnitAddAbility(bj_lastCreatedUnit, 'A02Z')
    call KillUnit(bj_lastCreatedUnit)
    set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'e008', 380, 380, 0)
    call UnitAddAbility(bj_lastCreatedUnit, 'A02Y')
    call KillUnit(bj_lastCreatedUnit)
    set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'e008', 380, 380, 0)
    call UnitAddAbility(bj_lastCreatedUnit, 'A02P')
    call KillUnit(bj_lastCreatedUnit)
    set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'e008', 380, 380, 0)
    call UnitAddAbility(bj_lastCreatedUnit, 'AMaE')
    call KillUnit(bj_lastCreatedUnit)
endfunction
endscope

anyways, as you can see, i have the preloadings in the same trigger as the spells that are registering EPUSE (EVENT_PLAYER_UNIT_SPELL_EFFECT).
 
Reaction score
91
> Try preloading at 0.00 game time.
Yes, yes, I've already done that but I want to know WHY it crashes at map init. :p

> is your preloading in the same trigger as your spell's trigger?
It doesn't matter - I preload from every script that contains ability IDs.

SanKakU, your preloading is ... uh, not the way I use. http://www.wc3c.net/showthread.php?t=105279

JASS:
scope SomeSpell initializer Init 

globals
    private constant integer AID_RAW = 'A01F'
    private constant real DURATION = 3. 
    // etc.
endglobals

private function Conditions takes ... // etc. etc.

private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call TriggerRegister... // and so on
    call AbilityPreload(AID_RAW)
endfunction

endscope


> how many skills have you successfully preloaded anyway?
Around 100. See, the problem does not lie in the snippet I use but in the ability itself.
 

SanKakU

Member
Reaction score
21
oh ok, well uh...should i try to make a trigger for the engineering upgrade? idk what to use really...or what kindof spell to make...why don't you try the second way of doing preloading for abilities and see if that works or not? if not, it's sounding like there's something wrong with the trigger...but if not preloading it, it will work fine then that seems like that's not the case...interesting.

i don't even know what event you could be using for a trigger based off of engineering upgrade because it's supposed to be an ability you can't cast...how different is it from evasion or attribute bonus?

edit: oh you're using a preloading system huh? i haven't seen that one...i thought that might've been the tutorial i read about making spells, which including a short explanation on how to preload abilities.

i don't understand what's so special about that system, it seems so complicated, what advantage would it have over the three simple lines that is the method i've been using?
JASS:

set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'e008', 380, 380, 0)//e008 is a normal dummy unit, 380, 380 is the middle of my map(better than 0, 0 because that's part of the border of my map)
call UnitAddAbility(bj_lastCreatedUnit, 'A03N')//A03N is an ability that this trigger uses
call KillUnit(bj_lastCreatedUnit)// the last step of the preloading


people are talking about systems and standards in that thread and arguing over that but i still don't get the part where this method of preloading isn't good enough...is it too slow?

edit: oh hey, i started messing around with engineering upgrad ability...and i didn't yet add any triggers to it..but check it out, it looks like you might be able to get a whole new hero every time you get an engineering upgrade right? well maybe...anyway i think i have to edit more things about it because as it is now it's too glitchy...lol.
 

chobibo

Level 1 Crypt Lord
Reaction score
48
@ Mr. Sankaku
Additional overhead operation. Some systems use a single unit to preload all spells, plus creating a single unit for each preload would cause a longer loading time.
 

SanKakU

Member
Reaction score
21
@ Mr. Sankaku
Additional overhead operation. Some systems use a single unit to preload all spells, plus creating a single unit for each preload would cause a longer loading time.

oh, does that mean it's better to put in that trigger the following?

JASS:

set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'e008', 380, 380, 0)    
    call UnitAddAbility(bj_lastCreatedUnit, 'A03N')        
    call UnitAddAbility(bj_lastCreatedUnit, 'A00M')        
    call UnitAddAbility(bj_lastCreatedUnit, 'A00K')        
    call UnitAddAbility(bj_lastCreatedUnit, 'A03P')        
    call UnitAddAbility(bj_lastCreatedUnit, 'A03O')        
    call UnitAddAbility(bj_lastCreatedUnit, 'A03B')
    call UnitAddAbility(bj_lastCreatedUnit, 'A030')
    call UnitAddAbility(bj_lastCreatedUnit, 'A02Z')
    call UnitAddAbility(bj_lastCreatedUnit, 'A02Y')
    call UnitAddAbility(bj_lastCreatedUnit, 'A02P')
    call UnitAddAbility(bj_lastCreatedUnit, 'AMaE')
    call KillUnit(bj_lastCreatedUnit)
 

chobibo

Level 1 Crypt Lord
Reaction score
48
Yes. Preload systems assign a dedicated unit as a preloader to avoid doing that, look, you need to add every ability in that function. Just use a global dedicated dummy to preload all abilities, then run a timer that will remove the dummy from the game at 0 game time.
 

SanKakU

Member
Reaction score
21
Yes. Preload systems assign a dedicated unit as a preloader to avoid doing that, look, you need to add every ability in that function. Just use a global dedicated dummy to preload all abilities, then run a timer that will remove the dummy from the game at 0 game time.

well, i guess my point was i was just wondering that it's ok to preload a large number of abilities all on a single unit before killing him because i know if you give a unit too much abilities he won't be able to use some of them so i would suppose that would mean there might be errors in the preloading if you tried using this method.
 

chobibo

Level 1 Crypt Lord
Reaction score
48
The unit won't be able to use all abilities beause of the UI limitation, not because it's the game engine's limit. There will be no errors on the preloaded abilities, since the purpose of preloading is to load the slk data to memory, which this method accomplishes perfectly.
 

SanKakU

Member
Reaction score
21
The unit won't be able to use all abilities beause of the UI limitation, not because it's the game engine's limit. There will be no errors on the preloaded abilities, since the purpose of preloading is to load the slk data to memory, which this method accomplishes perfectly.

you know i think i came up with a good idea for how to test this. i'm going to give a unit 10-20 abilities and have him cast them all with triggers and see if that works. it sounds like it should work, and if it does, it would prove it.
 

SanKakU

Member
Reaction score
21
well anyway it wasn't proven to me...

yeah this is kindof amazing for me...i didn't know it was possible to trigger a unit to cast all those spells.

ok, since i'm already here asking questions people already know the answer to...

what abilities exactly do you preload? all abilities involved in triggers? or just abilities that when they are used let triggers fire? or is that not true either? what decides whether you preload the abilities? i wouldn't want my map to have a huge loading time for a lot of preloaded abilities that it didn't need to preload.
 

chobibo

Level 1 Crypt Lord
Reaction score
48
Abilities you add to units via trigger. Custom abilities that are added on the WE Object Editor doesn't need preloading.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top