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.
 
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
 
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?
 
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.
 
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)
 
Hmm is it possible to copy and paste it into the editor? So i don't need to enter it one by one?
 
Nope, sorry.
Can be done if it's JASS. Want me to convert? :p
 
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
 
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)"
 
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.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      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