Git Repos / fte_dogmode / qc / triggers / counter.qc
Last update to this file was on 2024-06-15 at 19:50.
Show counter.qc
//==============================================================================
// trigger_counter
//==============================================================================
//======================================================================
// constants
//======================================================================
#ifdef SSQC
const float TRIGGER_COUNTER_NOMESSAGE = 1;
#endif
//======================================================================
// forward declarations
//======================================================================
#ifdef SSQC
// trigger_counter
void() trigger_counter_use;
void(entity e) trigger_counter_init;
void() trigger_counter;
#endif
//------------------------------------------------------------------------------
#ifdef SSQC
/*QUAKED trigger_counter (.5 .5 .5) ? nomessage X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Acts as an intermediary for an action that takes multiple inputs.
If nomessage is not set, t will print "1 more.. " etc when triggered and "sequence complete" when finished.
After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself.
*/
//----------------------------------------------------------------------
// class trigger_counter: base_multiple
// {
//--------------------------------------------------------------
void() trigger_counter_use =
{
if (self.estate != STATE_ACTIVE)
return;
self.count -= 1;
if (self.count < 0)
return;
if (self.count != 0)
{
if (activator.classtype == CT_PLAYER &&
(self.spawnflags &
TRIGGER_COUNTER_NOMESSAGE) == 0)
{
if (self.count >= 4)
centerprint (activator,
"There are more to go...");
else if (self.count == 3)
centerprint (activator,
"Only 3 more to go...");
else if (self.count == 2)
centerprint (activator,
"Only 2 more to go...");
else
centerprint (activator,
"Only 1 more to go...");
}
return;
}
if (activator.classtype == CT_PLAYER &&
(self.spawnflags & TRIGGER_COUNTER_NOMESSAGE) == 0)
{
centerprint (activator, "Sequence completed!");
}
self.enemy = activator;
base_multiple_fire ();
};
//--------------------------------------------------------------
void(entity e) trigger_counter_init =
{
e.classname = "trigger_counter";
e.classtype = CT_TRIGGER_COUNTER;
e.wait = -1;
if (!e.count)
e.count = 2;
e.use = trigger_counter_use;
// might need to be base_mapentity_init -- CEV
base_trigger_init (e);
};
//--------------------------------------------------------------
void() trigger_counter =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;
trigger_counter_init (self);
};
// };
#endif
Return to the top of this page or return to the overview of this repo.
Log counter.qc
Date | Commit Message | Author | + | - |
---|---|---|---|---|
2024-06-15 | Major update, committing as-is, will have bugs | cev | +7 | |
2024-03-24 | 2nd pass refactor, rework QC class structure | cev | +45 | -20 |
2024-01-09 | Continue OO / Class-based refactor | cev | +8 | -9 |
2023-12-09 | Start OO / class-based refactor, work on items | cev | +57 | -45 |
2023-11-20 | changes to movement, build environment, file reorg | cev | +63 |
Return to the top of this page or return to the overview of this repo.