Skip to content

I want to make a mod that sets a game global time limit

Earnest_ernestEarnest_ernest Member Posts: 40
edited March 2017 in General Modding
I always found the fact of not having a time limit very unchallenging and unrealistic. Even more considering one can abuse of spam resting. This is why I wanted to impose a time limit on the game so you would get a game over if the game is not finished before that time limit. I think Prince of Persia got it right by implementing that feature.

Any help on how could I tweak the game data to make this happen in NEARINFINITY?

Regards
Post edited by Earnest_ernest on

Comments

  • Earnest_ernestEarnest_ernest Member Posts: 40
    Ok I am really close. Just read some of the Nearinfinity documentation and there is a file which has all of the scripts triggers in the whole game (baldurs.bcs). I just found some code that evaluates if any party member is alive to or not to set the game to its gameover state.. Look at it:



    Might soon make a mod for anyone to download it
  • Earnest_ernestEarnest_ernest Member Posts: 40
    edited March 2017
    I just need to find a way to get the game time attribute and use it inside the baldur.bcs file. But i dont know where such attribute value is stored..
  • kjeronkjeron Member Posts: 2,368
    Top of Baldur.BCS:
    IF
    	GlobalTimerExpired("GMTIMER","GLOBAL")
    THEN
    	RESPONSE #100
    		GameOver(-1) // No such index
    END
    IF
    	!GlobalTimerNotExpired("GMTIMER","GLOBAL")
    THEN
    	RESPONSE #100
    		SetGlobal("GMTIMER","GLOBAL",time)
    END
    time = total gametime in ticks
    90/Round
    900/Turn
    4500/Hour (ingame, not real)
    108000/Day (ingame, not real)
    39420000/Year (ingame, not real)
  • Earnest_ernestEarnest_ernest Member Posts: 40
    edited March 2017
    kjeron said:

    Top of Baldur.BCS:

    IF
    	GlobalTimerExpired("GMTIMER","GLOBAL")
    THEN
    	RESPONSE #100
    		GameOver(-1) // No such index
    END
    IF
    	!GlobalTimerNotExpired("GMTIMER","GLOBAL")
    THEN
    	RESPONSE #100
    		SetGlobal("GMTIMER","GLOBAL",time)
    END
    time = total gametime in ticks
    90/Round
    900/Turn
    4500/Hour (ingame, not real)
    108000/Day (ingame, not real)
    39420000/Year (ingame, not real)
    Many thanks for this useful piece of information! But I am still struggling to fully understand it. I don't get the "Else if" when the the globaltimer is not expired. What is resetting the "Setglobal" actually?

    EDIT: ah wait. This is continually setting the global variable to the same value for every tick in the game?
  • Earnest_ernestEarnest_ernest Member Posts: 40
    Moreover, Does this work with a started game?
  • kjeronkjeron Member Posts: 2,368

    Many thanks for this useful piece of information! But I am still struggling to fully understand it. I don't get the "Else if" when the the globaltimer is not expired. What is resetting the "Setglobal" actually?

    EDIT: ah wait. This is continually setting the global variable to the same value for every tick in the game?

    The two blocks will only ever return true once each, if it set the value continuously nothing else in the script would ever trigger.

    It only sets the timer once, "!GloberTimerNotExpired" is a double negative, it triggers if the timer isn't set, or if its expired,
    You could just as well use Global("GMTIMER","GLOBAL",0) for the second trigger, I was just lazy with a copy/paste.

    The timer is set to an exact gametime, independent of when it is set, so it will work on existing games as well as new ones.
    That also means if you load an existing game that has gone past that gametime, it will GameOver immediately.
  • Earnest_ernestEarnest_ernest Member Posts: 40
    kjeron said:

    Many thanks for this useful piece of information! But I am still struggling to fully understand it. I don't get the "Else if" when the the globaltimer is not expired. What is resetting the "Setglobal" actually?

    EDIT: ah wait. This is continually setting the global variable to the same value for every tick in the game?

    The two blocks will only ever return true once each, if it set the value continuously nothing else in the script would ever trigger.

    It only sets the timer once, "!GloberTimerNotExpired" is a double negative, it triggers if the timer isn't set, or if its expired,
    You could just as well use Global("GMTIMER","GLOBAL",0) for the second trigger, I was just lazy with a copy/paste.

    The timer is set to an exact gametime, independent of when it is set, so it will work on existing games as well as new ones.
    That also means if you load an existing game that has gone past that gametime, it will GameOver immediately.
    Superb! I was just reading about that trigger. And now I almost completely understood it! Thank YOU :smile:
    <div class="Quote">GlobalTimerExpired(S:Name*,S:Area*)
    Returns true if the timer with the name specified and of the type in the second parameter has expired or if the timer has not been set.</div>
    
    This confuses me a bit because it says this returns true if also the times has not been set, just the same as the GlobalTimerNotExpired(S:Name*,S:Area*) when it says if it has never been set :

    <div class="Quote">Note that if we use !GlobalTimerNotExpired(S:Name*,S:Area*) this will return true if the timer <b class="Bold">has never been set</b> OR if it has already expired</div>

    Anyway, there is no need to answer to this if you dont want, since the solution is already served
  • Earnest_ernestEarnest_ernest Member Posts: 40
    edited March 2017
    I was just reading about the trigger! Thanks, Now I fully understood it. Well, almost. But there is no need to reply to it since the solution is already served.

    But if you want to know, Both "!GlobalTimerNotExpired(S:Name*,S:Area*) " and GlobalTimerExpired say that they will return true if the timer has not been set. That puzzles me since one is just the opposite of the other, so why not use globaltimerexpired; still it wouldn't make sense since you are using it on the first trigger, so using it again in the second trigger to evaluate if the timer has not been set doesnt seem logical, but don't know why exactly.

  • Earnest_ernestEarnest_ernest Member Posts: 40
    Just edited a strref with a useless dialog(about korean translation whatsoever) to be put at the gameover pop up for timelimit condition

    xD
  • Earnest_ernestEarnest_ernest Member Posts: 40
    I also edited the Create party message at the bottom to warn the player :wink:




Sign In or Register to comment.