• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Can anyone in that triggers be reason of desynchronizations?

Status
Not open for further replies.
Level 7
Joined
Dec 31, 2011
Messages
249
Just "yes" or "no", please. And if "yes", where reasons?

This is examples from http://www.hiveworkshop.com/forums/triggers-scripts-269/very-big-hard-request-maybe-anyone-can-help-217571/]that thread I know, that is so hard and unneeded to reading all war3map.j, i try to post some examples, maybe anyone can help my to find desyncs.


function DestroyEffect2 takes nothing returns nothing
local timer t=GetExpiredTimer()
local effect e=LoadEffectHandle(udg_Hash,GetHandleId(t),4)
call DestroyEffect( e )
call FlushChildHashtable(udg_Hash,GetHandleId(t))
call DestroyTimer(t)
set t=null
set e=null
endfunction

function Trig_destroyspeceffect_Actions takes nothing returns nothing
local timer t = CreateTimer()
local effect e = GetLastCreatedEffectBJ()
call SaveEffectHandle(udg_Hash,GetHandleId(t),4,e)
call TimerStart(t,2,false,function DestroyEffect2)
set t=null
set e=null
endfunction

//===========================================================================
function InitTrig_destroyspeceffect takes nothing returns nothing
set gg_trg_destroyspeceffect = CreateTrigger( )
call TriggerAddAction( gg_trg_destroyspeceffect, function Trig_destroyspeceffect_Actions )
endfunction



function Trig_Insubmersible_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A19K' ) ) then
return false
endif
return true
endfunction

function Insurdamage takes nothing returns nothing
call DisableTrigger(GetTriggeringTrigger())
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) + ( GetEventDamage() / 2.00 ) ) )
call UnitDamageTargetBJ( GetTriggerUnit(), GetEventDamageSource(), ( GetEventDamage() / 2.00 ), ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL )
if ( not ( GetEventDamageSource() == GetTriggerUnit() ) ) then
call AddSpecialEffectTargetUnitBJ( "chest", GetEventDamageSource(), "Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl" )
call ConditionalTriggerExecute( gg_trg_destroyspeceffect )
else
endif
call EnableTrigger(GetTriggeringTrigger())
endfunction

function Insurmersible2 takes nothing returns nothing
local timer t=GetExpiredTimer()
local unit u5=LoadUnitHandle(udg_Hash,GetHandleId(t),2)
local trigger insurdamage=LoadTriggerHandle(udg_Hash,GetHandleId(t),20)
call UnitRemoveAbilityBJ( 'A192', u5 )
call UnitRemoveBuffBJ( 'B0AP', u5 )
call DestroyTrigger(insurdamage)
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash,GetHandleId(t))
set insurdamage=null
set u5 = null
set t = null
endfunction

function Trig_Insubmersible_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u5 = GetSpellTargetUnit()
local integer i=0
local trigger insurdamage


set insurdamage=CreateTrigger()
call TriggerRegisterUnitEvent(insurdamage,GetSpellTargetUnit(), EVENT_UNIT_DAMAGED)
call TriggerAddAction(insurdamage,function Insurdamage)

call UnitAddAbilityBJ( 'A192', GetSpellTargetUnit() )
call SaveUnitHandle(udg_Hash,GetHandleId(t),2,u5)
call SaveTriggerHandle(udg_Hash,GetHandleId(t),20,insurdamage)
call TimerStart(t,5,false,function Insurmersible2)
set t=null
set u5=null
set insurdamage=null
endfunction

//===========================================================================
function InitTrig_Insubmersible takes nothing returns nothing
set gg_trg_Insubmersible = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Insubmersible, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Insubmersible, Condition( function Trig_Insubmersible_Conditions ) )
call TriggerAddAction( gg_trg_Insubmersible, function Trig_Insubmersible_Actions )
endfunction



function Trig_Grace_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A175' ) ) then
return false
endif
return true
endfunction


function Grace2 takes nothing returns nothing
local timer t=GetExpiredTimer()
local unit u=LoadUnitHandle(udg_Hash,GetHandleId(t),2)
set udg_unit = u
call SetUnitAbilityLevelSwapped( 'A176', udg_unit, ( 1 + ( ( R2I(GetUnitStateSwap(UNIT_STATE_MAX_MANA, udg_unit)) - R2I(GetUnitStateSwap(UNIT_STATE_MANA, udg_unit)) ) / ( 10 / GetUnitAbilityLevelSwapped('A175', udg_unit) ) ) ) )
call AddSpecialEffectTargetUnitBJ( "hand,left", udg_unit, "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl" )
call ConditionalTriggerExecute( gg_trg_destroyspeceffect )
call AddSpecialEffectTargetUnitBJ( "weapon", udg_unit, "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl" )
call ConditionalTriggerExecute( gg_trg_destroyspeceffect )
set t=null
set u=null
endfunction

function Trig_Grace_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
call SaveUnitHandle(udg_Hash,GetHandleId(t),2,u)
call TimerStart(t,1,true,function Grace2)
set t=null
set u=null
endfunction

//===========================================================================
function InitTrig_Grace takes nothing returns nothing
set gg_trg_Grace = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Grace, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_Grace, Condition( function Trig_Grace_Conditions ) )
call TriggerAddAction( gg_trg_Grace, function Trig_Grace_Actions )
endfunction



function Trig_MovefromTaverns_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetSoldUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction

function Trig_MovefromTaverns_Func003C takes nothing returns boolean
if ( not ( udg_MyNewSide[GetConvertedPlayerId(GetOwningPlayer(GetSoldUnit()))] == "Light" ) ) then
return false
endif
return true
endfunction

function Trig_MovefromTaverns_Func005C takes nothing returns boolean
if ( not ( udg_nhl == false ) ) then
return false
endif
return true
endfunction

function Trig_MovefromTaverns_Func006Func001A takes nothing returns nothing
call SetPlayerUnitAvailableBJ( GetUnitTypeId(GetSoldUnit()), false, GetEnumPlayer() )
endfunction

function Trig_MovefromTaverns_Func006C takes nothing returns boolean
if ( not ( udg_Duplicate == false ) ) then
return false
endif
if ( not ( udg_nhl == false ) ) then
return false
endif
return true
endfunction

function Trig_MovefromTaverns_Actions takes nothing returns nothing
if ( Trig_MovefromTaverns_Func003C() ) then
set udg_point = GetRectCenter(gg_rct_LightHeroSpawn)
else
set udg_point = GetRectCenter(gg_rct_DarkHeroSpawn)
endif
call SetUnitPositionLoc( GetSoldUnit(), udg_point )
if ( Trig_MovefromTaverns_Func005C() ) then
set udg_LimitHeroTraining[GetConvertedPlayerId(GetOwningPlayer(GetSoldUnit()))] = ( udg_LimitHeroTraining[GetConvertedPlayerId(GetOwningPlayer(GetSoldUnit()))] - 1 )
call SetPlayerMaxHeroesAllowed( udg_LimitHeroTraining[GetConvertedPlayerId(GetOwningPlayer(GetSoldUnit()))], GetOwningPlayer(GetSoldUnit()) )
else
endif
if ( Trig_MovefromTaverns_Func006C() ) then
call ForForce( GetPlayersAll(), function Trig_MovefromTaverns_Func006Func001A )
else
endif
endfunction

//===========================================================================
function InitTrig_MovefromTaverns takes nothing returns nothing
set gg_trg_MovefromTaverns = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_MovefromTaverns, EVENT_PLAYER_UNIT_SELL )
call TriggerAddCondition( gg_trg_MovefromTaverns, Condition( function Trig_MovefromTaverns_Conditions ) )
call TriggerAddAction( gg_trg_MovefromTaverns, function Trig_MovefromTaverns_Actions )
endfunction
 
I assume he's asking it because he's facing desyncs and doesn't know what's causing them.

edit
All I did was input Cmd+F, typed GetLocalPlayer(), got no results, so I searched for Camera natives and shit, but failed, and this is why I'm glad to tell you, in big letters, the answer you wanted:

NO.

edit
And for future reference, it would be a lot better to use JASS tags rather than hidden tags.

JASS:
function ThisLooksAlotBetter takes nothing returns nothing
    if true then
        call DoNothing() // Weeeeeee.
    endif
endfunction
 
Last edited:
Level 7
Joined
Dec 31, 2011
Messages
249
ic3_water, problem of my map is a RANDOM desynchronizations, not in each game (in near 20% of games now, as i think), and after a long time.

So your way isn't help :(

I trying to find reason very much of time, maybe i don't understand something very important in triggers. Maybe some examples can help...

Magtheridon96

1 - Thanks even for such help :)
2 - OK, thanks.
 
Status
Not open for further replies.
Top