Keeping weapons in deathmatch?
Keeping weapons in deathmatch?
Is there any way to force the behavior of sv_keepweapons in a deathmatch game so that players keep their weapons after dying? (like in coop)
It's because I'm making a mod where players must buy their weapons like in WolfTeam or Combat Arms.
I'd prefer to not have to make ACS arrays for every weapon to store whether a player has purchased a certain weapon. There has to be a simpler way.
It's because I'm making a mod where players must buy their weapons like in WolfTeam or Combat Arms.
I'd prefer to not have to make ACS arrays for every weapon to store whether a player has purchased a certain weapon. There has to be a simpler way.
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !
ZandroSkins: a pack made by our community
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !
ZandroSkins: a pack made by our community
-
- Forum Regular
- Posts: 262
- Joined: Wed Jun 06, 2012 2:15 am
RE: Keeping weapons in deathmatch?
Other than ACS or co-op mode hacks, no there isn't. :/ If Zandronum supports the RESPAWN script type you might be able to make something work with that, but you'll still be using ACS one way or another.
RE: Keeping weapons in deathmatch?
Yeah I figured i'd have to use a RESPAWN script with something like
... for every weapon. :/
Code: Select all
if (HasSaiga[playernumber()] ==1)
GiveInventory("Saiga",1);
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !
ZandroSkins: a pack made by our community
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !
ZandroSkins: a pack made by our community
-
- Forum Regular
- Posts: 262
- Joined: Wed Jun 06, 2012 2:15 am
RE: Keeping weapons in deathmatch?
Ew, you don't need 1000 arrays just for that! You can use a 2D array like so:
For ammo and such, you can do a for loop through the ammo values of the second bracket, and just give whatever was there (assuming you are storing ammo, as giving 0 ammo doesn't give the player any ammo now does it? :V)
Code: Select all
int Equipment[32][NUM_WEAPONS_AMMO_ETC];
...
#define WEAP_SAIGA 0
...
if(Equipment[PlayerNumber()][WEAP_SAIGA] >= 1)
GiveInventory("Saiga",1);
...
etc.
Last edited by Theshooter7 on Thu Jun 14, 2012 3:40 pm, edited 1 time in total.
RE: Keeping weapons in deathmatch?
Oh yeahhhh. A matrix. I forgot about those.
I also tried using string arrays, but for some reason, trying to use them with CheckWeapon and SetWeapon doesn't work.
I also tried using string arrays, but for some reason, trying to use them with CheckWeapon and SetWeapon doesn't work.
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !
ZandroSkins: a pack made by our community
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !
ZandroSkins: a pack made by our community
-
- Forum Regular
- Posts: 262
- Joined: Wed Jun 06, 2012 2:15 am
RE: Keeping weapons in deathmatch?
Because that counts as dynamic string usage, I believe. Don't quote me on that, however.Ænima wrote:I also tried using string arrays, but for some reason, trying to use them with CheckWeapon and SetWeapon doesn't work.
RE: Keeping weapons in deathmatch?
Code: Select all
if(hasSSG) GiveInventory("SuperShotgun", 1); //I don't like this :(
There is no need for 1000 if checks. Here is a simplified version of the code above:
Code: Select all
GiveInventory("SuperShotgun", hasSSG);
Code: Select all
#define NUM_WEPS 3
int weps[2][NUM_WEPS] =
{
{"Shotgun", "SuperShotgun", "Chaingun"}, //Strings are defined as integers in ACS
{1, 0, 1}
};
script 999 RESPAWN
{
for(int i = 0; i < NUM_WEPS; i++) GiveInventory(weps[1,i], weps[2,i]);
}
Last edited by Konda on Sat Jun 16, 2012 11:43 am, edited 1 time in total.
Code: Select all
<Synert> fuck
<Synert> plugged in my memory stick and got a bsod
-
- Frequent Poster Miles card holder
- Posts: 901
- Joined: Mon Jun 04, 2012 5:07 am
RE: Keeping weapons in deathmatch?
Crap shit out time goooo
Edit: Basically, what it does is, on ENTER and DEATH, it'll save the amount of weapons and ammo you have for WEAPONS and AMMO (through saveWeapons) into a 2D array specificall for storing those values, and when you respawn, it'll load those values from the 2D array and give you weapons and ammo based off the values it pulls out.
I'm not very good at explaining code in English. Look at saveWeapons and loadWeapons, that's where everything happens.
Edit2: Added a little extra - it saves the weapon you're holding, if it's in WEAPONS. loadWeapons will SetWeapon to that weapon - it should be trivial to add an argument that controls that behaviour.
Edit: Basically, what it does is, on ENTER and DEATH, it'll save the amount of weapons and ammo you have for WEAPONS and AMMO (through saveWeapons) into a 2D array specificall for storing those values, and when you respawn, it'll load those values from the 2D array and give you weapons and ammo based off the values it pulls out.
I'm not very good at explaining code in English. Look at saveWeapons and loadWeapons, that's where everything happens.
Spoiler: DA SAUCE (Open)Completely untested, by the way. (edit: okay, cursory testing done)
Edit2: Added a little extra - it saves the weapon you're holding, if it's in WEAPONS. loadWeapons will SetWeapon to that weapon - it should be trivial to add an argument that controls that behaviour.
Last edited by Ijon Tichy on Mon Jun 18, 2012 12:33 pm, edited 1 time in total.
RE: Keeping weapons in deathmatch?
Wow, that's a good idea. I wouldn't have thought of doing it that way.
Mind if I test that code and possibly use it if it works?
Edit: Does Zandronum support named scripts? I know GZDoom does.
Mind if I test that code and possibly use it if it works?
Edit: Does Zandronum support named scripts? I know GZDoom does.
Last edited by Ænima on Mon Jun 18, 2012 1:12 pm, edited 1 time in total.
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !
ZandroSkins: a pack made by our community
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !
ZandroSkins: a pack made by our community
-
- Frequent Poster Miles card holder
- Posts: 901
- Joined: Mon Jun 04, 2012 5:07 am
RE: Keeping weapons in deathmatch?
Doesn't support named scripts yet.
also do whatever the hell you want with it
also do whatever the hell you want with it