by Spike » Fri Jul 09, 2010 12:18 pm
or you could use:
writebyte(MSG_ONE, svc_setstat);
writebyte(MSG_ONE, 31);
writelong(MSG_ONE, self.morphactive);
in your mod whenever you want to activate/deactivate it
and read cl.stats[31] in your hud code (it is of course a 32bit int).
cl.stats[31] is automatically cleared to 0 on each map change.
warning: sbar will not update on saved games - if a field named 'float _foo;' is initialised to 1 in worldspawn, then any time it changes to 0, resend the stat and reset to 1.
I don't remember the value of svc_setstat, consult your engine's protocol.h file.
regular quake uses about 16 stats, but has space for 32. The lower ones are replicated automatically in a really stupid and limited way, but the ones that are not replicated can be set to whatever values you want by your qc code. Note that you can also increase the max stats to give you more fields.
mods like rocket arena didn't have a choice - they weren't engine mods and didn't depend upon any.
.