delete problems

For fulfilled maps that most likely don't work on the latest patch (1.24 or later).

Moderator: Cheaters

erik123
Newcomer
Posts: 2
Joined: June 11th, 2009, 3:34 pm

delete problems

Post by erik123 »

Events
Unit - A unit enters wisps <gen>


Conditions


Actions
If ((Number of living Wisp units owned by Player 1 (Red)) Greater than 6) then do (Unit Group - Remove (Random unit from (Units of type Wisp)) from (Units owned by Player 1 (Red))) else do (Do nothing)
If ((Number of living Wisp units owned by Player 2 (Blue)) Greater than 6) then do (Unit Group - Remove (Random unit from (Units of type Wisp)) from (Units owned by Player 2 (Blue))) else do (Do nothing)
If ((Number of living Wisp units owned by Player 3 (Teal)) Greater than 6) then do (Unit Group - Remove (Random unit from (Units of type Wisp)) from (Units owned by Player 3 (Teal))) else do (Do nothing)
If ((Number of living Wisp units owned by Player 4 (Purple)) Greater than 6) then do (Unit Group - Remove (Random unit from (Units of type Wisp)) from (Units owned by Player 4 (Purple))) else do (Do nothing)
If ((Number of living Wisp units owned by Player 5 (Yellow)) Greater than 6) then do (Unit Group - Remove (Random unit from (Units of type Wisp)) from (Units owned by Player 5 (Yellow))) else do (Do nothing)
If ((Number of living Wisp units owned by Player 6 (Orange)) Greater than 6) then do (Unit Group - Remove (Random unit from (Units of type Wisp)) from (Units owned by Player 6 (Orange))) else do (Do nothing)
If ((Number of living Wisp units owned by Player 7 (Green)) Greater than 6) then do (Unit Group - Remove (Random unit from (Units of type Wisp)) from (Units owned by Player 7 (Green))) else do (Do nothing)
If ((Number of living Wisp units owned by Player 8 (Pink)) Greater than 6) then do (Unit Group - Remove (Random unit from (Units of type Wisp)) from (Units owned by Player 8 (Pink))) else do (Do nothing)
If ((Number of living Wisp units owned by Player 9 (Gray)) Greater than 6) then do (Unit Group - Remove (Random unit from (Units of type Wisp)) from (Units owned by Player 9 (Gray))) else do (Do nothing)
If ((Number of living Wisp units owned by Player 10 (Light Blue)) Greater than 6) then do (Unit Group - Remove (Random unit from (Units of type Wisp)) from (Units owned by Player 10 (Light Blue))) else do (Do nothing)
If ((Number of living Wisp units owned by Player 11 (Dark Green)) Greater than 6) then do (Unit Group - Remove (Random unit from (Units of type Wisp)) from (Units owned by Player 11 (Dark Green))) else do (Do nothing)

I hope you understood what i wanted whit the code.. Im new to this GUI triggering so I don't realy understand whats wrong, to me it seems pretty okay...

The problem is when a unit enters the wisp gen nothing seems to be happening since it does not remove wisps, when the wisp population goes abowe 6.

//Erik
Black-Hole
Forum Fanatic
Posts: 315
Joined: October 16th, 2007, 7:32 pm

Re: delete problems

Post by Black-Hole »

I think you have to add the wisps to a Unit Group

So Event (Your Event)

Action Select every unit owned by (player 1) of type (wisp) and add picked unit to (Wisp[1])
If Than Do Action Else Do action
Condition:If units in wisp[1] equal to or greater than 6
Action:Remove randomly Selected unit from (Wisp[1])

Its not perfect but you can figure it out :) it should work.

You can also do a loop but i dont have WC3 Editor on this computer to try it :(

Try experimenting with a Loop Trigger

you can make this entire trigger with those 3 things i said and a loop if you do it right.
User avatar
Syre
Forum Staff
Posts: 506
Joined: November 17th, 2008, 3:49 pm

Re: delete problems

Post by Syre »

Mmm..something like this?..Lol sorry, first time with looping so not sure if it could be more compact..

Code: Select all

Untitled Trigger 001
    Events
        (Your Event)
    Conditions
    Actions
        Set Players[1] = Player 1 (Red)
        Set Players[2] = Player 2 (Blue)
        Set Players[3] = Player 3 (Teal)
        Set Players[4] = Player 4 (Purple)
        Set Players[5] = Player 5 (Yellow)
        For each (Integer A) from 1 to 11, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Number of living Wisp units owned by Players[(Integer A)]) Greater than 6
                    Then - Actions
                        Unit - Remove (Random unit from (Units owned by Players[(Integer A)] of type Wisp)) from the game
                    Else - Actions
                        Do nothing
erik123 wrote:I hope you understood what i wanted whit the code.. Im new to this GUI triggering so I don't realy understand whats wrong, to me it seems pretty okay...
Alright since i dont know how far along you are, ill run ya through this step-by-step.

First in the trigger editor, press Ctrl+B, to open the Variable section. Next make a variable, name it whatever you want, in my case i used "Players". Then, for the type scroll down and select "Player". Next check the box next to "Array", and make the size 11.

Next, create a new action "Set Variable" its the 8th from the top under "Do Nothing". Next, select the "Players" variable. Then for "[Index]" select 1, of course for player 1. Then for the value, go to the top and click "Preset", "Player 1 (Red)". After thats done, just copy and paste that for every player, i just did that till yellow, you should do it for however many players ya have.

After, create a new trigger, "For Each Integer A, Do Multiple Actions", again its not that far from the top of the list. Then create an "If/Than/Else Multiple Functions". Wont explain that since ya already know it.

The rest is pretty much as youve made, "Integer Comparison", instead of Player 1 (Red), select the variable Players, for the index pick "For Loop Integer A"

Alright, the remove should be self-explanatory..lol it took more type typing this out than making the actual trigger ;x..truth be told i dident actually test this..however i dont see why it wouldent work. The reason yours dont work, is simply because your removeing from the unit group only, not the game..if you dont want to go through all the trouble, just use this instead

Code: Select all

If ((Number of living Wisp units owned by Player 1 (Red)) Greater than 6) then do (Unit - Remove (Random unit from (Units owned by Player 1 (Red) of type Wisp)) from the game) else do (Do nothing)
Its just that my way and black-holes are more leakless.

Edit : I just tested both my ways and they work, meaning that your only problem was as ive said, just the removing part. Meaning that Black-Hole's will work as well. ;D
Image
erik123
Newcomer
Posts: 2
Joined: June 11th, 2009, 3:34 pm

Re: delete problems

Post by erik123 »

Wow thats like a tutorial :shock: Thanks alot both of you! It's now working!!
mon111
Newcomer
Posts: 6
Joined: April 19th, 2009, 10:54 am

Re: delete problems

Post by mon111 »

I know this is a bit late but I just saw your problem and I want to tell you that the use of Triggering Player is alot more efficient since u don't have to do things like:

If ((Number of living Wisp units owned by Player 1 (Red)) Greater than 6) then do (Unit Group - Remove (Random unit from (Units of type Wisp)) from (Units owned by Player 1 (Red))) else do (Do nothing)

1 time for each player, this will save u alot of time when making "all player-triggers" and here's my solution:

Remove Wisps
Events
Unit - A unit enters Wisp <gen>
Conditions
(Number of living Wisp units owned by (Triggering player)) Greater than or equal to 6
Actions
Unit - Remove (Triggering unit) from the game


As you see I don't need to use any player group + there's no use for a Variable in this matter. :) hope this helps you with this and future triggers.
[+ I don't need to explain the trigger more exactly seems it's quite easy to understand] ;-)
(IF you want to contact me about this post (or any other trigger problem) this forum isn't my place xD mail: [email protected])

I haven't tested the trigger yet, I just made it in 1 minute in WE but I'm 99.9% sure it works :lol: )
User avatar
Syre
Forum Staff
Posts: 506
Joined: November 17th, 2008, 3:49 pm

Re: delete problems

Post by Syre »

True, that work work normally, but who says that the entering unit is a wisp? If you use that, any unit that enters will be removed if theres more than 6 wisps (Would really suck to exchange a level 10 hero just to learn that you cant get another wisp). The ones made above work with any unit that enter the region, no mater what type.

Edit : Took another look and compared with the second trigger ive made. If anyone else cares, your condition would work better than the one i have, since the one i showed there is player specific.
Last edited by Syre on July 23rd, 2009, 12:27 pm, edited 1 time in total.
Image
mon111
Newcomer
Posts: 6
Joined: April 19th, 2009, 10:54 am

Re: delete problems

Post by mon111 »

Syre wrote:True, that work work normally, but who says that the entering unit is a wisp? If you use that, any unit that enters will be removed if theres more than 6 wisps (Would really suck to exchange a level 10 hero just to learn that you cant get another wisp). The ones made above work with any unit that enter the region, no mater what type.
I thought this trigger was for a wisp only location in map, like a secluded area of goldmine + wisps.. but sure if that's what you want then this is leak-less I hope?

wisp
Events
Unit - A unit enters Wisp <gen>
Conditions
(Unit-type of (Triggering unit)) Equal to Wisp
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of living Wisp units owned by (Triggering player)) Greater than or equal to 6
Then - Actions
Unit - Remove (Triggering unit) from the game
Else - Actions
Do Nothing
User avatar
Syre
Forum Staff
Posts: 506
Joined: November 17th, 2008, 3:49 pm

Re: delete problems

Post by Syre »

Again, thats true. It wouldent remove any unit that enters, but still doesnt fix the problem that if the unit isiant a wisp. Lets say that you want a hero to enter the region, instead of a wisp. What your trigger does is removes the entering unit, if you change the condition to a hero entering, than you'd lose your hero, if you keep the wisp one, it will only work with wisps. What we've done, is made it so that if a unit enters, it removes a random unit of type wisp from the players control. Meaning you could have any type of unit enter the region, and it would still remove a wisp, if theres 6.
Image
mon111
Newcomer
Posts: 6
Joined: April 19th, 2009, 10:54 am

Re: delete problems

Post by mon111 »

wisp
Events
Unit - A unit enters Wisp <gen>
Conditions
(Unit-type of (Triggering unit)) Equal to Wisp
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of living Wisp units owned by (Triggering player)) Greater than or equal to 6
Then - Actions
Unit - Remove (Triggering unit) from the game
Else - Actions
Do Nothing

syre wrote:What we've done, is made it so that if a unit enters, it removes a random unit of type wisp from the players control. Meaning you could have any type of unit enter the region, and it would still remove a wisp, if theres 6.
No..? What this trigger does is that if a wisp (and yes, only a wisp) enters the region it will be deleted if the owner of the wisp already have 6 or more wisps. If a hero etc enters Nothing happens. Why? -Because of if the entering unit is not equal to a Wisp - The trigger doesn't run = nothing happens (and ofcourse nothing gets deleted).

(I'll try this trigger now just for sure to see if you're really right about this. Cause I can't see anything wrong with it)
User avatar
Syre
Forum Staff
Posts: 506
Joined: November 17th, 2008, 3:49 pm

Re: delete problems

Post by Syre »

I know that. But again, he never said that the entering type would be a wisp. If you make it so its a different unit that enters, it would remove that unit. Yours would only work with wisps entering (Not meaning the condition, i mean the entire point of it). We have it so that if any type of unit enters the region. It will remove a wisp owned by the player if there are more than 6 already owned.

Alright, let me rephrase. Lets say he wants a unit, that isiant a wisp, to enter the region, and still remove a wisp, if theres more than 6. What we want, is to make it so that any unit type can enter the region, and it will still remove a wisp from the owner if theres more than the amount. What you have, would remove whatever type of unit that enters the region.
Last edited by Syre on July 23rd, 2009, 1:11 pm, edited 1 time in total.
Image