• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

how do i use jass to limit maximum gold

Status
Not open for further replies.
Level 37
Joined
Mar 6, 2006
Messages
9,240
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
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
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
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
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.
 
Level 5
Joined
Oct 14, 2010
Messages
100
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.
Top