Saving players state in co-op

Discuss all aspects related to modding Zandronum here.
Post Reply
R.Alex
New User
Posts: 6
Joined: Fri Dec 14, 2012 2:29 pm

Saving players state in co-op

#1

Post by R.Alex » Mon Dec 17, 2012 4:37 pm

Hi everybody,

I open this subject in this section of the forum, because it seems to be no "no-script" way of doing what i want. This is the continuation of this one : http://zandronum.com/forum/showthread.php?tid=1754

My situation is :
- I want to set up a coop private server, where I will only play with a few friends.
- The server will be up permanently, and players can connect at the time they want, not only when everybody is here.

The problem is that now, when a players disconnect and then come back, he lost all his stuff (weapons, ammo, armor). And starting in the late levels of some wads is quite hard with only the pistol.

What I would like to do is that, when a player disconnect from the server, the server saves his stuff informations, and when the player comes back, the server gives him that stuff back.

I am totally new to ACS scripting, and have no idea how to do it. I've looked around the wiki and found the following actions which seems interesting, but I can't put it all together :
- checkInventory which return the stuff of a player
- giveInventory which give player some stuff

But how can I refer to a player, and how can I save informations relatives to this player ?

Thank you by advance.

Jigsaw
Forum Regular
Posts: 180
Joined: Sun Jun 24, 2012 9:43 am

RE: Saving players state in co-op

#2

Post by Jigsaw » Mon Dec 17, 2012 5:32 pm

Well it needs to be done through auto-editing the CFG file through the wad like Zombie Horde did with achievements, but using this for weapons, ammo and health would make everyone end up cheating by modifying their CFG to full armor, health, weapons & ammo, and it's not detectable at all by the server, because it's not really count as a cheat AFAIK. Data for specific players can't be stored on servers, only clientside, but as I've said that's exploitable and also not very easy to implement. But if it's a private server for your friends only, you might as well just enable sv_cheats 1 on the server and tell them to use it ONLY for getting their stuff back. If they are your friends, they must be trustworthy enough for this.

one_Two
Addicted to Zandronum
Posts: 1753
Joined: Thu Jun 07, 2012 4:47 pm

RE: Saving players state in co-op

#3

Post by one_Two » Mon Dec 17, 2012 5:39 pm

Jigsaw wrote: Well it needs to be done through auto-editing the CFG file through the wad like Zombie Horde did with achievements, but using this for weapons, ammo and health would make everyone end up cheating by modifying their CFG to full armor, health, weapons & ammo, and it's not detectable at all by the server, because it's not really count as a cheat AFAIK. Data for specific players can't be stored on servers, only clientside, but as I've said that's exploitable and also not very easy to implement. But if it's a private server for your friends only, you might as well just enable sv_cheats 1 on the server and tell them to use it ONLY for getting their stuff back. If they are your friends, they must be trustworthy enough for this.
If I'm not mistaken in the original thread he suggested he would be using this with people he trusted/knew who wouldn't cheat (might be wrong?). I have been trying things with strings but as people know acs doesn't handle strings that well - I'll give it a better go tomorow. There is String copy - http://zdoom.org/wiki/StrCpy but I'm not sure how to get it to work with the player name - http://zdoom.org/wiki/User_variable

R.Alex
New User
Posts: 6
Joined: Fri Dec 14, 2012 2:29 pm

RE: Saving players state in co-op

#4

Post by R.Alex » Mon Dec 17, 2012 7:37 pm

Yep, I can trust the people I play with, but I would like to automate the thing, avoiding them to use cheat eache time they connect.

Besides, I find this more """realistic""" than just IDDQD and wouhou ! :razz:

Llewellyn
Forum Regular
Posts: 578
Joined: Mon Jul 02, 2012 7:12 am

RE: Saving players state in co-op

#5

Post by Llewellyn » Mon Dec 17, 2012 10:49 pm

one_Two wrote: If I'm not mistaken in the original thread he suggested he would be using this with people he trusted/knew who wouldn't cheat (might be wrong?). I have been trying things with strings but as people know acs doesn't handle strings that well - I'll give it a better go tomorow. There is String copy - http://zdoom.org/wiki/StrCpy but I'm not sure how to get it to work with the player name - http://zdoom.org/wiki/User_variable
Okay what you need to do is make a convar named like "coolguy_number" you give each player a unique coolguy_number by storing convar "current_coolguy_number" then when someone joins with coolguy_number of 0 you get a new coolguy_number and add one to the current_coolguy_number variable. Then you store c_<coolguyNumber> as a convar on the server. The server stores information about the character using a bitfield or something similar like that. The only way someone could cheat is by copying someone else's coolguy_number or resetting their character to blank by deleting theirs, they cannot give themself 600 cells and a bfg.

This setup is perfectly legit, and uses no cheats etc, is completely automated and does not require any user input. In fact, the user may not ever realize this is going on (silent) if they do not decompile the ACS or look in their INI for suspicious variables.
Last edited by Llewellyn on Mon Dec 17, 2012 10:51 pm, edited 1 time in total.

Synert
Forum Regular
Posts: 228
Joined: Mon Jun 04, 2012 12:54 pm
Contact:

RE: Saving players state in co-op

#6

Post by Synert » Mon Dec 17, 2012 10:52 pm

one_Two wrote: There is String copy - http://zdoom.org/wiki/StrCpy but I'm not sure how to get it to work with the player name - http://zdoom.org/wiki/User_variable
I've managed to store player names before using a method pretty similar to ijon's stralloc lib, you could give that a try.

Post Reply