hi,
can someone explain me how to use Cvar?
i want to create a Cvar and give it a value with the console and then give it to my mapscript.
like a boolean var in c++.
but i dont know how and where create cvar, and what is the command to give it a value with the console may be setstate?
thx
Cvar use
I believe this should be in the level design forum, since it involves a map script.
To create a CVAR, just use /set. To make sure it gets saved, use /seta.
i want a variable to do the same as a boolean.
so if i understand i just need to do:
/set CVAR variable_name 1
this command will create my cvar variable_name and put it to value 1
is that correct?
No, you use a wrong syntax. It’s:
/set variable_name 1
Allso not that you’d need to do
/seta variable_name 1
if you want the CVAR to be saved in your config, otherwise it might be gone at the map’s end.
BTW: Cvar’s are not boolean’s. They’re variant-typed. It can be integers, otherwise they are strings. As long as you say “the value needs to be 1 or 0” to server admins who will set this cvar, you’re fine.
ok ty very much
just one more question: if i do /set before running the map (host game menu for example), at map begining my Cvar has the good value or i must do /seta before launching my map?
Do /seta and it will be allways at the same value as you set it, don’t use /set.