• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Why can't i remove the units?

Status
Not open for further replies.
[14 lines of GUI] Why can't i remove the units?

  • Remove Units
    • Events
      • Map initialization
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Mage) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Picked unit)) slot status) Equal to Is playing
            • Then - Actions
            • Else - Actions
              • Unit - Remove (Picked unit) from the game
Why the hell does this not work?
 
Last edited:
Level 37
Joined
Jul 22, 2015
Messages
3,485
Why do you have two events o.o

On a note, you should never use Units of type for Unit Group functions. These will always leak, even if you try to use set bj_wantDestroyGroup = true.

Why it doesn't work confuses me, it seems as though everything looks okay. Can you add a debug message and see if it pops up?

If I may make a suggestion though: instead of preplacing the units and removing them if the unit is not playing, why not just check if the player is playing, and create the unit? It's always better to create the units instead of preplacing them :3
 
Why do you have two events o.o

On a note, you should never use Units of type for Unit Group functions. These will always leak, even if you try to use set bj_wantDestroyGroup = true.

Why it doesn't work confuses me, it seems as though everything looks okay. Can you add a debug message and see if it pops up?

If I may make a suggestion though: instead of preplacing the units and removing them if the unit is not playing, why not just check if the player is playing, and create the unit? It's always better to create the units instead of preplacing them :3

1. Didn't know they would still leak :/
2. i'll try
3. cause i'm lazy xD

*Edit*
- Ok i have tried adding in text and it seems it can't make the "else" actions :/...
- - i'll just make them is a player is present then :)

Thanks KILLCIDE
 
Level 25
Joined
May 11, 2007
Messages
4,651
Does the trigger happen at all? Add a text into it?

Are you trying to check if the person playing is an user or just playing? Because computers are considered to be "playing" too if they are not defeated.

You can check if a player is an USER with the boolean condition instead.
 
That is an ugly trigger. I would scrap it and think about what you are doing.

Why do you have a Mage unit at map init anyway? If you don't want it there? Just remove it in WE. If you really have to have it then just remove them once at 0.00 time elapsed. How could you remove them twice? Are you creating more? Stop that.

Why not pick all players? If/Then out the non-playing players and remove all units of type Mage. Destroy group and done. Isn't that cleaner?
 
It is fixed.

no the mages does not have locust.

i did try it the other way around with picking all players and then test for playing and removing if not.

i put in 3 text messeges, 1 at the beginning (testing event), one in the then action and one in the else action, The text from the beginning and the "Then" action was recived but the last one was not.

I solved the problem by having all player be checked for playing status and then spawn a mage if they were, and i removed the placed one in WE.

all players (1-12) is givin a mage if present in the game.

i tried the first one since i like code to be as short as possible, and since it didn't work i created another solution based on what KILLCIDE said.
 
Status
Not open for further replies.
Top