How "create thread" is relevant here, if the sizes are dependant on the script line amount? refacturing and optimizing the code is the only way to beat the script size. Correct me if I'm mistacken.
Add each used random to an array, then every time you get a new random, check if it's in that array, and if it is, then re-roll the random.
Pseudo code:
...
Repeat
..isUnique = true;
..Random Picker = (Random integer between 0 and 23);
..For i from 0 to 4 Do
....If (Random Picker == usedRands[i]) Then isUnique = false;
Until(isUnique);
Unit - Create ...
It's the simplified version. You could use functions to get rid of For loop inside the repeat.
Update: GOD DAMN IT, I hate this markup, it has removed all my spaces, had to write them with dots.
Gladiator1v1InitiatorOptions:ActionReturnType:(None)ParametersBattle=0<Integer>GrammarText:Gladiator1v1Initiator(Battle)HintText:(None)CustomScriptCodeLocalVariablesa=0<Integer>b=0<Integer>InitiationTimer=(Newtimer)<Timer>InitiationTimerWindow=NoTimerWindow<TimerWindow>Player=0<Integer[2]>Chooser=NoUnit<Unit[2]>MapActivate=0<Integer>i=0<Integer>ActionsVariable-SetPlayer[1]=(Player1fromBattlePlayerGroup[Battle])Variable-SetPlayer[2]=(Player2fromBattlePlayerGroup[Battle])-------BGOccupiedCheckandRerollVariable-SetMapActivate=(Randomintegerbetween1and4)General-While(Conditions)aretrue,do(Actions)ConditionsBGOccupied?[MapActivate]==TrueActionsVariable-SetMapActivate=(Randomintegerbetween1and4)Variable-SetBattlefield[Battle]=combatRegion[MapActivate]Variable-SetBattle'sBG[Battle]=MapActivateVariable-SetBGOccupied?[MapActivate]=TrueVariable-SetVictoryOn[Battle]=TruePlayerGroup-ForeachplayerbinBattlePlayerGroup[Battle]do(Actions)ActionsPlayer-ModifyplayerbMinerals:SetTo3Variable-SetGladiatorsAlive[b]=3UnitGroup-Pickeachunitin(Beacon(ProtossLarge)unitsinBattlefield[Battle]ownedbyplayer0matchingExcluded:Missile,Dead,Hidden,withatmostAnyAmount)anddo(Actions)ActionsUnit-Turn(Pickedunit)TargetablestateOffCamera-SetthecameraboundsforBattlePlayerGroup[Battle]toBattlefield[Battle](Doadjusttheminimap)Dialog-HideObserverDialogforBattlePlayerGroup[Battle]UI-ShowCommandPanelforBattlePlayerGroup[Battle]UI-ShowMinimapPanelforBattlePlayerGroup[Battle]UI-ShowControlGroupPanelforBattlePlayerGroup[Battle]UI-ShowInfoPanelforBattlePlayerGroup[Battle]-------ChooserUI-Display"Choose 3 warriors to do battle."forBattlePlayerGroup[Battle]toSubtitleareaUnit-Create1GladiatorSelectorforplayerPlayer[1]atBGPylonLeft[MapActivate]facing270.0degrees(NoOptions)Variable-SetChooser[Player[1]]=(Lastcreatedunit)UnitSelection-Select(Lastcreatedunit)forplayerPlayer[1]Camera-PanthecameraforplayerPlayer[1]to(Positionof(Lastcreatedunit))over0.5secondswithExistingVelocity%initialvelocity,10%deceleration,andDoNotusesmartpanningUnit-Create1GladiatorSelectorforplayerPlayer[2]atBGPylonRight[MapActivate]facing270.0degrees(NoOptions)Variable-SetChooser[Player[2]]=(Lastcreatedunit)UnitSelection-Select(Lastcreatedunit)forplayerPlayer[2]Camera-PanthecameraforplayerPlayer[2]to(Positionof(Lastcreatedunit))over0.5secondswithExistingVelocity%initialvelocity,10%deceleration,andDoNotusesmartpanning-------TimerTimer-StartInitiationTimerasaOneShottimerthatwillexpirein25.0GameTimesecondsTimer-Createatimerwindowfor(Laststartedtimer),withthetitle"Initiation Timer",usingRemainingtime(initiallyHidden)Variable-SetInitiationTimerWindow=(Lastcreatedtimerwindow)Timer-MoveInitiationTimerWindowto(970,322)Timer-ShowInitiationTimerWindowforBattlePlayerGroup[Battle]General-WaitforInitiationTimertohave0.0secondsRemainingPlayerGroup-ForeachplayerbinBattlePlayerGroup[Battle]do(Actions)ActionsVariable-SetGladiatoractive?[b]=TruePlayerGroup-AddplayerbtoGladiatorMineralGroupDialog-CreateaModaldialogofsize(200,200)at(0,0)relativetoCenterofscreenVariable-SetEnemyTargetDialogTest[b]=(Lastcreateddialog)Dialog-ShowEnemyTargetDialogTest[b]for(Playergroup(b))Dialog-HidethebackgroundimageofEnemyTargetDialogTest[b]Dialog-CreateanimagefordialogEnemyTargetDialogTest[b]withthedimensions(111,111)anchoredtoTopLeftwithanoffsetof(11,11)settingthetooltipto""usingtheimageAssets\Textures\cursor-target-invalid.ddsasaNormaltypewithtiledsettoFalsetintcolorRedandblendmodeLightenDialog-Set(Lastcreateddialogitem)sizetoparentlayoutTruefor(Allplayers)Dialog-ShowControlGroupSwitchDialogforBattlePlayerGroup[Battle]Dialog-ShowForfeitDialogforBattlePlayerGroup[Battle]Dialog-SetMineralBaritemcurrentvalueto0.0forBattlePlayerGroup[Battle]Dialog-ShowMineralBarforBattlePlayerGroup[Battle]Timer-DestroyInitiationTimerWindowDialog-EnableObserverDialogGameButton[Battle]for(Allplayers)UnitGroup-Pickeachunitin(GladiatorSelectorunitsinBattlefield[Battle]ownedbyplayerAnyPlayermatchingExcluded:Missile,Dead,Hidden,withatmostAnyAmount)anddo(Actions)ActionsUnit-Kill(Pickedunit)
You should compare angles between points. For example, angle between destination1 and your unit is 90 deg (in case the unit is going up), and you want it to go to the right (180 deg). you pick up an angle between destination2 and your unit (which will be 180 deg), calculate the difference between angles, like:
angle(dest2,unit)-angle(dest1,unit)=rotation angle You'll get an angle, on which you need to rotate your unit.
Oh dude... The're so many triggers... You could have used Any player, instead of 1, 2, 3, 4, 5.... and then, put Triggering player everywhere...
Also, some of your conditions are strange, for example:
Not(Unit Type of (Triggering Unit) is Worker == True) is the same as Unit Type of (Triggering Unit) is Worker == False
you need a lot of cleaning. I've run it with debugger, it had a trigger (Anti-Idle) which had a lot of executions. Try disabling it, may help (can't say for sure, because my max fps on empty map is 200, here it was 100).
Advise - combine your triggers, start using loops (such as, pick every player, for each, etc.). That way you can cut down the number of triggers, and it'll be easier to find the source of the problem. Also, if you have one event for 100 triggers, make it 1 trigger, separate everything with comments.
Edit: No, no, no, something wrong was written here :D
Since i is a local var, it's always equals to 1. When the event fires, 1 is assigned to every member of i. So, even if you inc the i[picked int], next time a unit dies, i[picked int]=1.
Make i global :)
0
All includes comp players, while active is user only.
0
How "create thread" is relevant here, if the sizes are dependant on the script line amount? refacturing and optimizing the code is the only way to beat the script size. Correct me if I'm mistacken.
0
Add each used random to an array, then every time you get a new random, check if it's in that array, and if it is, then re-roll the random.
Pseudo code:
...
Repeat
..isUnique = true;
..Random Picker = (Random integer between 0 and 23);
..For i from 0 to 4 Do
....If (Random Picker == usedRands[i]) Then isUnique = false;
Until(isUnique);
Unit - Create ...
It's the simplified version. You could use functions to get rid of For loop inside the repeat.
Update: GOD DAMN IT, I hate this markup, it has removed all my spaces, had to write them with dots.
0
0
0 deg - left 90 - up 180 - right 270 - down
You should compare angles between points. For example, angle between destination1 and your unit is 90 deg (in case the unit is going up), and you want it to go to the right (180 deg). you pick up an angle between destination2 and your unit (which will be 180 deg), calculate the difference between angles, like: angle(dest2,unit)-angle(dest1,unit)=rotation angle You'll get an angle, on which you need to rotate your unit.
0
Okay, let me do this in a second :D
Should work :) If atleast 1 AND returns TRUE, then it will execute everything written in THEN, if everything is FALSE, it will execute the else part.
0
Because the And, Or are working in another way. Everything you specify under them is used with this logical comparison.
For example:
Will return true, only if Dice3 < Dice1 AND Dice1 == Dice2. The same for Or. Restructorize your conditions, then it'll work :)
0
It's either replace, or remove unit x->create new unit y-> set x = last created unit.
0
Oh dude... The're so many triggers... You could have used Any player, instead of 1, 2, 3, 4, 5.... and then, put Triggering player everywhere...
Also, some of your conditions are strange, for example:
Not(Unit Type of (Triggering Unit) is Worker == True) is the same as Unit Type of (Triggering Unit) is Worker == False
you need a lot of cleaning. I've run it with debugger, it had a trigger (Anti-Idle) which had a lot of executions. Try disabling it, may help (can't say for sure, because my max fps on empty map is 200, here it was 100).
Advise - combine your triggers, start using loops (such as, pick every player, for each, etc.). That way you can cut down the number of triggers, and it'll be easier to find the source of the problem. Also, if you have one event for 100 triggers, make it 1 trigger, separate everything with comments.
0
What's the event for main trigger?
0
I liekd it. Felt like it had something in the video. Waiting for the actual map, always liked survivals/adventures! :D
0
Send it over, I'll look on it tomorrow, if nobody volunteers ;)
0
Yes. You can check it by debugging the i to the debug window :)
As was said, you should declare i as a global var. ;)
Also, to get rid of the loop, as an index of an array you can use Owner of (killing unit), or even Killing player. Just to get rid of the 7 checks.
0
Edit: No, no, no, something wrong was written here :D
Since i is a local var, it's always equals to 1. When the event fires, 1 is assigned to every member of i. So, even if you inc the i[picked int], next time a unit dies, i[picked int]=1.
Make i global :)
0
Value of units killed seems to not work. Was something similar about the value of units killed here on trigger forums.