Forum Thread
  Posts  
[iDTech4][Quake 4] Giving the player weapons after certain amount of kills. And modify frag limit. (Forums : Coding & Scripting : [iDTech4][Quake 4] Giving the player weapons after certain amount of kills. And modify frag limit.) Locked
Thread Options
Oct 27 2015 Anchor

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.

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.