Player death post effects
Player death post effects
I've been pondering some post-death effects, and, using Darkplaces, I decided to add black-and-white effect and slow motion when player gets killed.
Darkplaces has both effects as cvars, but I don't know how to implement them when player dies.
I've seen some examples but I couldn't replicate them, so I decided to ask.
It's something like when player's health reaches 0 or less, the cvars get changed in QuakeC. The slow motion cvar is slowmo 1 (and going 0.9, 0.8, 0.7 ... to 0 - deactivated).
I guess there's a general rule, and I can set what cvar I want, but I don't know how to set a cvar in QC.
Any help would be greatly appreciated.
Darkplaces has both effects as cvars, but I don't know how to implement them when player dies.
I've seen some examples but I couldn't replicate them, so I decided to ask.
It's something like when player's health reaches 0 or less, the cvars get changed in QuakeC. The slow motion cvar is slowmo 1 (and going 0.9, 0.8, 0.7 ... to 0 - deactivated).
I guess there's a general rule, and I can set what cvar I want, but I don't know how to set a cvar in QC.
Any help would be greatly appreciated.
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
-
frag.machine
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Have you already tried something like this ?
BUT in a second thought, if you are using Darkplaces, I suspect this would be better handled by CSQC.
Code: Select all
float slowmo_val = 0.9;
void () slowmo_change =
{
stuffcmd ("slowmo ");
stuffcmd (ftos (slowmo_val));
stuffcmd ("\n");
if (slowmo_val > 0.1)
{
slowmo_val = slowmo_val - 0.1;
}
};
void () slowmo_reset =
{
slowmo_val = 1.0;
stuffcmd ("slowmo 1\n");
}
void() player_diea1 = [ $deatha1, player_diea2 ] {slowmo_change();};
void() player_diea2 = [ $deatha2, player_diea3 ] {slowmo_change();};
void() player_diea3 = [ $deatha3, player_diea4 ] {slowmo_change();};
void() player_diea4 = [ $deatha4, player_diea5 ] {slowmo_change();};
void() player_diea5 = [ $deatha5, player_diea6 ] {slowmo_change();};
void() player_diea6 = [ $deatha6, player_diea7 ] {slowmo_change();};
void() player_diea7 = [ $deatha7, player_diea8 ] {slowmo_change();};
void() player_diea8 = [ $deatha8, player_diea9 ] {slowmo_change();};
void() player_diea9 = [ $deatha9, player_diea10 ] {slowmo_change();};
void() player_diea10 = [ $deatha10, player_diea11 ] {};
void() player_diea11 = [ $deatha11, player_diea11 ] {PlayerDead();slowmo_reset();};
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
Thanks, I'll try that. Spike, yeah, it's for a single player mod.
If you ever played Jedi Knight II: Outcast you may know what I am talking about.
EDIT: Works like a charm! With some changes to stuffcmd. I'll look into CSQC to see how I can integrate this and come back.
Combined with a 3rd person switch, B/W, slow motion and (maybe) a bit of blur, it would make a hell of death effect.
If you ever played Jedi Knight II: Outcast you may know what I am talking about.
EDIT: Works like a charm! With some changes to stuffcmd. I'll look into CSQC to see how I can integrate this and come back.
Combined with a 3rd person switch, B/W, slow motion and (maybe) a bit of blur, it would make a hell of death effect.
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
-
frag.machine
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Found any problem ? Care to post your version ? I haven't actually tried this code, so I'd like to know what you changed.Chip wrote:Thanks, I'll try that. Spike, yeah, it's for a single player mod.
If you ever played Jedi Knight II: Outcast you may know what I am talking about.
EDIT: Works like a charm! With some changes to stuffcmd. I'll look into CSQC to see how I can integrate this and come back.
Combined with a 3rd person switch, B/W, slow motion and (maybe) a bit of blur, it would make a hell of death effect.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
No need for gradual motion change, so I'll just set it.
Right after PlayerDie() {
That's it. And then reset it after PlayerDead().
Right after PlayerDie() {
Code: Select all
local float ms;
ms = cvar("slowmo");
if(ms == 0) {
stuffcmd(self, "slowmo 0.1");
}QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
hmm, added:
but its not working...whats my fault?
Code: Select all
void() PlayerDie =
{
local float ms;
ms = cvar("slowmo");
if(ms == 0) {
stuffcmd(self, "slowmo 0.1");
}
local float i;You haven't added a new line ("\n" ) symbol after it.
It acts the same as if the user pressed the enter button.
Code: Select all
void() PlayerDie =
{
local float ms;
ms = cvar("slowmo");
if(ms == 0) {
stuffcmd(self, "slowmo 0.1\n");
}
Try adding only stuffcmd(self, "slowmo 0.1"); right before local float i;skite2001 wrote:hmm, added:
but its not working...whats my fault?Code: Select all
void() PlayerDie = { local float ms; ms = cvar("slowmo"); if(ms == 0) { stuffcmd(self, "slowmo 0.1"); } local float i;
I suppose you're doing this in DP.
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
1. motion blurskite2001 wrote:right, only:
and resetting at PlayerDead Function viastuffcmd(self, "slowmo 0.1\n");worked like a charm in darkplacesstuffcmd(self, "slowmo 1\n");
now looking which more effects could be added ^^
2. excessive contrast
3. b/w (?)
That's what I'm adding anyway.
Oh, and by the way, my code works without adding "\n" after "slowmo". But then again, I'll code this directly into QuakeC using cvars not stuffcmd.
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
I know that. Any idea for contrast? DP-only? Any idea for any screen effect like sepia, blue tint, green tint?GiffE wrote:black and white can be done using the same way, except with the cvar r_saturation. Fade it from 1 to 0, 0 being fully saturated/blacknwhite.
EDIT: It's actually r_glsl_saturation in DP.
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.