Skip to content

Instantly share code, notes, and snippets.

@BenVanCitters
BenVanCitters / combat.qc
Last active January 27, 2022 19:39
quake-c area damage effect
//do constant damage to everything in a sphere centered at 'origin' and ignoring one entity
//inflictor - this is legacy quake stuff -passed on to tdamage - use as in other damage/rad damage calls
//origin - the center of the area effect
//attacker - this is legacy quake stuff -passed on to tdamage - use as in other damage/rad damage calls
//radius - radius of damage area
//damage - damage applied to all things in radius - distance from center has no effect
//ignore - this entity will get no damage from this call
void(entity inflictor, vector origin, entity attacker, float radius, float damage, entity ignore) areaDMG =
{
local entity head = findradius(origin, radius);
@BenVanCitters
BenVanCitters / client.qc
Created December 10, 2021 07:47
quake c method to print the name of the player under the crosshair in the middle of the screen - meant to be called every frame
.float wait_after_show_time; // during gameplay this is set to the time to start showing a player's name under the crosshair - .2 seconds after he is under it
.float wait_before_show_time; // during gameplay this is set to the time to stop showing a player's name no longer under the crosshair
.float cleared_name; //to avaoid spamming only send centerprint once every .5 seconds
// print the name of the player under the crosshair in the middle of the screen
// meant to be called every frame (ie in PlayerPreThink)
void() printPlayerUnderCrosshair=
{
local vector source;
local float hasInviz;
//some testing/snippets for svc_print in quakec
//msgTest1(MSG_ONE,self); - prints "hello there quakeworld!"
void(float msg_type, entity ent ) msgTest1=
{
msg_entity = ent;
WriteByte(msg_type,SVC_PRINT); // SVC_PRINT
WriteShort(msg_type,3); // '3' is the number of writestrings including args
WriteString(msg_type,"{} there {}!");
WriteString(msg_type,"hello");