HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Stuff that can cause lags/drops

05-05-2004, 12:34 AM#1
iac
Hi, all. I have a problem with some triggers that cause ppl to be disconnected. So I ask everyone to post here known issues in triggers that can cause lags or drops in game. I think it will be pretty useful not only for me.
05-05-2004, 10:41 AM#2
Cubasis
Erhm, are you using JASS?
If yes, do you ever use on your own GetLocalPlayer()?

Cause if not, or if you use GUI....then ...

Well, most (if not all) disconnectation problems are related to De-sync'ing...that is, when one player does something else than everybody else. And the only way to be able to do this, is with GetLocalPlayer(), or a couple of other actions/functions that return local values.

I can't really know what your problem is, but if you're somewhere getting camera values/stuff from a certain player or sumtin, that might be your problem.

Anyways, you can try attaching your map or list suspicious triggers. I won't promise i'll have time to open a map though.

Cubasis
05-05-2004, 03:59 PM#3
iac
First of all, thanx for paying attention.

Well, I do not neither use GetLocalPlayer() nor playing with Cameras attributes (i guess, cameras can only desync the game if some all-players values are set to current camera attributes of one of players and such stuff like pan and apply camera can not) As you see, i do use cameras, but only panning them.

I think that in my situation desync is caused by running some triggers for different number of times on different machines, but i can not imagine what can cause this.

What triggers in my map do (hey, Vex! Thanx for idea! =):
- All neutral-passive heroes in certain rgn have Amov, Aatk and Afin abilities removed, then 'A006' and 'A007' abilities added (pick and random pick abilities)
- When a player selects one of these heroes selected hero will be given to that player
- Then, if a hero finishes using (EVENT_PLAYER_UNIT_SPELL_FINISH) ability Pick trigger will be executed. Pick trigger creates a hero of type of casting unit (A006 is casted), or creates a hero of type of random unit in 'udg_HeroesToPick' unit array (A007 is casted).

Here is desync. When Pick is executed ppl will recieve a hero and then get disced.

Here is trigger text:
------------------
function Trig_Pick_hero_Conditions takes nothing returns boolean
if ( not ( udg_Hero[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] == null ) ) then
return false
endif
if ( not ( GetOwningPlayer(GetSpellAbilityUnit()) != udg_ArmyOwnerNW ) ) then
return false
endif
if ( not ( GetOwningPlayer(GetSpellAbilityUnit()) != udg_ArmyOwnerSE ) ) then
return false
endif
if ( not ( IsUnitType(GetSpellAbilityUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction

function Trig_Pick_hero_Actions takes nothing returns nothing

local unit hero = GetSpellAbilityUnit()
local player owner = GetOwningPlayer(hero)
local integer id = GetConvertedPlayerId(owner)
local unit newhero

local real x = GetRectCenterX(udg_Respawn[id])
local real y = GetRectCenterY(udg_Respawn[id])

if GetSpellAbilityId() == 'A006' then //*Pick Hero Clicked
call SetUnitOwner( hero, Player(PLAYER_NEUTRAL_PASSIVE), true )

set newhero=CreateUnit(owner, GetUnitTypeId(hero),x,y, bj_UNIT_FACING )

call SmartCameraPanBJ( owner, GetRectCenter(udg_Respawn[id]), 0.5 )
set udg_Hero[id] = newhero
call SetHeroLevelBJ( newhero, udg_HeroLevel[id], false )
call AddSpecialEffectLocBJ( GetUnitLoc(newhero), "Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl" )
call SelectUnitForPlayerSingle( newhero, owner )
set udg_SelectedHero[id] = null
call SetPlayerAllianceBJ( Player(PLAYER_NEUTRAL_PASSIVE), ALLIANCE_SHARED_VISION, false, owner )

elseif GetSpellAbilityId() == 'A007' then //*Pick Random Hero Clicked
call SetUnitOwner( hero, Player(PLAYER_NEUTRAL_PASSIVE), true )

set newhero=CreateUnit(owner, GetUnitTypeId(udg_HeroesToPick[GetRandomInt(0, udg_NumberOfHeroes)]),x,y, bj_UNIT_FACING )

call SmartCameraPanBJ( owner, GetRectCenter(udg_Respawn[id]), 0.5 )
set udg_Hero[id] = newhero
call SetHeroLevelBJ( newhero, udg_HeroLevel[id], false )
call AddSpecialEffectLocBJ( GetUnitLoc(newhero), "Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl" )
call SelectUnitForPlayerSingle( newhero, owner )
set udg_SelectedHero[id] = null
call SetPlayerAllianceBJ( Player(PLAYER_NEUTRAL_PASSIVE), ALLIANCE_SHARED_VISION, false, owner )
endif


endfunction

//===========================================================================
function InitTrig_Pick_hero takes nothing returns nothing
set gg_trg_Pick_hero = CreateTrigger( )

call TriggerRegisterAnyUnitEventBJ( gg_trg_Pick_hero, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Pick_hero, Condition( function Trig_Pick_hero_Conditions ) )
call TriggerAddAction( gg_trg_Pick_hero, function Trig_Pick_hero_Actions )
endfunction
---------------------

Can be desync caused by using EVENT_PLAYER_UNIT_SPELL_FINISH and not EVENT_PLAYER_UNIT_SPELL_CAST ?
Or it is caused by using specific base abilities for A006 and A007 (A006 - summon furbolg, AFAIR, and A007 - scroll of mana restoration ability)? BTW, there are mages owned by CPU armies that cast 'raise dead' - can there be a conflict with A006?

ps: I do know, that it is damn leaking trigger, but firstly i want to remove desync problem.
05-06-2004, 05:31 AM#4
iac
Dammit! I've found it.
It was
'call SmartCameraPanBJ( owner, GetRectCenter(udg_Respawn[id]), 0.5 )'

I couldn't even imagine that using "Pan as nessesary" is causing desycronization... But since I had removed it drops have disappeared, since I added this string, drops appear again.

Cubasis, thanx for dropping in the idea about cameras - although I didn't try to get camera variables, it was camera who dropped ppl. Without you, I wouldn't even try to check this string for the issue.