id Tech Forums

id Tech 4 (Doom3/Prey/Q4) => id Tech 4 Mod Coding => Topic started by: nategherkin on October 27, 2015, 12:43:05 AM

Title: Giving the player weapons after certain amount of kills. And modify frag limit.
Post by: nategherkin on October 27, 2015, 12:43:05 AM
I'm trying to figure out how to give a player a weapon after they reach a certain amount of kills. And once the custom frag limit has been reached, the game is done.

After looking at the source code, I found 2 Give functions that seem to give the player the weapons (in Player.cpp),

This give:
     bool idInventory::Give( idPlayer *owner, const idDict &spawnArgs, const char *statname, const char *value, int *idealWeapon, bool updateHud, bool dropped, bool checkOnly )

and
     bool idPlayer::Give( const char *statname, const char *value, bool dropped )

And I also found fragCount in MultiplayerGame.cpp, but I'm not sure that this is even the variable used to count kills.

Questions
*How do I use the fragCount variable when it's in a different cpp file and it's a typedef struct? I tried #include "MultiPlayer.h" which gave me a plethora of errors.
*Once I figure that I out, what parameters should I be passing? The first Give makes more sense since there is a pointer to the player, but there are other parameters I am not sure about.
*Lastly, is there a way to modify the frag limit without user input? The default is 10 but I want to change it to a higher number.

Thanks.
Title: Re: Giving the player weapons after certain amount of kills. And modify frag limit.
Post by: motorsep on October 27, 2015, 07:53:21 PM
Ideally, you need to implement monsters killed counter (unless already implemented) and expose it to script. The rest is easy.