Need a Trigger

T

Theteammax

Guest
Hello. I need help to find a Trigger.

My problem: Wen i Host my "Map" it always begin to lag becouse of too many Units.

I need something like this: Team 1 Max limit of summoned Units is 300. Same for Team 2 (If it is over "300 Units" they will be killed) (Or there will appear a message: "Your Team have summoned the Max limit of 300 Units") Or something like that.
 

BornANoob[MR]

Member
Reaction score
21
Something like

A Unit begins casting an ability
Ability equal to summon
Pick every units of unit type Summoned and do actions
If
Number of picked units greater than 300
Then
Kill last created unit
Game - display text blah blah
Else do nothing
 

Exide

I am amazingly focused right now!
Reaction score
448
This is a simple version of how you could do it..

Code:
Untitled Trigger 001
    Events
        Time - Every 2.00 seconds of game time
    Conditions
        (Number of units in (Units in (Playable map area))) Greater than or equal to 300
    Actions
        Set TempGroup = (Random (Random integer number between 4 and 12) units from (Units in (Playable map area)))
        Unit Group - Pick every unit in TempGroup and do (Unit - Remove (Picked unit) from the game)
        Game - Display to (All players) for 5.00 seconds the text: There arre too many...
        Custom script:   call DestroyGroup(udg_TempGroup)

TempGroup is a unit group variable.

This trigger should check every 2 seconds, if there are 300 or more units in the map, then take 4,5,6,7,8,9,10,11 or 12 random units from the map, and remove them from the game.
-This trigger removes units from random players, computer units can be removed as well.

Why have so many units anyway? Why not use food to limit number of units?
 

BornANoob[MR]

Member
Reaction score
21
I think he wants you to be able to have say, 50 footman aswell as 300 summoned units, not sure though, so your trigger and changing the food count may not work.
 

Exide

I am amazingly focused right now!
Reaction score
448
Who summons over 300 units? :confused:

I thought he had a map similar to Footman, that spawns units periodically..

Either way, this is probably a better trigger than the one I showed you before (but if BornANoob[MR] is correct, neither trigger matters, I guess. :p);

Code:
Untitled Trigger 001
    Events
        Time - Every 2.00 seconds of game time
    Conditions
        (Number of units in (Units in (Playable map area))) Greater than or equal to 300
    Actions
        If ((Number of units in (Units in (Playable map area) owned by Player 1 (Red))) Greater than or equal to 300) then do (Set TempGroup = (Random (Random integer number between 4 and 12) units from (Units owned by Player 1 (Red)))) else do (Do nothing)
        If ((Number of units in (Units in (Playable map area) owned by Player 2 (Blue))) Greater than or equal to 300) then do (Set TempGroup = (Random (Random integer number between 4 and 12) units from (Units owned by Player 2 (Blue)))) else do (Do nothing)
        If ((Number of units in (Units in (Playable map area) owned by Player 3 (Teal))) Greater than or equal to 300) then do (Set TempGroup = (Random (Random integer number between 4 and 12) units from (Units owned by Player 3 (Teal)))) else do (Do nothing)
        If ((Number of units in (Units in (Playable map area) owned by Player 4 (Purple))) Greater than or equal to 300) then do (Set TempGroup = (Random (Random integer number between 4 and 12) units from (Units owned by Player 4 (Purple)))) else do (Do nothing)
        Unit Group - Pick every unit in TempGroup and do (Unit - Remove (Picked unit) from the game)
        Game - Display to (All players) for 5.00 seconds the text: There arre too many...
        Custom script:   call DestroyGroup(udg_TempGroup)
 
T

Theteammax

Guest
Hmm is it possible to copy and paste it into the editor? So i don't need to enter it one by one?
 

Exide

I am amazingly focused right now!
Reaction score
448
Nope, sorry.
Can be done if it's JASS. Want me to convert? :p
 

Exide

I am amazingly focused right now!
Reaction score
448
I suggest you stick to the GUI one, and look at what I did and try to copy it. (You can't copy and paste).

In JASS:
You can copy and paste this directly into your trigger. First you must make a new trigger and click 'Edit -> Convert to Custom Text -> Ok', and then delete everything that's in there, then copy the following into it:

JASS:

function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
    return ( ( CountUnitsInGroup(GetUnitsInRectAll(GetPlayableMapRect())) >= 300 ) )
endfunction

function Trig_Untitled_Trigger_001_Func006002 takes nothing returns nothing
    call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    if ( ( CountUnitsInGroup(GetUnitsInRectOfPlayer(GetPlayableMapRect(), Player(0))) >= 300 ) ) then
        set udg_TempGroup = GetRandomSubGroup(GetRandomInt(4, 12), GetUnitsOfPlayerAll(Player(0)))
    endif
    if ( ( CountUnitsInGroup(GetUnitsInRectOfPlayer(GetPlayableMapRect(), Player(1))) >= 300 ) ) then
        set udg_TempGroup = GetRandomSubGroup(GetRandomInt(4, 12), GetUnitsOfPlayerAll(Player(1)))
    endif
    if ( ( CountUnitsInGroup(GetUnitsInRectOfPlayer(GetPlayableMapRect(), Player(2))) >= 300 ) ) then
        set udg_TempGroup = GetRandomSubGroup(GetRandomInt(4, 12), GetUnitsOfPlayerAll(Player(2)))
    endif
    if ( ( CountUnitsInGroup(GetUnitsInRectOfPlayer(GetPlayableMapRect(), Player(3))) >= 300 ) ) then
        set udg_TempGroup = GetRandomSubGroup(GetRandomInt(4, 12), GetUnitsOfPlayerAll(Player(3)))
    endif
    call ForGroup( udg_TempGroup, function Trig_Untitled_Trigger_001_Func006002 )
    call DisplayTimedTextToForce( GetPlayersAll(), 5.00, "TRIGSTR_181" )
    call DestroyGroup(udg_TempGroup)
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Untitled_Trigger_001, 2 )
    call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction


This only works for player 1 to 4, If you want more players you need to add them yourself.
Again, I suggest you use the GUI trigger.

EDIT: Oh, and I haven't tested the triggers myself, so they might not work. :p
 
T

Theteammax

Guest
Hmm. Okay :p i'll try.
Can you tell me where i find the
"then do (Set TempGroup = (Random (Random integer number between 4 and 12) units from (Units owned by Player 1(Red)"
 
T

Theteammax

Guest
Exide can you make it for me? :S I don't know how. Doesnt say anything to me.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top