Would the Playlist I mentioned Before help me with the HLSDK coding?
Why would FortressOne be easier to mod? How would I mod that?
"fallback_dir" "tfc"
in liblist.gam), but if custom maps is all you're planning on making you don't even need to make a mod for that. Just publish those maps on their own and anyone already owning TFC can play those without getting a separate game/mod for it!CVAR_SET_FLOAT
:
// Gravity will vary +/- 400
#define GRAVITY_VARIATION 400
int myRandomGravity = 800 + rand() % GRAVITY_VARIATION;
CVAR_SET_FLOAT( "sv_gravity", myRandomGravity );
But of course, there are ways to convert numbers into strings (the values in quotation marks are called "strings").battery.cpp
starts with:
//
// battery.cpp
//
// implementation of CHudBattery class
//
Implementation of CHudBattery
huh... what's that?hud.h
:
class CHudBattery : public CHudBase
{
public:
bool Init() override;
bool VidInit() override;
bool Draw(float flTime) override;
bool MsgFunc_Battery(const char* pszName, int iSize, void* pbuf);
private:
HSPRITE m_hSprite1;
HSPRITE m_hSprite2;
Rect* m_prc1;
Rect* m_prc2;
int m_iBat;
int m_iBatMax;
float m_fFade;
int m_iHeight; // width of the battery innards
};
Each of these HUD elements are C++ classes, which inherit from CHudBase
. The HUD system contains a collection of these CHudBase
based objects.Draw
functions are for. If you want to find what coordinates are used, you would simply find, for instance, CHudBattery::Draw
, like so:
bool CHudBattery::Draw(float flTime)
{
if ((gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH) != 0)
return true;
int r, g, b, x, y, a;
Rect rc;
rc = *m_prc2;
rc.top += m_iHeight * ((float)(100 - (V_min(100, m_iBat))) * 0.01); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
UnpackRGB(r, g, b, RGB_YELLOWISH);
if (!gHUD.HasSuit())
return true;
... // rest of the code
Scrolling down in the same function, we see this code:
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
x = ScreenWidth / 4;
// make sure we have the right sprite handles
if (0 == m_hSprite1)
m_hSprite1 = gHUD.GetSprite(gHUD.GetSpriteIndex("suit_empty"));
if (0 == m_hSprite2)
m_hSprite2 = gHUD.GetSprite(gHUD.GetSpriteIndex("suit_full"));
SPR_Set(m_hSprite1, r, g, b);
SPR_DrawAdditive(0, x, y - iOffset, m_prc1);
if (rc.bottom > rc.top)
{
SPR_Set(m_hSprite2, r, g, b);
SPR_DrawAdditive(0, x, y - iOffset + (rc.top - m_prc2->top), &rc);
}
This says "Hey GoldSRC, please render a sprite at these coordinates here". SPR_Set
tells the engine to use a certain sprite, and SPR_DrawAdditive
tells the engine to draw it. So, now you might be wondering what's up with these x
and y
variable things. You can declare your own temporary variables to essentially "chain" HUD elements one after another, so you don't have to manually specify every single coordinate yourself. You can use it to say "the next one will be 5 pixels more" etc.cl_weapon_wallpuff
) can be configured via featureful_server.cfg
. Up to 4 sprites can defined (wall_puff1 - wall_puff4) which allows to set sprites from Counter Strike. By default sprites/stmbal1.spr
is used as a sole wall puff sprite.game_counter_set
targeting env_global
with Modify/Set value
triggermode. Also, triggering such env_global
with 'On' or 'Toggle' use-type increments the global variable number by 1. Triggering it with 'Off' use-type decrements the number by 1.Obey Use-type
for env_global
which allows to change the global variable state accordingly to the input use-type.Act as Master
for env_global
which allows to use the global variable state as a master.trigger_compare
for comparing constant numbers and numbers associated with entities (so called Locus Ratio) and triggering different targets depending on the result of comparison.calc_state
to evaluate the state from boolean operation where the 'On' state corresponds to True and 'Off' state corresponds to False. Can be used as a master.Copy Input
and Reverse Input
trigger modes for trigger_relay
.calc_eval_number
to evaluate the math expression based on constant numbers and calc ratios of entities.game_number
for storing floating point numbers (you can still use game_counter
to store and retrieve integer values). Can be used as a storage or parameter of calc_eval_number
.trigger_check_state
to check the master entity state and trigger the target depending on the check result.env_explosion
.monster_human_assassin_dead
.set_global_state
- set the state of global variable. Available only when sv_cheats is enabled.set_global_value
- set the number value associated with global variables. Available only when sv_cheats is enabled.calc_ratio
- calculate a ratio values associated with entity and report the result to developer console.calc_state
- calculate/get the entity state and report the result to developer console.item_sodacan
to FGD.sk_zombie_soldier_dmg_both_slash1 "30"
HUD_TempEntUpdate
has a cl_gravity
parameter,pmove_t
has a gravity member,CWorld::Spawn
sets the value of sv_gravity
CWorld::Spawn
if each level is essentially randomised.