Adding 10g per Building1 each 30 secound.

Gripen2

New Member
Reaction score
1
Im not that good at making "Special" triggers.

How can i make something like this:

You build 3 building1.
Each 30 Seconds you get 30 gold.


I have one example in a map but its jass, and i dont understand Jass.
 

TestSubject0

New Member
Reaction score
0
umm try something like when construction is completed on building1 add +1 to a variable named Income, then whatever you have as your income trigger, just make it add <Income> gold to player <whatever>
 

Gripen2

New Member
Reaction score
1
umm try something like when construction is completed on building1 add +1 to a variable named Income, then whatever you have as your income trigger, just make it add <Income> gold to player <whatever>

Im not sure if it "Adds income", I think it counts how many you got and Gives you the money each 30 secounds, All at the same time.
 

TestSubject0

New Member
Reaction score
0
Counting every building on each tick is a waste of computer resources(IMO) i would just use a variable to hold how much each player gets, or even an array so you have only 1 variable for all players.
 

Gripen2

New Member
Reaction score
1
Counting every building on each tick is a waste of computer resources(IMO) i would just use a variable to hold how much each player gets, or even an array so you have only 1 variable for all players.

Im not sure.
I can paste it here.



Animal Spawns ( Its an building that spawns animals, But im making one that does'nt spawn )
Code:
function Trig_Animals_Spawn_Func001002 takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'nshe', GetOwningPlayer(GetEnumUnit()), GetUnitLoc(GetEnumUnit()), bj_UNIT_FACING )
endfunction

function Trig_Animals_Spawn_Func002002 takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'npig', GetOwningPlayer(GetEnumUnit()), GetUnitLoc(GetEnumUnit()), bj_UNIT_FACING )
endfunction

function Trig_Animals_Spawn_Func003002 takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'n00D', GetOwningPlayer(GetEnumUnit()), GetUnitLoc(GetEnumUnit()), bj_UNIT_FACING )
endfunction

function Trig_Animals_Spawn_Actions takes nothing returns nothing
    call ForGroupBJ( GetUnitsOfTypeIdAll('h002'), function Trig_Animals_Spawn_Func001002 )
    call ForGroupBJ( GetUnitsOfTypeIdAll('h001'), function Trig_Animals_Spawn_Func002002 )
    call ForGroupBJ( GetUnitsOfTypeIdAll('n00C'), function Trig_Animals_Spawn_Func003002 )
endfunction

//===========================================================================
function InitTrig_Animals_Spawn_Copy takes nothing returns nothing
    set gg_trg_Animals_Spawn_Copy = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Animals_Spawn_Copy, 60.00 )
    call TriggerAddAction( gg_trg_Animals_Spawn_Copy, function Trig_Animals_Spawn_Actions )
endfunction



Gold
Code:
function Trig_Farming_Gold_Func001002 takes nothing returns nothing
    call AdjustPlayerStateBJ( 2, GetOwningPlayer(GetEnumUnit()), PLAYER_STATE_RESOURCE_GOLD )
endfunction

function Trig_Farming_Gold_Func002002 takes nothing returns nothing
    call AdjustPlayerStateBJ( 4, GetOwningPlayer(GetEnumUnit()), PLAYER_STATE_RESOURCE_GOLD )
endfunction

function Trig_Farming_Gold_Actions takes nothing returns nothing
    call ForGroupBJ( GetUnitsOfTypeIdAll('nshe'), function Trig_Farming_Gold_Func001002 )
    call ForGroupBJ( GetUnitsOfTypeIdAll('npig'), function Trig_Farming_Gold_Func002002 )
endfunction

//===========================================================================
function InitTrig_Farming_Gold_Copy takes nothing returns nothing
    set gg_trg_Farming_Gold_Copy = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Farming_Gold_Copy, [B][COLOR="Red"]30[/COLOR][/B].00 )
    call TriggerAddAction( gg_trg_Farming_Gold_Copy, function Trig_Farming_Gold_Actions )
endfunction


Now when im looking at it, I think it counts the amount of pigs/sheeps you got and multiplies it.
 

Extremedesyr

New Member
Reaction score
6
I can do that

I used 1 simple trigger:

Trigger:
  • Events
    • Time - Every 30 seconds of time
    • Conditions
    • Actions
    • Player group - pick every player in (all players controlled by a user player) and do add (Number of living farm units owned by picked player x10) to picked player current gold


then you may allso want a leader/multiboard.
 

Gripen2

New Member
Reaction score
1
-------------------------------------------------------------------------------------------------------------------

Hmm, I dont think i need to change anything. im done.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top