View previous topic :: View next topic |
Author |
Message |
Zedek has entered the game!
Joined: 10 Mar 2013 Location: Tijuana, México
|
Posted: Mon Jun 10, 2013 3:57 am Post subject: Custom Cvars |
|
|
Hello!
Well... about the custom cvars, i recently played the Choww's "Meet the vip" and before that, "Wrecker" and i noticed that the wad authors made their own cvars, for example in "Meet The vip", it have a cvar for change the time limit for exiting the map, or in wrecker, one for changing the core "health". the question is: How can i do that too? |
|
Back to top |
|
|
Sr69Mm-jC Unstoppable!
Joined: 21 Jul 2011
|
Posted: Mon Jun 10, 2013 7:55 am Post subject: |
|
|
Basically, go to console and type
Code: | set mycustomvar value |
You need to know the exact name of the cvar. Set it to whatever you want and then the ACS scripts in the wad will be able read it.
Pretty sure this can also be added to server's launch parameters. Maybe it's +set in there? I'm not an expert at that but I guess you could also just run the server and type the same command as above through the server console - until you find out how to add it to launch parameters. |
|
Back to top |
|
|
Ch0wW Dominating!
Joined: 05 Feb 2013 Location: France
|
Posted: Mon Jun 10, 2013 2:10 pm Post subject: |
|
|
To set the value from the server, indeed, you have to use "set XXX YYY" (where XXX is the CVAR name, and YYY the value):
Example:
But to use it, you have to give the CVAR an utility through ACS with the GetCVAR function:
Example:
Code: |
script 69 ENTER
{
if (GetCVAR("cvar_doom")
print(s:"This works!");
else
print(s:"You forgot to set cvar_doom to 1!");
} |
|
|
Back to top |
|
|
Sr69Mm-jC Unstoppable!
Joined: 21 Jul 2011
|
Posted: Mon Jun 10, 2013 2:18 pm Post subject: |
|
|
Speaking of the ACS code above, please keep in mind that any non-set cvar will return 0 when read through GetCvar(). There's no way to tell whether it was explicitly set to 0 on the server or it wasn't set at all. |
|
Back to top |
|
|
Zedek has entered the game!
Joined: 10 Mar 2013 Location: Tijuana, México
|
Posted: Mon Jun 10, 2013 10:13 pm Post subject: |
|
|
Thank you Sr69Mm-jC and Ch0wW for answering, i will try it. |
|
Back to top |
|
|
Cybershark Spamming!
Joined: 05 Jan 2005 Location: off the grid, but still fighting for the users!
|
Posted: Tue Jun 11, 2013 1:32 am Post subject: |
|
|
Sr69Mm-jC wrote: | Speaking of the ACS code above, please keep in mind that any non-set cvar will return 0 when read through GetCvar(). There's no way to tell whether it was explicitly set to 0 on the server or it wasn't set at all. |
Which allows you to easily set default values if a cvar is not provided |
|
Back to top |
|
|
|