Player death post effects
Moderator: InsideQC Admins
17 posts
• Page 1 of 2 • 1, 2
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.
-

Chip - Posts: 575
- Joined: Wed Jan 21, 2009 9:12 am
- Location: Dublin, Ireland
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();};
BUT in a second thought, if you are using Darkplaces, I suspect this would be better handled by CSQC.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
By mentioning slowmo, I really really hope you're making a single-player mod.
In which case you can be lame and cvar_set it directly.
And if you're not, then you're probably breaking stuff anyway.
Regarding the black-and-white effect cvar, you should stuffcmd that (see frag.machine's post).
In which case you can be lame and cvar_set it directly.
And if you're not, then you're probably breaking stuff anyway.
Regarding the black-and-white effect cvar, you should stuffcmd that (see frag.machine's post).
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
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.
-

Chip - Posts: 575
- Joined: Wed Jan 21, 2009 9:12 am
- Location: Dublin, Ireland
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.
Found any problem ? Care to post your version ? I haven't actually tried this code, so I'd like to know what you changed.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
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");
}
That's it. And then reset it after PlayerDead().
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.
-

Chip - Posts: 575
- Joined: Wed Jan 21, 2009 9:12 am
- Location: Dublin, Ireland
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;
but its not working...whats my fault?
-

skite2001 - Posts: 17
- Joined: Mon Nov 17, 2008 5:40 pm
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");
}
It acts the same as if the user pressed the enter button.
-

Arkage - Posts: 66
- Joined: Thu Nov 19, 2009 4:17 pm
skite2001 wrote:hmm, added:
- Code: Select all
void() PlayerDie =
{
local float ms;
ms = cvar("slowmo");
if(ms == 0) {
stuffcmd(self, "slowmo 0.1");
}
local float i;
but its not working...whats my fault?
Try adding only stuffcmd(self, "slowmo 0.1"); right before 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.
-

Chip - Posts: 575
- Joined: Wed Jan 21, 2009 9:12 am
- Location: Dublin, Ireland
skite2001 wrote:right, only:stuffcmd(self, "slowmo 0.1\n");
and resetting at PlayerDead Function viastuffcmd(self, "slowmo 1\n");
worked like a charm in darkplaces
now looking which more effects could be added ^^
1. motion blur
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.
-

Chip - Posts: 575
- Joined: Wed Jan 21, 2009 9:12 am
- Location: Dublin, Ireland
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.
- GiffE
- Posts: 170
- Joined: Sun Oct 08, 2006 3:39 pm
- Location: USA, CT
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.
I know that. Any idea for contrast? DP-only? Any idea for any screen effect like sepia, blue tint, green tint?
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.
-

Chip - Posts: 575
- Joined: Wed Jan 21, 2009 9:12 am
- Location: Dublin, Ireland
17 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest