1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Linux Is there a way to change round time on the fly ?

Discussion in 'Community Dev Corner' started by Leo, Dec 14, 2014.

Mods: Downburst, Mazey
  1. Leo

    Leo Haxor

    Messages:
    503
    Sometimes I seed a server and while I am spectator timer's running in the background. As a result, and when enough players join the server and round starts, there is not so much time left anymore. Except from restartting the map is there any other way, a comannd or something, to reset timer on the fly ?
     
  2. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    You could try to run
    Code:
    /rcon getRules().set_s32("gameDurationMinutes", *the time you want to set*);
    But i'm not sure this will work.

    Edit :
    You could also try to pick up the gamestart time to your KScript2 plugin using
    Code:
    /rcon print("GAME_BEGIN " + getGameTime());
    and to let KScript2 looking for "GAME_BEGIN *some number*" in logs (while checking it's not a player doing this too!). Then, to change it, you could do
    Code:
    /rcon rules.set_u32("game_end_time", blah);
    ; blah being initialtime + thedurationyouwant.
    This would be better as I don't think set_s32 will work on gameDurationMinutes variable.

    Edit 2 :
    I am not sure, but I guess you will need to do
    Code:
    rules.Sync("game_end_time", false);
    too, or clients may not see the new timer.
     
    Last edited: Dec 14, 2014
    norill likes this.
  3. Leo

    Leo Haxor

    Messages:
    503
    Thanks, the truth is that I actually do have a script that does that. It inputs a timer if "number of players > than this number). Problem is that until, for example there are 20 players in server, there is already a long time that map is on. So we get, over 20 players a 40 minutes timer. When the number of players go under this, timer resets. But then it goes to 40 minutes again if number of players go over 20. And so on... That's why I just wanna do it manually when I am there.
     
  4. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    You could make a script so you can set it manually using
    Code:
    /rcon rules.set_u32("my_variable_for_the_remaining_time", 60);
    for example.
    You could also change your automatic script so it plays up with percentages. If there are more than 20 players, add 15% time, if less, remove 15%, unless there are less of 15:00 remaining.
     
  5. Leo

    Leo Haxor

    Messages:
    503
    Would you like to have a look at the script and make some useful changes to it ? Only if you want and have time that is.
     
  6. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    I don't work with KScript2, if you're using it and not using the KAG engine, I can't help you. I'm also quite busy with the worldbuilder c++ recode and I'd prefer spending some of my free time playing
     
  7. Leo

    Leo Haxor

    Messages:
    503
    Alright.
     
Mods: Downburst, Mazey