ZDaemon Forum Index ZDaemon
Client/Server DOOM
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Custom Cvars

 
Post new topic   Reply to topic    ZDaemon Forum Index -> Wad Editing
View previous topic :: View next topic  
Author Message
Zedek
has entered the game!


Joined: 10 Mar 2013
Location: Tijuana, México

PostPosted: Mon Jun 10, 2013 3:57 am    Post subject: Custom Cvars Reply with quote

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? Sad
Back to top
View user's profile Send private message
Sr69Mm-jC
Unstoppable!


Joined: 21 Jul 2011

PostPosted: Mon Jun 10, 2013 7:55 am    Post subject: Reply with quote

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
View user's profile Send private message
Ch0wW
Dominating!


Joined: 05 Feb 2013
Location: France

PostPosted: Mon Jun 10, 2013 2:10 pm    Post subject: Reply with quote

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:
Code:
set cvar_doom 1


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
View user's profile Send private message Visit poster's website
Sr69Mm-jC
Unstoppable!


Joined: 21 Jul 2011

PostPosted: Mon Jun 10, 2013 2:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
Zedek
has entered the game!


Joined: 10 Mar 2013
Location: Tijuana, México

PostPosted: Mon Jun 10, 2013 10:13 pm    Post subject: Reply with quote

Thank you Very Happy Sr69Mm-jC and Ch0wW for answering, i will try it.
Back to top
View user's profile Send private message
Cybershark
Spamming!


Joined: 05 Jan 2005
Location: off the grid, but still fighting for the users!

PostPosted: Tue Jun 11, 2013 1:32 am    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    ZDaemon Forum Index -> Wad Editing All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group