| 01-15-2004, 09:21 AM | #1 |
Ok basically this trigger says for every one of this item on the map, it will generate set amount of gold over set amount of time. The problem im having with it, is that when i test it, it begins giving the gold once the structure has begun building, whether its finished or not. For the map im making, that just wont work. I need a condition of some sort to say "only give the gold once the building is completed". It seems soooo simple to me but i cant seem to get it to work right. Any help would be greatly appreciated, I hate having buggy triggers in my maps :P Ok heres the trigger: (begin code) Events Time - Every 30.00 seconds of game time Conditions Actions Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions) Loop - Actions If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions (Unit-type of (Picked unit)) Equal to Low Cash Crop Then - Actions Player - Add 2 to (Owner of (Picked unit)) Current gold Else - Actions Do nothing (end code) Thanks in advance to anyone out there who can make this trigger work the way i want it to :). (especially you if youre out there AllPainful :P) -Huh |
| 01-15-2004, 09:51 AM | #2 | |
There is a fairly simple solution to this and I used it extensively in a map i made. Use a unit group variable called LowCashCrops and have a couple of triggers mantain it's contents: Quote:
Then simply use the unit group in the "pick every unit..." part. This method also eliminates a memory leak ;) |
| 01-15-2004, 09:52 AM | #3 |
Since there is no condition that picked unit is a finished building the next best thing is to fake it. UnitGroup is a Unit Group Variable. Make a new Trigger Event Unit - A unit owned by Player 1 (Red) Finishes construction Condition -none- Action Unit Group - Add (Constructed structure) to UnitGroup Add this next condition into the if/then/else in your trigger ((Picked unit) is in UnitGroup) Equal to True |
| 01-15-2004, 11:45 AM | #4 |
Grater is correct. That is the best meathod of doing that. Using a unit group variable. |
| 01-15-2004, 08:37 PM | #5 |
hmm, I may be wrong but isnt this 500% more simplistic? unit finished contruction. If-then-else. If contructed building = to lowincome crop. add 2 to Income(integer varable)(player # of owner of triggering unit. else do nothing Then do one that sutracts 2 when it dies, this way you can do all your crops in one just 3 triggers too!. |
| 01-15-2004, 08:43 PM | #6 |
Sorry guy...I don't know a lot about tigger...emote_confused |
| 01-15-2004, 09:11 PM | #7 |
Soul Master: Its against the rules to spam on these boards, and just saying "Sorry, can't help" is spam. Hunter0000: Yes that would work. And it would be easier to "Reset" when the player dies and respawns too. Huh: To elaborate on Hunter0000's method. Variable- integer array called Income Code:
Trigger 1 = Finish Construction
Event
Unit finishes construction
Conditions
Constructing unit is "Cash Crop"
Actions
Set Income[player number(owner of unit(constructing unit))] = Income[player number(owner of unit(constructing unit))] + [color=red]#[/color]
Trigger 2 = Dies
Event
Unit Dies
Conditions
Dying unit is "Cash Crop"
Actions
Set Income[player number(owner of unit(dying unit))] = Income[player number(owner of unit(dying unit))] - [color=red]#[/color]
Trigger 3 = Income
Event
Every 30 Seconds of the game
Conditions
Actions
Pick all players
Do loop
Add Income[player number(picked player)] gold to Picked Player# is the number of gold you want them to get per unit. AND add another line at the begining of your actions for the trigger for when the players main unit dies (the trigger that kills all his units and respawns him somewhere.) Code:
Set Income[player number(owner of(dying unit))] = 0 |
| 01-16-2004, 12:58 AM | #8 |
thanks for all the replies. i kinda like Hunter's method because like allpainful said it will be easier to reset, considering how my units respawn. gonna go write that in :) -Huh |
| 01-16-2004, 04:15 AM | #9 | |
Quote:
Anyway, hold the phone because there is a problem with the "simpler" method, namely if a not yet complete structure is destroyed (by enemy attacks or being cancelled) it still triggers the "unit dies" event. As such it is essential to use unit groups, the triggers as I posted earlier will work fine. ps: there is no difficulty in reseting with unit groups, if you kill all units for a player then the unit group will be empty and they wont get any income from it. |
| 01-16-2004, 05:00 AM | #10 |
LOL.. Grater is of course correct again... And I feel stupid for not seeing that... Go with the Unit Group method. |
| 01-16-2004, 05:51 AM | #11 |
A more complex way to do it would mix the two methods. Add the units into the unit group, and set the intiger, when the building dies it does a check to see if it was in the unit group and if so adjusts the intiger as needed. But that is more complex than needed for this. |
| 01-25-2004, 09:26 PM | #12 |
i think u should just... re pick the unit Unit-group... do that again |
