Firstly, my programming skills in C++ are very basic! Though I am keen to learn, so im not demanding someone solves the solution for me (unless you want to or know how to
Basically I have followed the tutorial on Interlopers to make the Flashlight require batteries. I basically want to take this a bit further and make the flashlight disabled until a Flashlight model is found and picked up in the level.
At the bottom of the tutorial it said about using point_servercommands, which work as the player cannot use the flashlight, however it is still visible in the HUD, I wish to make this hidden until Flashlight model is picked up.
I have managed to code the "item_flashlight" based on the "item_flashbattery" however I become stumped when I need the new function to display the Flashlight in the HUD.
To begin with I have added a boolean to "hud_flashlight.cpp" which is defined just under the includes, which makes it global?
- Code: Select all
extern bool flash_pickup = false;
This boolen "flash_pickup" starts as false, and an IF statement is added to all functions regarding Hud display for the flashlight mainly the Paint function. So basically when I run my mod the Flashlight doesn't appear in the HUD as the boolean is set to false and the point_servercommand disables the Flashlight sound and the flashlighteffect.
I am having trouble in setting my function to switch the variable to True and then executing the function to draw the Flashlight on the HUD.
My flashlight function is contained in hl2_player.cpp in the Server files and my boolean and Paint function is located in hud_flashlight.cpp as part of the Client files.
Is there a way to call a function from a different project in the same solution?
I have tried google search, but with my limited experience some help that is based around the source engine and files would be beneficial.
Apologies for the long post. Any help greatly appreciated.
SJPiglet

