Hi! Portal 2 VScript - Variables

Avatar
Alby87
2 Posts
Posted Jul 11, 2012
Hi! I've put this question on Steam Forum, but I didn't get any reply.

'm relatively new to modding the source engine, and I was wondering if I can "save and load" variables within .nut files: I want to store an integer, and retrieve it after I not only change the map, but also when I close and open the game.

If I can't save it to a files, can I at least create and use a ConVar?

Thank you in advance

(I'm asking because in the documentation wiki, the variables section of L4D2 (where I read about vscript) vscript is in "TODO ")

Advertisement
Registered users don’t see ads! Register now!
Avatar
FelixGriffin
2,680 Posts
Posted Jul 11, 2012
Replied 1 hour later
Unfortunately, you can't create a ConVar without the original source of the game (which only Valve has), and I don't think you can save and load a variable like that. Try looking at the "counter" feature in an env_global entity.
Avatar
ChickenMobile
2,460 Posts
Posted Jul 11, 2012
Replied 46 minutes later
You cannot store variables without writing to a file. There is no way Valve would let us write to a file through actions in hammer; this is probably unsafe. The only thing I know of that can write to a file within source (no game code) is config.cfg and it will only store client cvars.
Even if you could store your data to a client console parameter, you won't be able to read it.

Also: mapping-help/capturing-the-state-of-a-map-and-reverting-t5918.html

Advertisement
Registered users don’t see ads! Register now!
Avatar
Alby87
2 Posts
Posted Jul 11, 2012
Replied 5 minutes later
Ok, thank you :biggrin: For replies and link :smile: