Jump to content
The Dark Mod Forums

Recommended Posts

Posted

There are two ways to override cvars in a mission:

  • mission.cfg file can set non-archived cvars (starting with 2.12).
  • sys.setcvar in game script can override cvars (starting with 2.13 / dev17044-10746).

Of course, there has never been any effort to classify cvars into public and private, no thinking of backwards compatibility of relying on cvars, etc. So overriding cvars should be considered a last resort feature.


mission.cfg allows to statically override cvars on FM level.
The change takes effect during all missions in a campaign and all briefings/debriefings/menus.
However, you cannot adjust cvar value during gameplay, so only one constant literal value can be set.

The implementation is simple:

  • mission.cfg file is executed from your mission when TDM engine starts
  • all non-archived cvars are reset to their defaults when TDM engine restarts (due to FM change)


sys.setcvar allows to override cvars on gameplay level.
These overrides behave like the variables in game scripts, i.e. they are saved/restored to savefile and reset on game start/end.
You can adjust the same cvar several times with different values, and savefile will capture the override that is currently active.
The minor downside is that these overrides automatically don't carry over between missions in campaign, and they cannot work in briefings/debriefings/menus.

Note that sys.setcvar has been available for a long time already, but previously it had different meaning.
Previously it set the cvar as if the player set it himself. So the values stuck between restarts, missions, FMs (even saved to darkmod.cfg for archived cvar). Now it always sets the "mission override" for cvar.

You can test cvar mission overrides manually using two new console commands:

  • setm {cvarname} {newvalue} --- set mission override for the cvar with given value
  • unsetm {cvarname} --- drop mission override for the cvar

It is not perfectly obvious what should happen if mission-overridden cvar is changed by user.
Right now the main value of cvar is changed and mission override is broken/erased in this case.
So be wary that user can mess with your overrides just like you can mess with his cvars.

See also: 5453

  • Like 1
Posted

The remaining questions from my side:

  • Do we need the ability to override cvars during briefings/debriefings/menus?
  • Do we need sys.unsetcvar script event which works like unsetm console command?
Posted
49 minutes ago, stgatilov said:

Do we need the ability to override cvars during briefings/debriefings/menus?

I would like to know in what cases this could be useful, considering how (I think) limited briefings/debriefings currently are.

But maybe you don't know either.

Posted
25 minutes ago, datiswous said:

I would like to know in what cases this could be useful, considering how (I think) limited briefings/debriefings currently are.

Yes, I'm asking because I'd like to know that too 😀

Posted

Perhaps my imagination is failing me but the only use-case I see for GUI provoked cvar changes at the mission level are for something like Heart of Lone Salvation where players can choose “difficulty levels” that also impact performance. Still, lod_bias seems to be a better way to toggle such differences. Perhaps we need to create new lod_bias entity args like:

“lod_bias_cvar” “r_something, 1”

which change the specified cvars based on lod_bias min / max behavior

 

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Posted
3 hours ago, nbohr1more said:

Perhaps my imagination is failing me but the only use-case I see for GUI provoked cvar changes at the mission level are for something like Heart of Lone Salvation where players can choose “difficulty levels” that also impact performance.

This can't be done with mission.cfg anyway.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Ansome

      I'm back! Happy new years, TDM folks!
      I brought with me a quick update for my first FM that fixes up a lot of small issues that didn't get caught in beta testing. I didn't exactly expect it to take me nearly 9 months to release a patch, but it's been a wild year to say the least. Teaching, finishing up my Master's of Education, and all manner of other events forced me to drop out of the anniversary FM contest and ate up all my time, but I'm back again in a comfortable position to start catching up on all the new FMs. I may even start work on another spooky project of greater length and difficulty in the coming year.
      Thanks again for the warm welcome to the community and have a happy new year!
      · 3 replies
    • JackFarmer

      I got myself the apple tv trial subscription. I have to say, “Foundation” (season 1) is very exciting. Shall I read the books as well?
      · 2 replies
    • datiswous

      One more like..
       

      · 3 replies
    • snatcher

      TDM Modpack v4.6 released!
      Introducing... the Forward Lantern mod.
      · 0 replies
    • JackFarmer

      Where is the "Game Connection" element in the Linux version of DR? I could swear, I saw that in an older build (which I conveniently deleted a few days ago).
      · 5 replies
×
×
  • Create New...