• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

How to give gold to a player when time reaches 2700 seconds

Status
Not open for further replies.
Level 6
Joined
Sep 24, 2015
Messages
174
hey, it's me again :)

I want that when game time elapsed is 2700 seconds if player x is in game, is a user and has got a specific unit then add 20 gold to the player, else set gold of player x to 3000.

there are 2 team in my map and basically i want that if the player is in force 1 it adds gold ressource to 20 otherwhise if he's in team 2 it adds his gold ressources to 3000.

here the starting up trigger i did, that's not much but i hope somebody has a solution :D

  • Gold bonus 45 min
    • Event
      • Temps - Elapsed game time is 2700.00 seconds
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 1 (Rouge) controller) Egal Ã* Utilisateur
          • (Joueur 1 (Rouge) slot status) Egal Ã* Joue
        • Alors - Actions
          • Joueur - Add 20 to Joueur 1 (Rouge) Or actuel
        • Sinon - Actions
          • Joueur - Add 3000 to Joueur 1 (Rouge) Or actuel
 
Last edited:
Level 1
Joined
Oct 12, 2015
Messages
2
  • temp
    • Events
      • Time - Elapsed game time is 2700.00 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in yourhumangroup and do (Actions)
        • Loop - Actions
          • Player - Add 20 to (Picked player) Current gold
      • Player Group - Pick every player in yourvampgroup and do (Actions)
        • Loop - Actions
          • Player - Add 3000 to (Picked player) Current gold

if you haven't already, just use this to quickly create your player groups for later use - this still depends on setting the alliances in the Scenario-menu right .. if you don't trust those settings you'll have to manually add every single player to their respective groups via
  • Player Group - Add Player 1 (Red) to yourhumangroup
  • temp
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set yourhumangroup = (All enemies of Player 11 (Dark Green))
      • Set yourvampgroup = (All allies of Player 11 (Dark Green))
But as I already told you in Skype (lol), you could always do this a bit more.. well.. more; like this for example ( it's vJASS and uses my customly created player groups but you can just as well reproduce it in GUI, it's just that I'm too lazy to for the sake of this post :p - if you really want this, just msg me @skype ;) )

JASS:
function Trig_goldwood_Conditions takes nothing returns boolean
	local integer i
    local integer vamgold = 13000
    local integer humgold = 130
    local integer temp = vamgold / 2
    local integer vcount = CountPlayersInForceBJ( game_vampires )
    local integer hcount = CountPlayersInForceBJ( game_humans )
	call DisplayTimedTextToForce( game_allplayers,30,"|cffffcc00Some gold for you...|r")
    if ( GetPlayerController( Player( 10 ) ) == MAP_CONTROL_USER ) then
        call SetPlayerState( Player( 10 ), PLAYER_STATE_RESOURCE_GOLD, ( GetPlayerState( Player( 10 ), PLAYER_STATE_RESOURCE_GOLD ) + temp ) )
        call SetPlayerState( Player( 10 ), PLAYER_STATE_GOLD_GATHERED, ( GetPlayerState( Player( 10 ), PLAYER_STATE_GOLD_GATHERED ) + temp ) )
        set vamgold = temp
        set vcount = vcount - 1
    endif
    if ( GetPlayerController( Player( 11 ) ) == MAP_CONTROL_USER ) then
        call SetPlayerState( Player( 11 ), PLAYER_STATE_GOLD_GATHERED, ( GetPlayerState( Player( 11 ), PLAYER_STATE_GOLD_GATHERED ) + temp ) )
        call SetPlayerState( Player( 11 ), PLAYER_STATE_RESOURCE_GOLD, ( GetPlayerState( Player( 11 ), PLAYER_STATE_RESOURCE_GOLD ) + temp ) )
        set vamgold = vamgold - temp
        set vcount = vcount - 1 
    endif
	for i = 0 to 11
        if ( IsPlayerInForce( Player( i ), game_vampires ) ) then
            if ( vamgold != 0 ) and ( vcount != 0 ) then
                set temp = ( vamgold / vcount )
                call SetPlayerState( Player(i), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState( Player(i), PLAYER_STATE_RESOURCE_GOLD ) + temp )
                call SetPlayerState( Player(i), PLAYER_STATE_GOLD_GATHERED, GetPlayerState( Player(i), PLAYER_STATE_GOLD_GATHERED ) + temp )
                set vamgold = vamgold - temp
                set vcount = vcount - 1
            endif
        endif
        if ( IsPlayerInForce( Player( i ), game_humans ) ) then
            if ( humgold != 0 ) and ( hcount != 0 ) then
                set temp = ( humgold / hcount )
                call SetPlayerState( Player(i), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState( Player(i), PLAYER_STATE_RESOURCE_GOLD ) + temp )
                call SetPlayerState( Player(i), PLAYER_STATE_GOLD_GATHERED, GetPlayerState( Player(i), PLAYER_STATE_GOLD_GATHERED ) + temp )
                set humgold = humgold - temp
                set hcount = hcount - 1
            endif
        endif
    endfor
    set vamgold = 0
    set humgold = 0
    set vcount = 0
    set hcount = 0
    set i = 0
    return false
endfunction

//===========================================================================
function InitTrig_goldwood takes nothing returns nothing
    set gg_trg_goldwood = CreateTrigger(  )
    call TriggerRegisterTimerEvent( gg_trg_goldwood, 2700, true )
    call TriggerAddCondition( gg_trg_goldwood, Condition( function Trig_goldwood_Conditions ) )
endfunction


EDIT: also.. to everyone else... Hi ^_^

... I had an account here, like years ago but I can't for the live of me remember neither the name nor the password, so I more or less created this account to be able to throw my JASS at aitz- and even have it highlighted instead of just deformed by Skype! :D

-- just kidding... I really appreciate everything this community did and still does for the scene, it's just that I doubt I'll be able to bring much contribution as I've more or less retired from editing years ago and am now just a basic DotA 2 player

~Dunst



here's an updated version in case you don't have any preconfigured groups at all... this one litterally only depends on you setting the alliances correctly and presumes that "the brown player" is always "a bad guy"

  • temp
    • Events
      • Time - Elapsed game time is 2700.00 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in (All enemies of Player 12 (Brown)) and do (Actions)
        • Loop - Actions
          • Player - Add 20 to (Picked player) Current gold
      • Player Group - Pick every player in (All allies of Player 12 (Brown)) and do (Actions)
        • Loop - Actions
          • Player - Add 3000 to (Picked player) Current gold
      • Player - Add 3000 to Player 11 (Dark Green) Current gold
      • Player - Add 3000 to Player 12 (Brown) Current gold
 
Last edited:
Level 6
Joined
Sep 24, 2015
Messages
174
like this ? :)

  • Gold bonus 45 min
    • Event
      • Time - Elapsed game time is 2700.00 seconds
    • Conditions
    • Actions
      • Group player - Pick every player in HumanGroup and do (Actions)
        • Loop - Actions
          • Player - Add 20 to (Picked player) Current gold
      • Group player - Pick every player in VampGroup and do (Actions)
        • Loop - Actions
          • Player - Add 3000 to (Picked player) Current gold
 
Last edited:
Level 6
Joined
Sep 24, 2015
Messages
174
Here the solution made by me :

After 45 of gametime.
Give bonus gold to HumanGroup (adding 20 gold to all players in HumanGroup in game)
Give bonus gold to VampGroup (adding 6500 gold to each vampires (player 11 and 12) , if there is only 1 vampire in game (player 11 or 12) it adds 13000 gold bonus.
And if there are minions (humans killed by the vamps and turned into minions), adding to minions in VampGroup, 3000 gold bonus.

Trigger :

  • Gold bonus 45 min humans + vamps
    • Event
      • Temps - Elapsed game time is 2700 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) for 6.00 seconds the text: |cffffcc00Some gold...
      • Player group - Pick every player in VampGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player 11 (Darkgreen) controller) Equal to* Controller
              • (Player 11 (Darkgreen) slot status) Equal to* Play
            • Then - Actions
              • Joueur - Add 6500 to (Picked player) Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player 12 (Marron) controller) Equal to Controller
                  • (Player 12 (Marron) slot status) Equal to Play
                • Then - Actions
                  • Player - Add 6500 to (Picked player) Current gold
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Player 12 (Brown) controller) Equal to* Controller
                      • (Player 12 (Brown) slot status) Equal to* Play
                      • (Player 11 (Darkgreen) controller) Equal to* Nothing
                      • (Player 11 (Darkgreen) slot status) Equal to* Is not used
                    • Then - Actions
                      • Player - Add 13000 to (Picked player) Current gold
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Player 11 (Darkgreen) controller) Equal to controller
                          • (Player 11 (darkgreen) slot status) Equal to* Play
                          • (Player 12 (Brown) controller) Equal to* Nothing
                          • (Player 12 (Brown) slot status) Equal to* Is not used
                        • Then - Actions
                          • Player - Add 13000 to (Picked player) Current gold
                        • Else - Actions
                          • Player - Add 3000 to (Picked player) Or Current gold
      • Player group - Pick every player in HumanGroup and do (Actions)
        • Loop - Actions
          • Player - Add 20 to (Picked player) Current gold
 
Last edited:
Status
Not open for further replies.
Top