removing units help

Epicurus

New Member
Reaction score
1
I need to get these units out of a region after a couple of other things are done but when I test it the units stay.

JASS:
Save01
    Events
        Unit - A unit enters secondary death 01 <gen>
    Conditions
        ((Owner of (Triggering unit)) controller) Equal to User
    Actions
        Hero - Add ((Integer((Real((Number of units in (Units in secondary death 01 <gen> owned by Player 10 (Light Blue))))))) x 10) experience to (Triggering unit), Hide level-up graphics
        Player - Add ((Integer((Real((Number of units in (Units in secondary death 01 <gen> owned by Player 10 (Light Blue))))))) x 10) to (Owner of (Triggering unit)) Current gold
        Unit Group - Remove all units of (Units of type Light Blue Flag) from (Units in secondary death 01 <gen>)
 

Tyrulan

Ultra Cool Member
Reaction score
37
It's the Unit Group call.

Pick all units in region matching matching unit is owned by player (10)(light blue) and remove unit

Something like that, too lazy to do it in GUI but if you need me to I will.

EDIT: Oh and use Entering Unit, not Triggering Unit. :p
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
@Tyrulan: Triggering Unit is the correct call here, Entering Unit and etc. are mostly buggy, but the exclusive few can not be used here.
 

Tyrulan

Ultra Cool Member
Reaction score
37
Alright, didn't know. Why would Blizzard commands be bugged?... My suggestion still follows, use a select units in region.
 

Epicurus

New Member
Reaction score
1
Thanks Tyrulan.

I would also like to know what is buggy about the entering command, I'm doing a kdo tag were all your gold comes from saving units so it would be a big problem if it has a bunch of problems.

Also, when the unit is removed, I wanted another units to be created somewhere on the map. I tried "unit leave region" but that didn't work. Any thoughts?

Thanks
 

Tyrulan

Ultra Cool Member
Reaction score
37
It would be easier to tell you why if you looked at the Jass code...

Entering Unit:
constant native GetEnteringUnit takes nothing returns unit

Triggering Unit:
constant native GetTriggerUnit takes nothing returns unit

There is no real difference in the command itself but the way the WE handles it was done badly. Similar to how you can never really remove the effects of earthquake when editing the spell, it has it's own internal data which can glitch and bug especially when running the spell as MUI. (Multi-Unit Instanceable)
 

Epicurus

New Member
Reaction score
1
What do you think making units from when another is removed.
There is no "unit is removed."
 

Tyrulan

Ultra Cool Member
Reaction score
37
Not sure what you mean... but here. This should help.

Trigger:
  • Untitled Trigger 002
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in No region matching ((Unit-type of (Matching unit)) Equal to Footman)) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
@Tyrulan: That trigger leaks, set the units equal to footman into a group and remove it afterward.
 

Tyrulan

Ultra Cool Member
Reaction score
37
If it leaks then please, post a new GUI tag. I'm not trying to make the code perfect and you should never take to hear that I've made the trigger perfectly, merely I am showing how this particular problem could be solved. You can't remove all leaks in GUI anyways.
 

Epicurus

New Member
Reaction score
1
ok, I'll post what I tried so theres no confusion.

So here, is where they are removed. Notice the unit group remove blah blah...

JASS:
Save01
    Events
        Unit - A unit enters secondary death 01 <gen>
    Conditions
        ((Owner of (Triggering unit)) controller) Equal to User
    Actions
        Hero - Add ((Integer((Real((Number of units in (Units in secondary death 01 <gen> owned by Player 10 (Light Blue))))))) x 10) experience to (Triggering unit), Hide level-up graphics
        Player - Add ((Integer((Real((Number of units in (Units in secondary death 01 <gen> owned by Player 10 (Light Blue))))))) x 10) to (Owner of (Triggering unit)) Current gold
        Unit Group - Pick every unit in (Units in secondary death 01 <gen> owned by Player 10 (Light Blue)) and do (Unit - Remove (Picked unit) from the game)


Then I want to make a new unit when the flags are removed, but nothing happens. I think its becuase "leave region" is different than "remove"

JASS:
civil make
    Events
        Unit - A unit leaves (Playable map area)
    Conditions
        (Unit-type of (Triggering unit)) Equal to Light Blue Flag
    Actions
        Unit - Create 1 Civilian (Male 2) for Player 10 (Light Blue) at (Random point in (Playable map area)) facing Default building facing degrees
 

Tyrulan

Ultra Cool Member
Reaction score
37
Why not just have your Unit Group command use Multiple Actions and create your new unit then??
 

Epicurus

New Member
Reaction score
1
I tried this, but when I tested it there were three flags and three spots of units popped up on the map one spot had 1 another 2 and the last had 3. I want it to make 1 unit per flag.

Trigger:
  • Save01
    • Events
      • Unit - A unit enters secondary death 01 <gen>
    • Conditions
      • ((Owner of (Triggering unit)) controller) Equal to User
    • Actions
      • Hero - Add ((Integer((Real((Number of units in (Units in secondary death 01 <gen> owned by Player 10 (Light Blue))))))) x 10) experience to (Triggering unit), Hide level-up graphics
      • Player - Add ((Integer((Real((Number of units in (Units in secondary death 01 <gen> owned by Player 10 (Light Blue))))))) x 10) to (Owner of (Triggering unit)) Current gold
      • Unit Group - Pick every unit in (Units in secondary death 01 <gen> owned by Player 10 (Light Blue)) and do (Actions)
        • Loop - Actions
          • Unit - Create ((Number of units in (Units in secondary death 01 <gen> owned by Player 10 (Light Blue))) + 0) Civilian (Male 2) for Player 10 (Light Blue) at (Random point in (Playable map area)) facing Default building facing degrees
          • Unit - Remove (Picked unit) from the game
 

Tyrulan

Ultra Cool Member
Reaction score
37
When it goes through the loop the first time it is creating 3 units for (Every Unit in Region). The second time through it creates 2 units for (Every Unit In Region) Third unit was removed, an so on.

Change the create unit to just Create 1 (unit type) at random point in region)..

:)

EDIT: Sorry let me clarifiy

-First Loop-
3 units in region
Creates 1 unit for each
Remove 1 unit

-Second Loop-
2 units in region
Creates 1 unit for each
Remove 1 unit

-Third Loop-
1 unit in region
creates 1 unit
removes last unit
 

Epicurus

New Member
Reaction score
1
Thanks.

I'm still new to a lot of the triggers so I'm sorry if I'm being painfully noobish.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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