HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

shop selection trigger

08-18-2007, 08:01 AM#1
botanic
I have this trigger for when a player selects a shop it will change them to another shop based on what hero they have. However I cant figure out how todo a few things

1) optimize this there are so many loops there seems like there should be a better way...

2) if the player selects a shop that isnt the correct one it will correct it (ex a player selects Hero_Market[1] and has Hero_Type[2])

The variables are

Hero_Market[] Unit array
Hero_Type[] Unit type array

I have managed to get the main shop reselect working however the reselect i cant manage to get it to work without creating an endless loop

Trigger:
Specific Hero Shops
Collapse Events
Unit - Marketplace (full size) 0024 <gen> Is selected
Conditions
Collapse Actions
Collapse For each (Integer A) from 1 to 12, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Triggering unit) is selected by (Player((Integer A)))) Equal to True
Collapse Then - Actions
Collapse For each (Integer B) from 1 to 12, do (Actions)
Collapse Loop - Actions
Collapse Unit Group - Pick every unit in (Units of type Hero_Type[(Integer B)]) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked unit) is in (Units in (Playable map area) owned by (Player((Integer A))))) Equal to True
Collapse Then - Actions
Selection - Clear selection for (Player((Integer A)))
Selection - Select Hero_Market[(Integer B)] for (Player((Integer A)))
Skip remaining actions
Else - Actions
Else - Actions

PS: yes i know it leaks ill fix that later tho
08-19-2007, 12:30 AM#2
botanic
um anyone...
08-19-2007, 12:38 AM#3
The Elite
1) dont thing you can the only other way is a trigger per player
2) try using this...
Trigger:
Red Market
Collapse Events
Player - Player 1 (Red) Selects a unit
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to Market
(Triggering unit) Not equal to Hero_Market[1]
Collapse Actions
Selection - Clear selection for Player 1 (Red)
Selection - Select Hero_Market[1] for Player 1 (Red)
havent tested though
08-19-2007, 04:45 AM#4
botanic
That cant work for what i need because i need a Triggering unit <> Hero_Market with the index = index of hero_Type owned by player