1 question:
I have a trigger, trigger make starcraft freeze when triggering units are dead(number of them = 0), and var Goverment Form[PxUSER] != 0
I even know exactly what part makes this, I just cant understand why its no responding:
Player4reducingcorruptionmechanicEventsUnit-AnyUnitdiesUnit-AnyUnitconstructionprogressisCompletedDialog-AnyDialogItemisusedbyPlayer{AnyPlayer}witheventtypeClickedLocalVariablesConditionsGovermentForm[P4USER]!=0ActionsGeneral-While(Conditions)aretrue,do(Actions)Conditions(Numberofactiveinstancesof(Currenttrigger))<=1(NumberofLivingunitsin(Palace(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmostAnyAmount))>0AndConditions(NumberofLivingunitsin(Courthouse(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmostAnyAmount))==0ActionsGeneral-Wait{30.0}GameTimesecondsUI-Display{"Our Palaces has helped to reduce Co..."<sval="Swarm_Achievement_Tooltip_Title"><cval="00FF00">(-(Text((CountofPalace(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmost3))))</c></s>}for(Playergroup(P4USER))toSubtitleareaVariable-ModifyGovernment_Corruption_Level[P4USER]:-(CountofPalace(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmost3)General-If(Conditions)thendo(Actions)elsedo(Actions)IfGovernment_Corruption_Level[P4USER]<0ThenVariable-SetGovernment_Corruption_Level[P4USER]=0ElseGeneral-Waitfor(Conditions),checkingevery3.0GameTimesecondsConditionsGovernment_Corruption_Level[P4USER]>0General-While(Conditions)aretrue,do(Actions)Conditions(Numberofactiveinstancesof(Currenttrigger))<=1(NumberofLivingunitsin(Palace(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmostAnyAmount))==0AndConditions(NumberofLivingunitsin(Courthouse(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmostAnyAmount))>0ActionsGeneral-Wait{30.0}GameTimesecondsUI-Display{"Our Courthoses has helped to reduce..."<sval="Swarm_Achievement_Tooltip_Title"><cval="00FF00">(-(Text((CountofCourthouse(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmost3))))</c></s>}for(Playergroup(P4USER))toSubtitleareaVariable-ModifyGovernment_Corruption_Level[P4USER]:-(CountofCourthouse(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmost3)General-If(Conditions)thendo(Actions)elsedo(Actions)IfGovernment_Corruption_Level[P4USER]<0ThenVariable-SetGovernment_Corruption_Level[P4USER]=0ElseGeneral-Waitfor(Conditions),checkingevery3.0GameTimesecondsConditionsGovernment_Corruption_Level[P4USER]>0General-While(Conditions)aretrue,do(Actions)Conditions(Numberofactiveinstancesof(Currenttrigger))<=1(NumberofLivingunitsin(Palace(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmostAnyAmount))>0AndConditions(NumberofLivingunitsin(Courthouse(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmostAnyAmount))>0ActionsGeneral-Wait{30.0}GameTimesecondsUI-Display{"Our Courthoses and Palaces has help..."<sval="Swarm_Achievement_Tooltip_Title"><cval="00FF00">(-(Text({(CountofPalace(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmost3)+(CountofCourthouse(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmost3)})))</c></s>}for(Playergroup(P4USER))toSubtitleareaVariable-ModifyGovernment_Corruption_Level[P4USER]:-{(CountofPalace(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmost3)+(CountofCourthouse(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmost3)}General-If(Conditions)thendo(Actions)elsedo(Actions)IfGovernment_Corruption_Level[P4USER]<0ThenVariable-SetGovernment_Corruption_Level[P4USER]=0ElseGeneral-Waitfor(Conditions),checkingevery3.0GameTimesecondsConditionsGovernment_Corruption_Level[P4USER]>0General-While(Conditions)aretrue,do(Actions)Conditions(NumberofLivingunitsin(Palace(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmostAnyAmount))==0AndConditions(NumberofLivingunitsin(Courthouse(Max3)unitsin(Entiremap)ownedbyplayerP4USERmatchingExcluded:Missile,UnderConstruction,Dead,Hidden,withatmostAnyAmount))==0ActionsTrigger-Stopallinstancesof(Currenttrigger)
Last block with if-then-else makes starcraft freeze, and not response absolutely, trigger still work enough without this, I only wonder why its happens
2 question:
Cause I bad with functions and dont speak eng(only write, so I dont use tutorial videos), I make triggers for each player. If I will use functions does it reduce overall lag? And cause I cant figure them out, If someone will can link me tutorial (not video I bad with speak eng)about making functions for p1p2p3... i will glad, or will add there example what are parametrs I need use and for what they are.
Yes custom definitions will generally reduce lag and speed things up provided they are setup correctly. Custom definitions come in both action definition and function definition form with the major difference being functions allow you to return information back through to the trigger or original defintion that it is used in (ie you can have many definition inside of one another). Functions are particularly useful in doing things like taking in a number and returning a unit type based on the number, which you can then use in mulitple triggers without have to copy your work. Parameter is what allow you to pass the information you need from the trigger into the definition. Also if your using them for things like on a per player bases you should not be using multiple definitions/triggers for each player; you should be using a integer loop to cycle through each player which is then used in the parameter of your definition. If you then check the "create thread" checkbox within the defintion it will then allow multiple thread to run simultaneous, so in the example every player would be done at the same time instead of one of a time.
in that case better triggering player or integer loop? if I set in conditions triggering player p1user then I can set in all actions for this condition p1user as triggering player? does it will correct work between players, I mean I no need trigger executing with many players instantly?
CustomAction-Options:action-Returntype:(none)Parameters:-Player=0<integer>Actions:ModifyPlayerPlayermineralssetto1000ModifyPlayerPlayervespenesetto2000Wait5gametimesecsDisplay"Willuwontu is really awesome"totheDirectiveareaforplayergroup(player)
That is the bare bones of a trigger and how to call custom functions and actions in it. One of these days i might create a demo map with example in it.
Essentially what you need to do is
create the function or action you want, with the parameters you need
then call the action or function and set that parameters to what you want.
P.S. I made a boo boo when making this, typically I set a variable to the parameter, then use the variable, in case i need to modify it throughout the action.
1 question: I have a trigger, trigger make starcraft freeze when triggering units are dead(number of them = 0), and var Goverment Form[PxUSER] != 0 I even know exactly what part makes this, I just cant understand why its no responding:
Last block with if-then-else makes starcraft freeze, and not response absolutely, trigger still work enough without this, I only wonder why its happens
2 question:
Cause I bad with functions and dont speak eng(only write, so I dont use tutorial videos), I make triggers for each player. If I will use functions does it reduce overall lag? And cause I cant figure them out, If someone will can link me tutorial (not video I bad with speak eng)about making functions for p1p2p3... i will glad, or will add there example what are parametrs I need use and for what they are.
Yes custom definitions will generally reduce lag and speed things up provided they are setup correctly. Custom definitions come in both action definition and function definition form with the major difference being functions allow you to return information back through to the trigger or original defintion that it is used in (ie you can have many definition inside of one another). Functions are particularly useful in doing things like taking in a number and returning a unit type based on the number, which you can then use in mulitple triggers without have to copy your work. Parameter is what allow you to pass the information you need from the trigger into the definition. Also if your using them for things like on a per player bases you should not be using multiple definitions/triggers for each player; you should be using a integer loop to cycle through each player which is then used in the parameter of your definition. If you then check the "create thread" checkbox within the defintion it will then allow multiple thread to run simultaneous, so in the example every player would be done at the same time instead of one of a time.
@hobbidude: Go
What about if I need different vars or numbers for each player? i.e. if trigger
in that case better triggering player or integer loop? if I set in conditions triggering player p1user then I can set in all actions for this condition p1user as triggering player? does it will correct work between players, I mean I no need trigger executing with many players instantly?
That is the bare bones of a trigger and how to call custom functions and actions in it. One of these days i might create a demo map with example in it.
Essentially what you need to do is
P.S. I made a boo boo when making this, typically I set a variable to the parameter, then use the variable, in case i need to modify it throughout the action.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)