• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] My gametime multiboard doesn't work

Status
Not open for further replies.
Level 24
Joined
Aug 1, 2013
Messages
4,657
One thing is that 1 will not show 01, so 10 hours, 5 minutes and 1 second will be [10:5:1] instead of [10:05:01]

Also, you are using reals which are decimal numbers. Instead you should use integers which are non-decimal numbers.

The easiest way is to use a small function using jass:
JASS:
    function GetTimeStamp takes integer time returns string
        local string result
        local integer hours
        local integer minutes
        local integer seconds
        local string hoursString
        local string minutesString
        local string secondsString
        
        set hours = time / 3600
        set time = time - hours*3600
        set minutes = time / 60
        set time = time - minutes*60
        set seconds = time
        
        set result = I2S(hours) + ":"
        if (minutes < 10) then
            set result = result + "0" + I2S(minutes) + ":"
        else
            set result = result + I2S(minutes) + ":"
        endif
        if (seconds < 10) then
            set result = result + "0" + I2S(seconds)
        else
            set result = result + I2S(seconds)
        endif
        
        return result
    endfunction
And calling that from a custom script.
You just have to copy and paste that to the header file (which is at the top of the trigger list named the same as the map name and has a blue world editor icon).

Then you only have to calculate the seconds using a trigger that runs every second:
  • Time
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Time = (Time + 1)
      • Custom script: set udg_TempString = GetTimeStamp(udg_Time)
      • Game - Display to (All players) the text: TempString
(Ofcourse, this one just displays the time as message to the player, but you can change that to multiboard stuff as soon as you have this working.)
 
Level 4
Joined
Aug 6, 2014
Messages
87
It works now when I put integer, I usually know that real is decimal and integer is normal but I somehow must've thought that doesn't matter at all there.

And tbh I don't see any sense for me using JASS a program I'm not familar with than using my old common beloved Wc3 World Editor <3.

Thank you very much :p

Edit: Is there a way that I use a variable for specific every player? For exmaple, I want a variable, cuz I'm gonna use it in multiple triggers, that adds 1 point for each unit he has to the specific player variable. For example so I can use it to buy for "each soul" the player has collected he gets X amount of Gold / Wood on a shop and it adds to the scoreboard how many souls a player owns etc.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
JASS is not a program... it is a language.
Try to select a GUI trigger and click Edit -> Convert to Custom Text.
GUI Triggers = JASS.

The easiest way is to use an integer (or real preferred in this case but gold and lumber api is set up using integers) array.
Make a global variable of type integer and make it an array.
Name the variable IncomeGold or IncomeLumber.

An array is simply said a list of variables of the same type.
You can choose between different values using an index number.
For players, you can use the player id as index number.
So: "Set IncomeGold[(Player number of (Triggering Player))] = 123"
When filling the multiboard, you might want to loop through every player and use (Picked Player).

To get the player of the client (the one that plays the game), you can do a custom script (which is also JASS) of "set udg_TempPlayer = GetLocalPlayer()".
Then the variable TempPlayer will have Player(Wietlol) for me, but Player(Freyky) for you.
Then you can make a multiboard that shows the income of only yourself... for every player.
 
Level 4
Joined
Aug 6, 2014
Messages
87
Thanks it worked :), after years and years of Wc3 I thought these forums would be dead asf, but I guess warcraft 3 will always have a lot of fans :p
And tbh without knowing the API of Warcraft 3 I better stick to the default trigger editor.
 
Status
Not open for further replies.
Top