HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unit selling units problem.

03-19-2008, 11:12 PM#1
Dp1983
I have some units that sell units so that the player can select his hero. Those same units also sell an item so that the player can load his hero. If the player buys that item I remove their circle of power from the game to keep them from choosing a hero and getting multiple heroes. Then if something goes wrong during the loading process I recreate a circle of power around the selling unit to allow the player to try again.

The problem is that the new circle of power cannot buy any units. The units don't show up in the menu. However, the item still shows up for sale. What causes this and can I fix it? If so how?

Thank you.

Edit for the code:

The hero selection trigger. Note that this trigger would not have fired during the process which I am discussing because the player has bought the load item.

Trigger:
Manual Pick
Collapse Events
Unit - A unit Sells a unit
Collapse Conditions
((Sold unit) is A Hero) Equal to True
Collapse Actions
Game - Display to (Owner of (Buying unit)), at offset (0.00, 0.00) for 3.00 seconds the text: Now choose a race.
Collapse Player Group - Pick every player in (All players) and do (Actions)
Collapse Loop - Actions
Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)
Unit - Remove (Buying unit) from the game
Selection - Select (Sold unit) for (Owner of (Sold unit))
Unit - Move (Sold unit) instantly to (Random point in Race Selection <gen>)
Set Save_HeroPlayer[(Player number of (Owner of (Sold unit)))] = (Sold unit)
Camera - Pan camera for (Owner of (Sold unit)) to (Position of (Sold unit)) over 0.00 seconds

The part in my load trigger that removes the circle of power to keep them from buying a unit after buying the load item.

Trigger:
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-type of (Item being manipulated)) Equal to Load
Collapse Actions
Unit - Remove (Triggering unit) from the game

The part that checks to see if the player loads an incompatible hero, removes that hero and then places a new circle of power so that said player can try again.

Trigger:
Load Only alignment good
Collapse Events
Unit - A unit enters InnLoad <gen>
Collapse Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
((Triggering unit) is owned by Player 1 (Red)) Equal to True
((Triggering unit) is owned by Player 2 (Blue)) Equal to True
((Triggering unit) is owned by Player 3 (Teal)) Equal to True
((Triggering unit) is owned by Player 4 (Purple)) Equal to True
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to Drow Assassin
etc
Collapse Actions
Unit - Remove (Triggering unit) from the game
Game - Display to (Owner of (Triggering unit)), at offset (0.00, 0.00) the text: You cannot load a c...
Unit - Create 1 Circle of Power for (Owner of (Triggering unit)) at (Random point in RecreateHeroSelectLoad <gen>) facing (Position of Good Alignment Classes 0024 <gen>)
Camera - Pan camera for (Owner of (Last created unit)) to (Position of (Last created unit)) over 0.00 seconds


I also tried recreating the circle of power at the position of the unit doing the selling, in this case Good Alignment Classes. That also had the same problem.
03-19-2008, 11:20 PM#2
Salbrismind
Quote:
Originally Posted by Dp1983
I have some units that sell units so that the player can select his hero. Those same units also sell an item so that the player can load his hero. If the player buys that item I remove their circle of power from the game to keep them from choosing a hero and getting multiple heroes. Then if something goes wrong during the loading process I recreate a circle of power around the selling unit to allow the player to try again.

The problem is that the new circle of power cannot buy any units. The units don't show up in the menu. However, the item still shows up for sale. What causes this and can I fix it? If so how?

Thank you.

I know the better modders will ask the same thing: We need the code, it is a lot easier to find your problems (also impossible otherwise) if we see your code and it also helps us understand your problem. So post all related triggers, or functions if your using Jass.
03-19-2008, 11:53 PM#3
Rising_Dusk
I'm trying to think of a logical reason why the circle of power wouldn't be able to buy units. Hrm... This really doesn't seem like a trigger flaw though, more a fluke in the way circle of powers or whatever work. (Or something)

Have you tried hiding and unhiding the circle of power after recreating it? Sometimes that helps.
03-19-2008, 11:59 PM#4
Dp1983
Edit:

Tried to hide and unhide the removed circle of power. Didn't work. Also tried to Hide the circle of power instead of removing it and then unhiding it later. That resulted in the same problem as removing and adding. Also tried hiding and unhiding everything around the unit and hiding and unhiding the unit itself. All resulted in the same problem.