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

Heroes Disapear

Status
Not open for further replies.
Level 5
Joined
Jul 30, 2012
Messages
93
Hi,

I have a problem about my heroes in taverns.Some stable heroes are disappering from tavern while time is ticking...So we can't pick those.But if i play in test map, it works fine.I think it may be due to this:

  • Hero Pick
    • Events
      • Unit - A unit enters Altar Region <gen>
    • Conditions
    • Actions
      • Unit - Move (Triggering unit) instantly to ((Owner of (Triggering unit)) start location), facing (Position of Dark Troll Warlord 0025 <gen>)
      • Set Hero[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • Set rastgele_used[(Player number of (Owner of (Triggering unit)))] = True
      • For each (Integer A) from 1 to HeroSayisi, do (Actions)
        • Loop - Actions
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • Player - Make rastgelehero[(Integer A)] Unavailable for training/construction by (Owner of (Entering unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • rastgelehero[(Integer A)] Equal to (Unit-type of (Entering unit))
            • Then - Actions
              • Set rastgelehero[(Integer A)] = rastgelehero[HeroSayisi]
              • Set HeroSayisi = (HeroSayisi - 1)
              • Player Group - Pick every player in (All players) and do (Actions)
                • Loop - Actions
                  • Player - Make rastgelehero[(Integer A)] Unavailable for training/construction by (Picked player)
            • Else - Actions
How can i fix..?

And i have a 1 more question.How can i craft item when inventory is full, like dota's system?It must be ok when we buy last item.

Sorry for my bad english, good forums!
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
You can replace:
  • (Owner of (Entering unit))
With (Triggering Unit) or use:
  • Hero[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
As a referrence.

Don't need to make a unit unavailable two times, (All Players) include the player that does the action as well.

I also suggest that you use Unit - Sells a unit event and check if the sold unit is a Hero and then perform any other actions.

Of course, a better solution to your indexing would be using the "Point Value" in the object editor to index the Heroes.

As for the second part, either, you make the items based on the "runes" type or you put there units instead of items, so that Heroes can purchase items with full inventories.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
use this as condition.
  • ((Triggering unit) is A Hero) Equal to True
also u should not use integer A make ur own integer. never use entering unit instead use triggering unit

this will also stop it from looping through all the indexes.
  • Set HeroSayisi = (HeroSayisi - 1)
as a rule store anything used twice or more into a temp variable. example u use owner of triggering unit a lot store that into a variable and use the variable.
 
Status
Not open for further replies.
Top