HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Lumber-bandit-trigger-problem-help!

06-25-2006, 04:11 PM#1
Kabel
On my map, Peons can be upgraded into Bandits for a gold cost, via the Bear form ability. I want the Bandits to generate a tiny amount of lumber.

I thougt of a trigger:

Once every 60 seconds of gametime, add 1 lumber to matching player for EVERY 5 Bandits he or she controls.

In other words, if I have 14 Bandits I will recieve 2 lumber every minute, but if I buy one more Bandit I will have 15 Bandits and thereby recieve 3 lumber per minute.
(And if PLAYER 2 only has 6 Bandits he will only get 1 lumber every minute, and so on and so on..)

Any suggestion on how this can be made?
06-25-2006, 04:39 PM#2
BertTheJasser
1.Create a group for each player.
2.Whenever a bandit enetrs map/peaon finishes upgrading/morphing, add the unit to the depending player. Remove a unit when it dies with some delay to keep it ressurection and that working.
3. Every <cycle> seconds count the players in the depedning group and use
Collapse JASS:
<integer> n being counter of the depending bandits
<integer> g being the gold amount
set g=n/5
Add g to the players gold resource.

Finshed in less than 3 minutes. ;D
06-26-2006, 01:54 AM#3
PipeDream
I would generate the group at each interval via all units matching type. More robust.
07-14-2006, 07:24 PM#4
Kabel
Change of plans! I want every Bandit a player owns to generate 1 Lumber to that player every 60 seconds. So, if I own 7 Bandits I will get 7 lumber, but if my opponent only has 3 Bandits he will only get 3 lumber.
This sounds simple, so please tell me how to make a trigger for this :)
07-14-2006, 08:14 PM#5
DioD
This need trigger for every player or jass coded loop filters.

Loop filters will count units for every player and then add lumber

First you need a trigger like this

Collapse JASS:
function SOME takes nothing returns nothing
    set SOME = CreateTrigger(  )
    call TriggerRegisterTimerEvent( SOME, 1.00 ,true)
    call TriggerAddAction( SOME, function SOME )
endfunction

Count Function

Collapse JASS:
        loop
        set FilterU = FirstOfGroup(GetLumber)
        exitwhen FilterU == null
        call GroupRemoveUnit(GetLumber,FilterU)        
        call SetInt(GetOwningPlayer(FilterU),"lum",GetInt(GetOwningPlayer(FilterU),"lum")+1)
    endloop

This will save number of bandits for a players...

After giving lumber clean "lum" value
07-14-2006, 10:19 PM#6
Kabel
Is their not any easier way? :)
07-14-2006, 11:15 PM#7
DioD
Trigger:
Untitled Trigger 003
Collapse Events
Time - Every 60.00 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Triggering unit)) Equal to Footman)) and do (Actions)
Collapse Loop - Actions
Player - Set (Owner of (Picked unit)) Current lumber to 1

It cannot be more aesy
07-15-2006, 12:20 AM#8
Gerk
Wouldn't that just set them to 1 lumber? Though that IS the right idea...
07-15-2006, 01:40 AM#9
DioD
Misstyped simply use ADD action instead...
07-15-2006, 10:36 AM#10
Kabel
Thanks