# [General]Lumber and Gold problem

Status
Not open for further replies.

#### Ev0_HunteR

Level 3
Hey Guy. I wan make a trigger that when a player build a lumber mill or gold mine , then it will receive 1 lumber or 1 gold per second. Who can help me? Thanks

#### aarcaa

Level 6
First you must make an off trigger which gives player 1 lumber per sec
Then,
Event -unit finishes construction
Condition - completed structure equal to lumber mill
Action - turn on lumber trigger

#### edo494

Level 23
this should do
• thetrigger
• Events
• Time - Every 1.00 seconds of game time
• Conditions
• Actions
• Set loc = (Point(0.00, 0.00))
• For each (Integer A) from 1 to 12, do (Actions)
• Loop - Actions
• Custom script: set bj_wantDestroyGroup = true
• Unit Group - Pick every unit in (Units within 10000.00 of loc matching ((Unit-type of (Matching unit)) Equal to Knight)) and do (Actions)
• Loop - Actions
• Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) + 1)
• Custom script: set bj_wantDestroyGroup = true
• Unit Group - Pick every unit in (Units within 10000.00 of loc matching ((Unit-type of (Matching unit)) Equal to Lumber Mill)) and do (Actions)
• Loop - Actions
• Player - Set (Player((Integer A))) Current lumber to (((Player((Integer A))) Current lumber) + 1)
• Custom script: call RemoveLocation(udg_loc)
loc is point variable

#### greenyaptec

Level 3
this should do
• thetrigger
• Events
• Time - Every 1.00 seconds of game time
• Conditions
• Actions
• Set loc = (Point(0.00, 0.00))
• For each (Integer A) from 1 to 12, do (Actions)
• Loop - Actions
• Custom script: set bj_wantDestroyGroup = true
• Unit Group - Pick every unit in (Units within 10000.00 of loc matching ((Unit-type of (Matching unit)) Equal to Knight)) and do (Actions)
• Loop - Actions
• Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) + 1)
• Custom script: set bj_wantDestroyGroup = true
• Unit Group - Pick every unit in (Units within 10000.00 of loc matching ((Unit-type of (Matching unit)) Equal to Lumber Mill)) and do (Actions)
• Loop - Actions
• Player - Set (Player((Integer A))) Current lumber to (((Player((Integer A))) Current lumber) + 1)
• Custom script: call RemoveLocation(udg_loc)
loc is point variable

Instead of 'Units within 10000.00 of loc' use 'Units within Playable map area'

#### edo494

Level 23
well, I really fastly checked things on list and I saw: leak, leak, leak, leak, too long to read, leak, leak so I decided to do it that way but then it wont need the location as well as RemoveLocation

#### defskull

Level 33
Look at my Signature and click on the Resource Generator

If you don't understand how to use it, PM/VM me.
I should not advertise my own resource but it can solve his problem.

#### Elfansoer

Level 4
/////////////////////////////////////
Event: every 1 second
Action: Pick every unit in (playable map) matching ([is a lumber mill] and [is yours]) and do action:
-add 1 lumber and 1 gold for you.
/////////////////////////////////////

I think it's simple (you make it so simple! Even not following the GUI/trigger's words!), but maybe there's some mistakes (well, everybody can do mistakes, so do YOU! Er, not you, you who read this text).

#### defskull

Level 33
You can have as many method as you can, but compare which is efficient.
My system does not pick every unit in the map and do iterations (check of condition - filter them out) which the process is heavy and powerful if you have many units on your map.

My system just assess building in the unit group (lower the value count compared to pick every unit in map).

#### Elfansoer

Level 4
You're right. But on my system (lo-class, lo-specs, lo-price, lo-what again? [Oh, shuddup!]) it works pretty well.... Maybe because it's a tiny map...

You can use the very first answer, though, with some changes:
/////////////////////////////////////////
Act:
-set var (HowMuchTheLumberMill) = HowMuchTheLumberMill + 1
-turn on the trigger that gives you (HowMuchTheLumberMill) lumber and (HowMuchTheLumberMill) gold each second.
(Look, it's simplified again, and the var's name is way TOO LONG! You're lazy! [Yeah, I am])
/////////////////////////////////////////
Note: even the trigger have been turned on, what's the effect of turning it on once again? (answer: you turned it on twice)

#### defskull

Level 33
Note: even the trigger have been turned on, what's the effect of turning it on once again? (answer: you turned it on twice)
Are you referring to my trigger ?
Turning on a turned trigger does not make less efficient.
It's like you're removing a unit from a unit group, which the unit is not in the unit group in the first place.

Checking Condition VS Null Action, it's pretty same I guess.

I can do this;
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (RG_Group is empty) Equal to True
• Then - Actions
• Trigger - Turn on RG Loop <gen>
• Else - Actions
But it's the same, you're making a "check", while mine is doing action to a null value, making them both the same efficient as they are.

#### Elfansoer

Level 4
Err... Umm... I'm so sorry, I don't think you'll say that! (Me too!)

I'm referring to my "changed trigger", that when LumbMill is constructed, that trigger will run Action, and the action "turn on trigger" will be done repeatedly, and I think someone will questioning it... (I'm silent now, to prevent future misunderstanding)

So the quote means "there's no effect turning on trigger repeatedly"....
(Well, I don't like the "VS" thing....)

#### defskull

Level 33
Oh don't worry, if you're repeating to turn on the event, that's okay.
As I mentioned it, check vs action, it's pretty same efficiency (depends on situation).
Which in this case, your trigger works fine.

#### Elfansoer

Level 4
Sorry, I'm newbie here (very newbie, look at the join date...), I don't want to feel bossy.... (Even if you're a boss?)

#### defskull

Level 33
Even if you're newbie and I'm elite (EXAMPLE), and you're right for certain matter, you have the right to have an argument with me (valid argument).

I once saw my classmate argued with physics teacher and he's right, that teacher admit it that it's her fault and mistake for teaching the wrong things.

But SOME people just do not want to admit their mistake.

#### Elfansoer

Level 4
If no, i'm asking something on a new thread, which is on a same category with this....

#### defskull

Level 33
If you have another question that is not related to the main topic of this thread at all, you must open a new thread in a correct section.

#### Elfansoer

Level 4
Okay. Im leaving. Sorry, I'm new to this "thread" thing. (Hijack, that's sound so serious....)

Status
Not open for further replies.

Replies
3
Views
690
Replies
2
Views
1K
Replies
1
Views
353
Replies
2
Views
408
Replies
4
Views
558