• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

how do i use jass to limit maximum gold

Status
Not open for further replies.
JASS:
library LimitGold initializer InitTrig_LimitGold

    globals
    
        private constant integer MAX_GOLD = 100
    
    endglobals


    private function Actions takes nothing returns nothing
        call SetPlayerState( GetTriggerPlayer() , PLAYER_STATE_RESOURCE_GOLD , MAX_GOLD )
    endfunction

    private function InitTrig_LimitGold takes nothing returns nothing
        local integer i = 0
        local trigger LimitGold = CreateTrigger()
        loop
            exitwhen i == 12
            call TriggerRegisterPlayerStateEvent( LimitGold , Player(i) , PLAYER_STATE_RESOURCE_GOLD, GREATER_THAN, MAX_GOLD )
            set i = i + 1
        endloop
        call TriggerAddAction( LimitGold, function Actions )
            
    endfunction
    
endlibrary
 
you can do it with out jass

  • gold
    • Events
      • Player - Player 1 (Red)'s Current gold becomes Greater than 1000.00
    • Conditions
    • Actions
      • Player - Set Player 1 (Red) Current gold to 1000
just do it for each player

WARNING do not use Greater than or equal to because it will create infinit loop = crash
 
What is this
I don't even.

Jass NewGen Pack does NOT make you lose your wc3 license. Wc3 doesn't even know whether a map has been made with the regular editor or Jass NewGen Pack.

Edit: Btw, JNGP converts the vJASS code into regular JASS.
 
What is this
I don't even.

Jass NewGen Pack does NOT make you lose your wc3 license. Wc3 doesn't even know whether a map has been made with the regular editor or Jass NewGen Pack.

Edit: Btw, JNGP converts the vJASS code into regular JASS.

Actually, The usage of WE Newgen is against the EULA you signed when installing warcraft 3. It's not because it remains undetected (even though usage of vjass or nolimits would be easy to detect) that it's not breaking the rules. You know, your illegal music isn't suddenly legal either just because your music player still plays it.

Anyway, make a trigger called "LimitGold", convert to custom text and overwrite the text with this script
JASS:
function LimitGoldActions takes nothing returns nothing
    call SetPlayerState( GetTriggerPlayer() , PLAYER_STATE_RESOURCE_GOLD , 1000) // Change "1000" into the maximum gold
endfunction

function InitTrig_LimitGold takes nothing returns nothing
    local integer i = 0
    local trigger gg_trg_LimitGold = CreateTrigger()

    loop
        exitwhen i >= 12
        call TriggerRegisterPlayerStateEvent(gg_trg_LimitGold, Player(i), PLAYER_STATE_RESOURCE_GOLD, GREATER_THAN, 1000) // change "1000" into the maximum gold
        set i = i + 1
    endloop
    call TriggerAddAction(gg_trg_LimitGold, function LimitGoldActions )
            
endfunction
 
Status
Not open for further replies.
Back
Top