Ok i tested my map on bnet and i found out that is kinda laggy, so im trying to make it lagless, i started with periodic event triggers, but im kinda stuck, i dont understand how to do it without periodic event. maybe someone can help me?
EventsTimer-Every0.06secondsofGameTimeLocalVariablesWESTREDTEAM=False<Boolean>WESTGREENTEAM=False<Boolean>WESTREDCOUNTERTEAM=False<Boolean>WESTGREENCOUNTERTEAM=False<Boolean>ConditionsActionsUnitGroup-Pickeachunitin(AnyunitsinWESTStationBeaconownedbyplayerAnyPlayermatchingExcluded:Air,Structure,Missile,Item,Buried,Cloaked,Dead,Hidden,withatmostAnyAmount)anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions((Ownerof(Pickedunit))isinGREENTEAM)==True(Ownerof(Pickedunit))==14ThenVariable-SetWESTGREENTEAM=TrueElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions((Ownerof(Pickedunit))isinREDTEAM)==True(Ownerof(Pickedunit))==13ThenVariable-SetWESTREDTEAM=TrueElseUnitGroup-Pickeachunitin(AnyunitsinWESTGrouperownedbyplayerAnyPlayermatchingExcluded:Air,Structure,Missile,Item,Buried,Cloaked,Dead,Hidden,withatmostAnyAmount)anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions((Ownerof(Pickedunit))isinREDTEAM)==True(Ownerof(Pickedunit))==13ThenVariable-SetWESTREDCOUNTERTEAM=TrueElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions((Ownerof(Pickedunit))isinGREENTEAM)==True(Ownerof(Pickedunit))==14ThenVariable-SetWESTGREENCOUNTERTEAM=TrueElse-------WESTGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionsWESTPROGRESSBARCURRENTVALUE<200.0WESTGREENCOUNTERTEAM==FalseWESTREDTEAM==TrueThenVariable-ModifyWESTPROGRESSBARCURRENTVALUE:+1.0UI-SetProgressBarProgressforunit(UNIT)OutpostProgressBar[71.00,91.50] to (Integer(WEST PROGRESS BAR CURRENT VALUE))
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
WEST PROGRESS BAR CURRENT VALUE > 0.0
WEST GREEN TEAM == True
WEST RED COUNTER TEAM == False
Then
Variable - Modify WEST PROGRESS BAR CURRENT VALUE: - 1.0
UI - Set Progress Bar Progress for unit (UNIT) Outpost Progress Bar [71.00,91.50] to (Integer(WEST PROGRESS BAR CURRENT VALUE))
Else
Ok i tested my map on bnet and i found out that is kinda laggy, so im trying to make it lagless, i started with periodic event triggers, but im kinda stuck, i dont understand how to do it without periodic event. maybe someone can help me?
so ... to start with ... can you explain in plain english what the code is supposed to do?
I sort of get it from looking at the code ... but want to make sure i understand.
First obvious question ... why every 0.06 of a second? ( instead of like every second, or every 4 seconds? )
( given you are basically just updating a progress bar ... ).
If I'm gessing right you could do this with behaviors and regions region would replace the time weather the region is the entire map or a lot of different ones make an invisible behavior on the unt or structure and if unit or structure have behavior validate with trigger then true actions then apply what you are trying to apply or make another trigger with spawning a unit when the event that you're timer has and then kill the unit makeing this trigger run and the unit can have no model. But it seems to fix this you need another event of something.
so ... to start with ... can you explain in plain english what the code is supposed to do? I sort of get it from looking at the code ... but want to make sure i understand.
First obvious question ... why every 0.06 of a second? ( instead of like every second, or every 4 seconds? ) ( given you are basically just updating a progress bar ... ).
Theres a Region, Trigger checks if units of team A its in region, checks if units of team B its in region, if theres only units of team A it adds points to progress bar, same with team B, but if theres units of both teams nothing happens. And i use 0.06 period becuz i want process to start immediately as unit gets in region and not like in second after it happened. Progress Bar has 200 maximum value "0 - team A, 100 - neutral, 200 - team B" so with 0.06 period it takes like 10 seconds to get from 0 to 200.
btw if i make this periodic triggers are disabled from begining and enable them when units enters region? and then disable when units leave, it could make my map lag less?
i have the feeling that a while loop performs way better than a periodic event (never made an attempt to prove it thou). i would use an "enters region" event to maintain the unitgroups rather than checking all units in region which is more costly (i suppose, i wonder how that event is implemented).
i have the feeling that a while loop performs way better than a periodic event (never made an attempt to prove it thou). i would use an "enters region" event to maintain the unitgroups rather than checking all units in region which is more costly (i suppose, i wonder how that event is implemented).
instead of a trigger you create an action with "create thread" flag. then you do a "while" with your exit condition (turn former trigger off) and call this action whenever you would have turned the former trigger on.
Theres a Region, Trigger checks if units of team A its in region, checks if units of team B its in region, if theres only units of team A it adds points to progress bar, same with team B, but if theres units of both teams nothing happens. And i use 0.06 period becuz i want process to start immediately as unit gets in region and not like in second after it happened. Progress Bar has 200 maximum value "0 - team A, 100 - neutral, 200 - team B" so with 0.06 period it takes like 10 seconds to get from 0 to 200.
btw if i make this periodic triggers are disabled from begining and enable them when units enters region? and then disable when units leave, it could make my map lag less?
OK, so the first thing i would do is to remove ALL of the "Unit Group" processing from the 0.06 second trigger. Ie: remove the need to scan all the units to reset the unit related values.
Do this by creating a different trigger which uses events "Unit Enters Region" and "Unit Leaves Region" to update the unit groups.
then only process the triggering unit into (or out of) the relevant unit group.
In the timer trigger then you just assume the unit groups are correct (dont re-process them) and do process the rest of your Logic (the If statements).
You now have MOST of the logic occuring only on region enter/exit trigger, and far less processing occurring every 0.06 seconds trigger.
OK, so the first thing i would do is to remove ALL of the "Unit Group" processing from the 0.06 second trigger. Ie: remove the need to scan all the units to reset the unit related values.
Do this by creating a different trigger which uses events "Unit Enters Region" and "Unit Leaves Region" to update the unit groups. then only process the triggering unit into (or out of) the relevant unit group.
In the timer trigger then you just assume the unit groups are correct (dont re-process them) and do process the rest of your Logic (the If statements). You now have MOST of the logic occuring only on region enter/exit trigger, and far less processing occurring every 0.06 seconds trigger.
yea Funky helped me yesterday and i created new trigger, but still its not working right yet. becuz when alot of unit enters region its like runs update value trigger as many times as units entered region.
1.
ENTER/LEAVECENTRALOUTPOSTEventsUnit-AnyUnitEntersCENTRALGROUPERUnit-AnyUnitLeavesCENTRALGROUPERUnit-AnyUnitEntersCENTRALBEACONUnit-AnyUnitLeavesCENTRALBEACONUnit-AnyUnitdiesLocalVariablesCENTRALREDTEAM=False<Boolean>CENTRALGREENTEAM=False<Boolean>CENTRALREDCOUNTERTEAM=False<Boolean>CENTRALGREENCOUNTERTEAM=False<Boolean>Conditions((Triggeringunit)isinCENTRALGROUPER)==TrueActions-------CENTRAL-------CapturingUnitGroup-Pickeachunitin(AnyunitsinCENTRALBEACONownedbyplayerAnyPlayermatchingExcluded:Air,Structure,Missile,Item,Buried,Cloaked,Dead,Hidden,withatmostAnyAmount)anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions((Ownerof(Pickedunit))isinGREENTEAM)==True(Ownerof(Pickedunit))==14ThenVariable-SetCENTRALGREENTEAM=TrueElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions((Ownerof(Pickedunit))isinREDTEAM)==True(Ownerof(Pickedunit))==13ThenVariable-SetCENTRALREDTEAM=TrueElseUnitGroup-Pickeachunitin(AnyunitsinCENTRALGROUPERownedbyplayerAnyPlayermatchingExcluded:Air,Structure,Missile,Item,Buried,Cloaked,Dead,Hidden,withatmostAnyAmount)anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions((Ownerof(Pickedunit))isinREDTEAM)==True(Ownerof(Pickedunit))==13ThenVariable-SetCENTRALREDCOUNTERTEAM=TrueElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions((Ownerof(Pickedunit))isinGREENTEAM)==True(Ownerof(Pickedunit))==14ThenVariable-SetCENTRALGREENCOUNTERTEAM=TrueElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionsCENTRALPROGRESSBARCURRENTVALUE<200.0CENTRALREDTEAM==TrueCENTRALGREENCOUNTERTEAM==FalseThenVariable-SetCENTRALREDPROCESS=TrueCENTRALREDPROCESS()ElseVariable-SetCENTRALREDPROCESS=FalseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionsCENTRALPROGRESSBARCURRENTVALUE>0.0CENTRALGREENTEAM==TrueCENTRALREDCOUNTERTEAM==FalseThenVariable-SetCENTRALGREENPROCESS=TrueCENTRALGREENPROCESS()ElseVariable-SetCENTRALGREENPROCESS=FalseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionsCENTRALPROGRESSBARCURRENTVALUE==200.0ThenVariable-SetCENTRALOUTPOSTOWNER=13General-If(Conditions)thendo(Actions)elsedo(Actions)If(Ownerof(UNIT)ArtilleryOutpost[66.50,135.00]) != CENTRAL OUTPOST OWNER
Then
CENTRAL OUTPOST TAKEN()
Else
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
CENTRAL PROGRESS BAR CURRENT VALUE == 0.0
Then
Variable - Set CENTRAL OUTPOST OWNER = 14
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (UNIT) Artillery Outpost [66.50,135.00]) != CENTRAL OUTPOST OWNER
Then
CENTRAL OUTPOST TAKEN()
Else
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
CENTRAL PROGRESS BAR CURRENT VALUE == 100.0
Then
Variable - Set CENTRAL OUTPOST OWNER = 0
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (UNIT) Artillery Outpost [66.50,135.00]) != CENTRAL OUTPOST OWNER
Then
CENTRAL OUTPOST TAKEN()
Else
Else
------- Circle Color
General - If (Conditions) then do (Actions) else do (Actions)
If
CENTRAL RED COUNTER TEAM == False
CENTRAL GREEN COUNTER TEAM == False
Then
Actor - Send message "SetTintColor 255,255,255" to actor CENTRAL CAPTURE RANGE ACTOR
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
CENTRAL RED COUNTER TEAM == True
CENTRAL GREEN COUNTER TEAM == True
Then
Actor - Send message "SetTintColor 255,255,0" to actor CENTRAL CAPTURE RANGE ACTOR
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
CENTRAL RED COUNTER TEAM == True
CENTRAL GREEN COUNTER TEAM == False
Then
Actor - Send message "SetTintColor 255,0,0" to actor CENTRAL CAPTURE RANGE ACTOR
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
CENTRAL RED COUNTER TEAM == False
CENTRAL GREEN COUNTER TEAM == True
Then
Actor - Send message "SetTintColor 0,255,0" to actor CENTRAL CAPTURE RANGE ACTOR
Else
plus i recreated few triggers with data editor, like autocast for unit training abilities, instead of order buildings to train via triggrers.
but still game runs kinda slower than i want to when i play on BNET, when i run test map its not that bad, but when 6 players running the game, game feels different.
Ok i tested my map on bnet and i found out that is kinda laggy, so im trying to make it lagless, i started with periodic event triggers, but im kinda stuck, i dont understand how to do it without periodic event. maybe someone can help me?
so ... to start with ... can you explain in plain english what the code is supposed to do? I sort of get it from looking at the code ... but want to make sure i understand.
First obvious question ... why every 0.06 of a second? ( instead of like every second, or every 4 seconds? ) ( given you are basically just updating a progress bar ... ).
If I'm gessing right you could do this with behaviors and regions region would replace the time weather the region is the entire map or a lot of different ones make an invisible behavior on the unt or structure and if unit or structure have behavior validate with trigger then true actions then apply what you are trying to apply or make another trigger with spawning a unit when the event that you're timer has and then kill the unit makeing this trigger run and the unit can have no model. But it seems to fix this you need another event of something.
Theres a Region, Trigger checks if units of team A its in region, checks if units of team B its in region, if theres only units of team A it adds points to progress bar, same with team B, but if theres units of both teams nothing happens. And i use 0.06 period becuz i want process to start immediately as unit gets in region and not like in second after it happened. Progress Bar has 200 maximum value "0 - team A, 100 - neutral, 200 - team B" so with 0.06 period it takes like 10 seconds to get from 0 to 200.
btw if i make this periodic triggers are disabled from begining and enable them when units enters region? and then disable when units leave, it could make my map lag less?
i have the feeling that a while loop performs way better than a periodic event (never made an attempt to prove it thou). i would use an "enters region" event to maintain the unitgroups rather than checking all units in region which is more costly (i suppose, i wonder how that event is implemented).
iv never done enything with loops :/
instead of a trigger you create an action with "create thread" flag. then you do a "while" with your exit condition (turn former trigger off) and call this action whenever you would have turned the former trigger on.
OK, so the first thing i would do is to remove ALL of the "Unit Group" processing from the 0.06 second trigger. Ie: remove the need to scan all the units to reset the unit related values.
Do this by creating a different trigger which uses events "Unit Enters Region" and "Unit Leaves Region" to update the unit groups. then only process the triggering unit into (or out of) the relevant unit group.
In the timer trigger then you just assume the unit groups are correct (dont re-process them) and do process the rest of your Logic (the If statements). You now have MOST of the logic occuring only on region enter/exit trigger, and far less processing occurring every 0.06 seconds trigger.
yea Funky helped me yesterday and i created new trigger, but still its not working right yet. becuz when alot of unit enters region its like runs update value trigger as many times as units entered region.
1.
2.
3.
Global Variables
plus i recreated few triggers with data editor, like autocast for unit training abilities, instead of order buildings to train via triggrers.
but still game runs kinda slower than i want to when i play on BNET, when i run test map its not that bad, but when 6 players running the game, game feels different.
ok i fixed attack order trigger that Funky told me and i played it again, it was working just fine.