- Joined
- Jul 2, 2008
- Messages
- 156
Hello once again.
I would like to start by saying I've had much success with converting some GUI triggers into JASS, with tons of credit to this forum's help. But, alas, I have a new problem, and for once its not syntax.
My situation: When a player selects a hero in my game, the game freezes briefly for about 2 seconds. I figured the trigger lagged because it was in GUI and using useless BJ's, but after I redid it in JASS, it still has the same lag effect.
I think it may be because I'm adding items to the hero as soon as he is selected, but I'm not entirely sure.
My code:
I know its hard to believe it lags.
EDIT: It just occurred to me that one of the items is a spellbook with a ton of spells in it. Anyone know if this could contribute to the lag?
EDIT 2: I commented out the 2 lines regarding the spellbook, and the lag was non existent. So its obvious the problem is the spellbook, any ideas how to get around the lag from picking it up?
I would like to start by saying I've had much success with converting some GUI triggers into JASS, with tons of credit to this forum's help. But, alas, I have a new problem, and for once its not syntax.
My situation: When a player selects a hero in my game, the game freezes briefly for about 2 seconds. I figured the trigger lagged because it was in GUI and using useless BJ's, but after I redid it in JASS, it still has the same lag effect.
I think it may be because I'm adding items to the hero as soon as he is selected, but I'm not entirely sure.
My code:
JASS:
function Trig_Select_Dreadlord_Actions takes nothing returns nothing
local player p= GetLocalPlayer()
local integer n= GetPlayerId(p)
local item i
set hero[n]= CreateUnit( p, 'U000', 8800, 2400, 275.08 )
set i= CreateItem( 'I002', GetUnitX(hero[n]), GetUnitY(hero[n]) )
call UnitAddItem(hero[n], i)
set i= CreateItem( 'I00P', GetUnitX(hero[n]), GetUnitY(hero[n]) )
call UnitAddItem(hero[n], i)
set i= CreateItem( 'I003', GetUnitX(hero[n]), GetUnitY(hero[n]) )
call UnitAddItem(hero[n], i)
call MultiboardSetItemIconBJ( udg_Scoreboard, 1, udg_LeaderboardSpotP[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))], "ReplaceableTextures\\CommandButtons\\BTNHeroDreadLord.blp" )
if (GetLocalPlayer() == p) then
call PanCameraTo( GetUnitX(hero[n]), GetUnitY(hero[n]) )
call ClearSelection()
call SelectUnit(hero[n], true)
endif
if ( p == udg_RulePicker ) then
call TriggerSleepAction( 1.00 )
call DialogDisplay( udg_RulePicker, udg_RulesDialogue, true )
else
endif
call RemoveUnit( GetEnteringUnit() )
endfunction
I know its hard to believe it lags.
EDIT: It just occurred to me that one of the items is a spellbook with a ton of spells in it. Anyone know if this could contribute to the lag?
EDIT 2: I commented out the 2 lines regarding the spellbook, and the lag was non existent. So its obvious the problem is the spellbook, any ideas how to get around the lag from picking it up?