Page 1 of 1
A way to give people lives in Survival through ACS
Posted: Fri Oct 05, 2012 5:27 pm
by Ivan
Does one such way exist? Would be very handy.
RE: A way to give people lives in Survival through ACS
Posted: Fri Oct 05, 2012 6:14 pm
by Llewellyn
No. (Unless something has been implemented very recently.)
Your choices are to:
Create a hack of Cooperative Gamemode that allows you to select which players can play and which cannot with scripts
Use Survival gamemode with a high number of lives, and basically when you want someone to stop playing force-spec them.
RE: A way to give people lives in Survival through ACS
Posted: Fri Oct 05, 2012 6:31 pm
by Torr Samaho
No, but we can discuss adding an ACS function for this.
RE: A way to give people lives in Survival through ACS
Posted: Fri Oct 05, 2012 6:40 pm
by Ivan
I've made a tracker request for this.
RE: A way to give people lives in Survival through ACS
Posted: Fri Oct 05, 2012 6:56 pm
by Torr Samaho
Ok, then let's discuss the technicalities in there.
RE: A way to give people lives in Survival through ACS
Posted: Fri Oct 05, 2012 7:01 pm
by Ænima
I haven't seen the source but I'd imagine that making lives manipulatable via ACS shouldn't be too difficult. I mean lives already have their own hardcoded variable (which is changed via sv_maxlives), right?
RE: A way to give people lives in Survival through ACS
Posted: Fri Oct 05, 2012 7:30 pm
by Theshooter7
Looks easy enough, from my quick browse of the source. Just make the ACS function call PLAYER_SetLivesLeft() with a pointer to the desired player, and add one (and in fact, this is how the Survival/LMS code seems to handle it, when queuing the player for respawn). I'd suggest the ACS command use a player ID to obtain which player. So, it'd look like this:
Code: Select all
SetPlayerLives(int playernum, int lives);
Alternatively, we could extend it into SetPlayerProperty(), but that might conflict with any future ZDoom changes, so I don't know what your call on that would be.
The good news, is it looks like PLAYER_SetLivesLeft() handles all the c/s interaction related to it automatically, so at least there won't be extra work in that regard.
Ænima wrote:
I haven't seen the source but I'd imagine that making lives manipulatable via ACS shouldn't be too difficult. I mean lives already have their own hardcoded variable (which is changed via sv_maxlives), right?
Just for some information, sv_maxlives is only used when setting up the game (initializing the game rules etc.). Actively altering the current lives of a player requires changing the variable stored in the player class. Interestingly, this means one could add lives to players that go over the set value for sv_maxlives. I suppose one might want to make sure that any changes in lives through ACS does not go over the server variable maximum (a simple comparison when calling PLAYER_SetLivesLeft()), but that's a dev's decision of course. :)
RE: A way to give people lives in Survival through ACS
Posted: Fri Oct 05, 2012 7:47 pm
by Llewellyn
Theshooter7 wrote:
Code: Select all
SetPlayerLives(int playernum, int lives);
I would rather have it as an ActorProperty myself... to be accessed with GetActorProperty/SetActorProperty, with your current implementation how do you count how many lives you have left? (Also you could give actors lives and set them etc.)
RE: A way to give people lives in Survival through ACS
Posted: Fri Oct 05, 2012 8:05 pm
by Ivan
Well my suggestion was to have functions retrieve life values and let you set them as well so really, once you have one of them you should get the other to have better usage.