• 🏆 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!

First hero being free (no gold)

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2010
Messages
950
So as we all know im sure, this trigger line creates starting units depending on race..
  • Melee Game - Create starting units (for all players)
but it also sets it so that the first hero you train OR get from the tavern is free.
I need that feature but i do not want it to auto create starting units based on the race along with it..
Any ideas
 
Level 6
Joined
May 11, 2010
Messages
236
Maybe

  • Remove Peons
    • Events
      • Map initialization
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Race of Player 1 (Red)) Equal to Undead
        • Then - Actions
          • Unit Group - Pick every unit in (Units owned by Player 1 (Red) matching ((Unit-type of (Picked unit)) Equal to Acolyte)) and do (Unit - Remove (Picked unit) from the game)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Race of Player 1 (Red)) Equal to Night Elf
            • Then - Actions
              • Unit Group - Pick every unit in (Units owned by Player 1 (Red) matching ((Unit-type of (Picked unit)) Equal to Wisp)) and do (Unit - Remove (Picked unit) from the game)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of Player 1 (Red)) Equal to Human
                • Then - Actions
                  • Unit Group - Pick every unit in (Units owned by Player 1 (Red) matching ((Unit-type of (Picked unit)) Equal to Peasant)) and do (Unit - Remove (Picked unit) from the game)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Race of Player 1 (Red)) Equal to Orc
                    • Then - Actions
                      • Unit Group - Pick every unit in (Units owned by Player 1 (Red) matching ((Unit-type of (Picked unit)) Equal to Peon)) and do (Unit - Remove (Picked unit) from the game)
                    • Else - Actions
Probably not the most graceful method but could be refined or improved to fit your needs? Not sure if you wanted the townhall gone too, but you could just add that in
 
  • Test
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is A town-hall-type unit) Equal to True) or (((Matching unit) is A peon-type unit) Equal to True))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Picked unit)) controller) Equal to User
            • Then - Actions
              • Unit - Kill (Picked unit)
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
 
Level 13
Joined
Mar 24, 2010
Messages
950
cool Pharaoh_ i've been meaning to ask you this anyway, why is it that you kill the unit before removing it? i remember hearing somewhere that it can cause leak or errors of some sort? but no idea what, or if thats even true?
 
Level 13
Joined
Mar 24, 2010
Messages
950
but what if that unit that was removed is never refereed to by a trigger ever again, is it still a bad thing? or no
also is it that case for every situation? a unit must always be killed before being removed no matter what?
do you know what it does exactly, if its not done that way?
 
Level 13
Joined
Mar 24, 2010
Messages
950
is there a way to create units without making that lag? theres no way to remove unit creation leaks is there..
so does it leak upon unit removal also then? is that why it needs to be killed first, i assume blizzard takes care of units when killed but not when just removed while still alive via triggers..? which doesnt make much sense lol

guess ill have to go through all my stuff now and make sure i dont ever remove a unit before killing it.. :/
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Apparently someone did some research and found that the remove unit native does not properly free up memory resulting in a permant leak. Making the unit explode and then killing it however does seem to free up memory as the automatic unit death removal seems to work fine.

I did not find this out, I am purly going by the findings of what someone else posted.
 
Level 13
Joined
Mar 24, 2010
Messages
950
So doesnt making the unit explode auto make it 'killed' then right.

so after making it explode then insta remove it after and in turn there would then be no memory leaking?

also would there be a leak with removing heros from the game also? would u need to kill the hero then remove it?
 
Status
Not open for further replies.
Top