I'm trying to make a modified version of the spell "Intercept" that shows up in BSPro maps (if any of you plays Bships). Anyway, I normally wouldn't do this, but after much frustration at not getting the spell to work quite right, I exported the triggers from their map and basically made the exact same ability with triggers and it works almost identically except that every time I use the ability there's a lag before it actually does the intercept ability.
To make a long story as short as possible, I took the identical spell from the map and put it into a demo map and it has this lag issue. The only difference I can see between what they have in their map and what I have in my lil demo map is that they made GLOBAL trigger variables (udg_trigger) and the functions declared as a header and called in a "main". While I'm certainly no pro with jass, I've never seen anything like this before, and I was wondering if anyone could offer help on how to do something like this.
BTW, this is not first cast lag, this isn't memory leaks, it's some goofy thing where the spell doesn't cast immediately, but about 1/2 second after the ability is cast. Thanks a bunch!
(If you need the code from their map and my demo, I'd be happy to post it here)
Lag in spell cast
Moderator: Cheaters
-
- Forum Fanatic
- Posts: 315
- Joined: October 16th, 2007, 7:32 pm
Re: Lag in spell cast
Post the map, or the spell trigger its hard to help you without the trigger thats causing the problem 

-
- Newcomer
- Posts: 2
- Joined: December 17th, 2009, 9:18 am
Re: Lag in spell cast
Code: Select all
//===========================================================================
// Trigger: intercept_pre_init
//===========================================================================
function Trig_intercept_pre_init_Conditions takes nothing returns boolean
return(GetSpellAbilityId()=='A00I')
endfunction
function Trig_intercept_pre_init_Func002C takes nothing returns boolean
return(GetTerrainCliffLevelBJ(udg_location02)>3)
endfunction
function Trig_intercept_pre_init_Actions takes nothing returns nothing
set udg_location02=GetSpellTargetLoc()
if(Trig_intercept_pre_init_Func002C())then
set udg_location01=GetUnitLoc(GetTriggerUnit())
call SetUnitPositionLoc(GetTriggerUnit(),udg_location01)
call RemoveLocation(udg_location01)
set udg_force03=GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit()))
call DisplayTimedTextToForce(udg_force03,5.,"|cffffcc00Error|r: Cannot target land")
call DestroyForce(udg_force03)
endif
call RemoveLocation(udg_location02)
endfunction
//===========================================================================
function InitTrig_intercept_pre_init takes nothing returns nothing
set gg_trg_intercept_pre_init = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(gg_trg_intercept_pre_init,EVENT_PLAYER_UNIT_SPELL_CHANNEL)
call TriggerAddCondition(gg_trg_intercept_pre_init,Condition(function Trig_intercept_pre_init_Conditions))
call TriggerAddAction( gg_trg_intercept_pre_init, function Trig_intercept_pre_init_Actions )
endfunction//===========================================================================
// Trigger: intercept_init
//===========================================================================
function Trig_intercept_init_Conditions takes nothing returns boolean
return(GetSpellAbilityId()=='A00I')
endfunction
function Trig_intercept_init_Actions takes nothing returns nothing
set udg_booleans08[(1+GetPlayerId(GetOwningPlayer(GetTriggerUnit())))]=true
set udg_units06[(1+GetPlayerId(GetOwningPlayer(GetTriggerUnit())))]=GetTriggerUnit()
set udg_locations01[(1+GetPlayerId(GetOwningPlayer(GetTriggerUnit())))]=GetSpellTargetLoc()
call UnitRemoveAbility(GetTriggerUnit(),'B00L')
call UnitRemoveAbility(GetTriggerUnit(),'B006')
call UnitRemoveAbility(GetTriggerUnit(),'B01C')
call UnitRemoveAbility(GetTriggerUnit(),'B004')
call UnitRemoveAbility(GetTriggerUnit(),'Bena')
call UnitRemoveAbility(GetTriggerUnit(),'Bens')
call UnitRemoveAbility(GetTriggerUnit(),'Beng')
call UnitRemoveAbility(GetTriggerUnit(),'BNab')
call UnitAddAbility(GetTriggerUnit(),'Avul')
call SetUnitFacingToFaceLocTimed(GetTriggerUnit(),udg_locations01[(1+GetPlayerId(GetOwningPlayer(GetTriggerUnit())))],0)
call SetUnitTurnSpeed(GetTriggerUnit(),.0)
call EnableTrigger( gg_trg_intercept_action )
endfunction
//===========================================================================
function InitTrig_intercept_init takes nothing returns nothing
set gg_trg_intercept_init = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(gg_trg_intercept_init,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_intercept_init,Condition(function Trig_intercept_init_Conditions))
call TriggerAddAction( gg_trg_intercept_init, function Trig_intercept_init_Actions )
endfunction//===========================================================================
// Trigger: intercept_action
//===========================================================================
function Trig_intercept_action_Func002Func001C takes nothing returns boolean
return(udg_booleans08[bj_forLoopAIndex])
endfunction
function Trig_intercept_action_Func003Func001Func001Func007Func014Func001C takes nothing returns boolean
return(udg_booleans08[bj_forLoopAIndex])
endfunction
function Trig_intercept_action_Func003Func001Func001Func007Func015C takes nothing returns boolean
return(udg_integer53==0)
endfunction
function Trig_intercept_action_Func003Func001Func001Func007C takes nothing returns boolean
return(udg_real06<50.)
endfunction
function Trig_intercept_action_Func003Func001Func001C takes nothing returns boolean
return(udg_booleans08[bj_forLoopAIndex])
endfunction
function Trig_intercept_action_Func003C takes nothing returns boolean
return(udg_integer53==0)
endfunction
function Trig_intercept_action_Actions takes nothing returns nothing
set udg_integer53=0
set bj_forLoopAIndex=3
set bj_forLoopAIndexEnd=12
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
if(Trig_intercept_action_Func002Func001C())then
set udg_integer53=(udg_integer53+1)
endif
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
if(Trig_intercept_action_Func003C())then
call DisableTrigger(GetTriggeringTrigger())
else
set bj_forLoopAIndex=3
set bj_forLoopAIndexEnd=12
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
if(Trig_intercept_action_Func003Func001Func001C())then
set udg_interceptship=udg_units06[bj_forLoopAIndex]
set udg_location01=GetUnitLoc(udg_interceptship)
set udg_location02=PolarProjectionBJ(udg_location01,48.,AngleBetweenPoints(udg_location01,udg_locations01[bj_forLoopAIndex]))
call SetUnitX(udg_interceptship,GetLocationX(udg_location02))
call SetUnitY(udg_interceptship,GetLocationY(udg_location02))
set udg_real06=DistanceBetweenPoints(udg_location02,udg_locations01[bj_forLoopAIndex])
if(Trig_intercept_action_Func003Func001Func001Func007C())then
call UnitRemoveAbility(udg_interceptship,'Avul')
call UnitRemoveAbility(udg_interceptship,'B004')
call UnitRemoveAbility(udg_interceptship,'Bena')
call UnitRemoveAbility(udg_interceptship,'Bens')
call UnitRemoveAbility(udg_interceptship,'Beng')
call SetUnitTurnSpeed(udg_interceptship,GetUnitDefaultTurnSpeed(udg_interceptship))
set udg_booleans08[bj_forLoopAIndex]=false
call CreateNUnitsAtLoc(1,'nvul',Player(-1+(bj_forLoopAIndex)),udg_location02,.0)
call UnitApplyTimedLifeBJ(1.,'BTLF',bj_lastCreatedUnit)
call UnitAddAbility(bj_lastCreatedUnit,'A00K')
call SetUnitAbilityLevelSwapped('A00K',bj_lastCreatedUnit,GetUnitAbilityLevelSwapped('A00I',udg_interceptship))
call IssueTargetOrderById(bj_lastCreatedUnit,852101,udg_interceptship)
call RemoveLocation(udg_locations01[bj_forLoopAIndex])
set bj_forLoopAIndex=3
set bj_forLoopAIndexEnd=12
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
if(Trig_intercept_action_Func003Func001Func001Func007Func014Func001C())then
set udg_integer53=(udg_integer53+1)
endif
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
if(Trig_intercept_action_Func003Func001Func001Func007Func015C())then
set udg_integer53=0
call DisableTrigger(GetTriggeringTrigger())
endif
endif
call RemoveLocation(udg_location01)
call RemoveLocation(udg_location02)
set udg_interceptship=null
set udg_real06=.0
endif
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
endif
endfunction
//===========================================================================
function InitTrig_intercept_action takes nothing returns nothing
set gg_trg_intercept_action = CreateTrigger( )
call DisableTrigger( gg_trg_intercept_action )
call TriggerRegisterTimerEventPeriodic( gg_trg_intercept_action, 0.03 )
call TriggerAddAction( gg_trg_intercept_action, function Trig_intercept_action_Actions )
endfunction
EDIT: I forgot, the base spell they use is Shockwave. (no art, and nothing else of that spell seems relivant)
Very sorry for the double post, I wasn't thinking!
Last edited by Nobody on December 18th, 2009, 6:32 am, edited 1 time in total.
-
- Some Honorary Title
- Posts: 1713
- Joined: June 8th, 2007, 5:08 am
- Title: Angry Bird
Re: Lag in spell cast
Which forums are you now working at? Can I have the forums' link? Just to see your latest updates of the map.
-
- Newcomer
- Posts: 20
- Joined: September 30th, 2009, 5:32 am
Re: Lag in spell cast
Well Battle ships might use a method of some sort to reload the ability which would include having a dummy unit cast the spell and after it is finished removing the unit.
95% Percent of teens would have a breakdown if Hannah Montana was standing on the edge of a tower, ready to jump. Copy and paste this if you're part of the 5% yelling "Jump, Bitch!!!
My Website
My Website