[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Maintenance is complete! We got more disk space.
Become a Patron!

/vr/ - Retro Games


View post   

[ Toggle deleted replies ]
>> No.1299775 [View]
File: 16 KB, 325x325, Peering2.png [View same] [iqdb] [saucenao] [google] [report]


To put it very very very simply, cvars are basically numbers registered into the player's .ini file detailing the exact nature of their personal settings--and each setting all comes down to a number. It can be as simple as sv_nojump 1, which disables jumping, or dmflags3 16 which allows friendly players to pass through each other.
Think of it as your own personal board of switches where you can enable or disable options as you please.

They've actually been in ever since the console was introduced to ZDWhatever, but only recently did ZDoom give modders the ability to make their own. With Zandronum, though, cvars can only be manipulated and adjusted through ACS, thanks to ConsoleCommand.
Making your own cvar is easy enough, as it's just basically one simple script:

script 550 OPEN { if (!GetCVar("my_cvar")) { ConsoleCommand("set my_cvar 0"); ConsoleCommand("archivecvar my_cvar"); }

What this does is when the level opens (OPEN), it checks to see if the cvar exist (!GetCvar), and if not it creates it (set metroid_noaircontrol) and then saves it in the player's .ini (archivecvar metroid_noaircontrol).

From there, the server can adjust and set the number of the cvar to whatever they want in the server's console. Determining behavior based off the cvar's setting, however, is up to what the modder wants to do in ACS.
Consider this simple script:

script 551 ENTER { if (GetCVar("my_cvar") == 1) { GiveInventory("SuperShotgun",1); SetWeapon("SuperShotgun"); }

This is a (very primitive) recreation of Zandronum's Buckshot mode, as whenever the player first enters the map (ENTER), it checks to see if my_cvar is set (GetCvar == 1), and if so it does a simple GiveInventory to give them the SSG right from the start and then sets it to their active weapon.

View posts [+24] [+48] [+96]