Plunder!

Hanz

Member
Joined
Apr 9, 2006
Messages
10
Reaction score
0
Hello. I have a unit named Bandit on my map, and the Bandit has the Factory-ability which makes it spawn one "Plunder-Unit" every minute. The Plunder-Unit lives 1 second and when it dies I have a trigger that gives me 1 gold. But because the Bandits have this ability they cant be in the same group as other units. Kinda like when you try to mark several buildings in the same group when you drag the cursor over them. Only one building will be marked. Anyways, I was wondering however it is possible for the Bandit to give me 1 Gold every second without the use of the Factory-ability? Thanks.
 

Dream_Walker

BattleForums Senior Member
Joined
Feb 20, 2005
Messages
1,924
Reaction score
0
Location
Arcanum
Use an If/Then/Else function.

If
  • ((Bandit is alive) equal to True)
Then
  • Turn on MoneyGain
Now, MoneyGain is a separate trigger that has the Event:
Event
  • Every 1 seconds of game time
---No Condition---
Actions
  • Add +1 to players gold count
Else
  • Turn off MoneyGain
 

Hanz

Member
Joined
Apr 9, 2006
Messages
10
Reaction score
0
The GoldGain trigger looks like this:

Event: Time - Every 60 seconds of game time
Actions: Player - Add 20 to (Matching player) Current Gold

The Bandit trigger looks like this:

If - (Unit-type of triggering unit equal to Bandit)
Then do (Turn on Goldgain)
Else do (Turn of Goldgain)

I dont know what I shall write in the "If" part of the trigger, casus I cant find anything that says "((Bandit is alive) equal to true)
Is it correct to set "Matching Player" in the Goldgain trigger? Shall it be "Owner of triggering unit" instead?
Thanks for the help so far, by the way
 

x42bn6

Retired Staff
Joined
Nov 11, 2002
Messages
15,150
Reaction score
2
Location
London, United Kingdom
Hanz said:
The GoldGain trigger looks like this:

Event: Time - Every 60 seconds of game time
Actions: Player - Add 20 to (Matching player) Current Gold

The Bandit trigger looks like this:

If - (Unit-type of triggering unit equal to Bandit)
Then do (Turn on Goldgain)
Else do (Turn of Goldgain)

I dont know what I shall write in the "If" part of the trigger, casus I cant find anything that says "((Bandit is alive) equal to true)
Is it correct to set "Matching Player" in the Goldgain trigger? Shall it be "Owner of triggering unit" instead?
Thanks for the help so far, by the way
No, because there is no unit triggering the trigger in the Event section.

Use Pick every Player in game (or something like that) and Unit of Picked Player instead of Unit of Matching Player or Unit of Triggering Player.*
 

Hanz

Member
Joined
Apr 9, 2006
Messages
10
Reaction score
0
Oh okey, thanks!
But what about this part?

The Bandit trigger looks like this:

If - (Unit-type of triggering unit equal to Bandit)
Then do (Turn on Goldgain)
Else do (Turn of Goldgain)

Is it correct?

Heee... Now the trigger works, but it only gives me 20 Gold every minute, no matter how many Bandits I have...
 

ChrisH36

Guy with Most Posts on Quiet Board.
Joined
May 20, 2003
Messages
15,042
Reaction score
4
Location
Temple Prime, Sarajevo
If you want to control via how many bandits there are, here is waht you do.

Keep a variable that stores the number of bandits on the field. Then where it says 20 gold, multiply the variable with the bandit count by the 20.
 

Hanz

Member
Joined
Apr 9, 2006
Messages
10
Reaction score
0
Okey humble people, my triggers looks like this:

Trigger number 1: "Bandit GoldGain"

Event: Time - Every 60 seconds of game time
Condition: None
Actions:

Player - Add 20 to (Picked player) Current Gold
Player group - Pick every player in (All players) and do (Do nothing)


Trigger number 2: "Bandit Goldtrigger"

Event: None
Condition: None
Actions: If (All conditions are True) then do (Then actions) else do (Else actions)

If - conditions:

((Mathing unit) is Alive) Equal to True
(Unit-type of (Triggering unit) Equal to Bandit)

Then - Actions: Trigger - Turn on Bandit GoldGain <gen>

Else - Actions: Trigger - Turn off Bandit Goldgain <gen>

Thats it. I know this is not right, but I am not so good at triggering... yet.
I know how to create Variables but I dont know what I shall do with it. In fact, there is a lot of things I dont know. :)
Anyways, my goal with those triggers is to make a unit named "Bandit" on my map. For each Bandit a player controlls 20 Gold will be added to his treasury every 60 seconds. So if I have 10 Bandits I will recieve 200 Gold every minute. And all players are able to build Bandits, so the more Bandits you have the more Gold you get...

So all corrections are welcome, and please show the exact triggers.
Thanks for all help I've had so far!
 

Octopor

your whole family is made of meat
Joined
Nov 28, 2003
Messages
2,043
Reaction score
2
Here you go if you want the gold to be distrubuted to all players:
Bandit Count
Events
Unit - A unit enters (Playable map area)
Conditions
(Unit-type of (Triggering unit)) Equal to Bandit
Actions
Set banditnumber //create this as an integer variable// = (banditnumber + 1)
Trigger - Turn on Gold <gen>


Gold (Initially off)
Events
Time - Every 60.00 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
banditnumber Greater than or equal to 1
Then - Actions
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
Player - Add (20 x banditnumber) to (Picked player) Current gold
Else - Actions
Trigger - Turn off (This trigger)


Bandit Dies
Events
Unit - A unit Dies
Conditions
(Unit-type of (Triggering unit)) Equal to Bandit
Actions
Set banditnumber = (banditnumber - 1)
 

x42bn6

Retired Staff
Joined
Nov 11, 2002
Messages
15,150
Reaction score
2
Location
London, United Kingdom
What are these for?

((Matching unit) is Alive) Equal to True
(Unit-type of (Triggering unit) Equal to Bandit)​

More importantly, what is the Event? It can't be a Unit dying, because you are asking if a Unit is alive. And you are using Matching Unit and Triggering Unit... You cannot use either.

Matching Unit refers to a condition.
Picked Unit refers to a Unit picked by a Pick... Action.
Triggering Unit refers to the Unit that is in question in Event.*
 

Octopor

your whole family is made of meat
Joined
Nov 28, 2003
Messages
2,043
Reaction score
2
Just use my trigger, it works perfectly.
 

Hanz

Member
Joined
Apr 9, 2006
Messages
10
Reaction score
0
After a lot of klicking my trigger looks exactly like yours, but still something is not working. I always get 40 gold every minute, no matter how many bandits I have. I think the variable is the problem. I created an Integer Variable as you said, and I even named it to "Banditnumber". :)
I thought of this:

Hellwolf_36 said:
If you want to control via how many bandits there are, here is waht you do.

Keep a variable that stores the number of bandits on the field. Then where it says 20 gold, multiply the variable with the bandit count by the 20.
But how does my variable know how many Bandits there are? The variable requires a set number. For example, I have to write "5" or "7" or something in the fields. Although I didn't change anything in the fields, so all says 0. And I assume that the number in the variable will multiplie with the 20 Gold added every 60 seconds...
Well, as you notice I have never used variables before, cause I always make simple triggers.

And once again, thanks for all help so far! I really appreciate it!
 

Octopor

your whole family is made of meat
Joined
Nov 28, 2003
Messages
2,043
Reaction score
2
Here I'll post my map for you.
 

Hanz

Member
Joined
Apr 9, 2006
Messages
10
Reaction score
0
Now I've looked at your map and I found out what was wrong on my map. The Bandits are actually upgraded from Peons via the Bear-form ability. When I changed the trigger so every Peon generated Gold instead of the Bandits, it worked perfectly.
So I was wondering how I shall do with the Bandits then? Will I just have to make Bandits be trained at regular barracks or can I in any way make then generate gold when upgraded? That would be sweet...

Oh, and one last dumb question from me:

§tar§oft said:
Here you go if you want the gold to be distrubuted to all players:
Does that mean that ALL players get gold from Bandits whoever controlls them? Or does it mean that if I have 5 bandits I will get 100 gold every minute, and player 2 has 10 Bandits he will get 200 Gold every minute...
 

ChrisH36

Guy with Most Posts on Quiet Board.
Joined
May 20, 2003
Messages
15,042
Reaction score
4
Location
Temple Prime, Sarajevo
You would need an array controlling the number of bandits each player has instead of a flat variable.
 

Hanz

Member
Joined
Apr 9, 2006
Messages
10
Reaction score
0
Hellwolf_36 said:
You would need an array controlling the number of bandits each player has instead of a flat variable.
Which variable should I use? I tried an Unit-Variable and selected Bandit as unit-type, but it didn't really work.
 

ChrisH36

Guy with Most Posts on Quiet Board.
Joined
May 20, 2003
Messages
15,042
Reaction score
4
Location
Temple Prime, Sarajevo
You need a numeric array to store the number of bandits. You only use an unit variable array if you want to say:

-Keep track of what hero each guy has
-Blueprints for a Random Hero trigger
-Or some building that each player needs to survive with.
 

Octopor

your whole family is made of meat
Joined
Nov 28, 2003
Messages
2,043
Reaction score
2
Hanz said:
Does that mean that ALL players get gold from Bandits whoever controlls them? Or does it mean that if I have 5 bandits I will get 100 gold every minute, and player 2 has 10 Bandits he will get 200 Gold every minute...
It means that the ammount of Bandits in the map will be added to the same variable, therefore all players will get the same ammount of gold.

I can post the map with the trigger for players to only get the ammount of gold they would get corresponding to the ammount of bandits that they control.

(ex.

Player 1 has 2 bandits so he'd get 40 gold per minute
but Player 2 has 5 bandits so he'd get 100 gold per minute)

I only made the triggers for 4 people, but you can see what I changed, and I made 8 variables for you since you seem to have trouble with them. (you can also just make an interger array for the bandits like hellwolf said or have the variables all made seperately)
 

NewPosts

New threads

Top