[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - Environmet based footsteps (simulator)

Environmet based footsteps (simulator)

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Environmet based footsteps (simulator)

Postby Nahuel » Sat Feb 05, 2011 11:35 pm

hello friends.
I created a code for a function to simulate textures for the footsteps. If you walk into the normal floor, the engine plays sounds of current footsteps. But if you walk on the functions, the engine plays sounds for each function.
This function is very useful for creating the necessary environment (for example) a horror mod. Although it is laborious for the mapping, the result is very good and atmospheric mainly because you can create several different simulators are run on the bsp of quake 1.
I tested the function in DOS quake, Qrack, Fitzquake, Winquake and some older versions of Darkplaces (the newest 2006, but I do not know which version) and it works perfectly.
But I have problems in the latest version of Darkplaces, the function does not work correctly.
I wanted someone to help me.
Here is my tutorial, I added only a single function (func metal) because it was too long with 12 functions that I use in my mod "wasste. "
I hope to get help with my code and the texture´s simulator will serve someone .
new code
normal code
Here is my tutorial
you remember that YOU NEED 4 new wavs, two for normal footsteps and 2 for the footstep of the metal texture.

you place the 4 wavs in sound/player
they are:
alk2.wav alk1.wav and (for the normal footsteps)
met.wav met1.wav (for footsteps on metal)
do not forget to precache it in world.qc

Well now creates a new file called "textures.qc"
and copy this

.float onmetal;
.float onmetal2;
.float texs;

float TX_METAL = 2; // for metal

void() vmetal =
{

if ((other.flags & FL_CLIENT)) // code for Nahuel
{
other.onmetal = TRUE;

other.texs = other.texs | TX_METAL;
}
};
void () func_metal = // code for Nahuel
{
self.mangle = self.angles;
self.angles = '0 0 0';
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
self.classname = "metal";
setmodel (self, self.model);
setorigin (self, self.origin);
self.touch = vmetal;

};


.float nextfootstep2;

void() playerfootstep = //Thanks Darksnow for this function, I modified it
{
local float r;

if (self.deadflag) // not walking dead...
return;
if (!(self.flags & FL_ONGROUND))
return;
if (self.texs & TX_METAL)
return;
if (vlen(self.velocity) < 300)
return;
if (time < self.nextfootstep2)
return;
if (!(self.flags & FL_ONGROUND))
return;


self.nextfootstep2 = time + (0.3);

r = random() * 2;
// ATTN_IDLE to make them short range
if (r < 1) sound(self, CHAN_VOICE, "player/alk1.wav", 1.0, ATTN_IDLE);
else sound(self, CHAN_VOICE, "player/alk2.wav", 1.0, ATTN_IDLE);
return;

};

void() playerfootstepl = //Thanks Darksnow for this function, I modified it
{
local float r;

if (self.deadflag) // not walking dead...
return;
if (!(self.flags & FL_ONGROUND))
return;

if (self.texs & TX_METAL)
return;
if (self.waterlevel >= 3)
return;

if (vlen(self.velocity) > 300)
return;
if (vlen(self.velocity) < 50)
return;
if (!(self.flags & FL_ONGROUND))
return;
if (self.texs & TX_METAL)
return;
if (time < self.nextfootstep2)
return;
self.nextfootstep2 = time + 0.5;

r = random() * 2;
// ATTN_IDLE to make them short range
if (r < 1) sound(self, CHAN_VOICE, "player/alk1.wav", 0.65, ATTN_IDLE);
else sound(self, CHAN_VOICE, "player/alk2.wav", 0.65, ATTN_IDLE);
return;

};



void() playerfootstepm = //Thanks Darksnow for this function, I modified it
{
local float r;

if (self.deadflag) // not walking dead...
return;
if (!(self.flags & FL_ONGROUND))
return;
if (!(self.texs & TX_METAL))
return;
if (vlen(self.velocity) < 300)
return;


if (time < self.nextfootstep2)
return;
self.nextfootstep2 = time + 0.3;

r = random() * 2;
// ATTN_IDLE to make them short range
if (r < 1) sound(self, CHAN_VOICE, "player/met.wav", 1.0, ATTN_IDLE);
else sound(self, CHAN_VOICE, "player/met1.wav", 1.0, ATTN_IDLE);
return;

};
void() playerfootstepn = //Thanks Darksnow for this function, I modified it
{
local float r;

if (self.deadflag) // not walking dead...
return;
if (!(self.flags & FL_ONGROUND))
return;
if (!(self.texs & TX_METAL))
return;
if (vlen(self.velocity) > 300)
return;
if (vlen(self.velocity) < 50)
return;


if (time < self.nextfootstep2)
return;
self.nextfootstep2 = time + 0.5;

r = random() * 2;
// ATTN_IDLE to make them short range
if (r < 1) sound(self, CHAN_VOICE, "player/met.wav", 0.65, ATTN_IDLE);
else sound(self, CHAN_VOICE, "player/met1.wav", 0.65, ATTN_IDLE);
return;

};

save and close

now in in playerprethink client.qc
above

if (time> self.attack_finished & & self.currentammo self.weapon == 0 & &! = IT_AXE)
{
W_BestWeapon self.weapon = ();
W_SetCurrentAmmo ();
}


just put this

if (self.onmetal2)
{
self.onmetal = 0;
self.onmetal2 = FALSE;
}


now in playerpostthink
and after

if (!(self.flags & FL_ONGROUND))
self.jump_flag = self.velocity_z;

put this
if (self.texs & TX_METAL)
if (self.onmetal)
{
self.onmetal2 = TRUE;

//self.velocity = '0 0 0';
}
else
{
self.onmetal2 = FALSE;
self.texs = self.texs - TX_METAL;
self.onmetal = 0;
}

and after


CheckPowerups ();

put this

playerfootstep();
playerfootstepl();
playerfootstepm();
playerfootstepn();


save and close.

in progs.src put textures.qc before client.qc, precache the wavs in the world.qc and compile.
Create a map with a funtion calle func_metal (put some metallic texture) and run!
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 495
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby Mexicouger » Sat Feb 05, 2011 11:56 pm

Problem with this is worldcraft will ignore whatever brush that has an entity tied to it. So you may get some problems/leaks in the level. I'd be careful with this. I also did something similar like this.

Good tutorial nonetheless
User avatar
Mexicouger
 
Posts: 514
Joined: Sat May 01, 2010 10:12 pm

Postby Nahuel » Sun Feb 06, 2011 12:00 am

hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 495
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby Chip » Sun Feb 06, 2011 2:47 pm





Fear not the dark, but what the dark hides.
User avatar
Chip
 
Posts: 575
Joined: Wed Jan 21, 2009 9:12 am
Location: Dublin, Ireland

Postby Nahuel » Sun Feb 06, 2011 4:08 pm

hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 495
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby metlslime » Sun Feb 06, 2011 10:23 pm

metlslime
 
Posts: 316
Joined: Tue Feb 05, 2008 11:03 pm

Postby Nahuel » Sun Feb 06, 2011 11:27 pm

hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 495
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby lth » Mon Feb 07, 2011 1:22 pm

Won't darkplaces load HL maps, which allow you to set accessible texture properties on surfaces? I haven't really investigated it myself but there are some bits in dpextensions.qc that suggest this is possible.
User avatar
lth
 
Posts: 144
Joined: Thu Nov 11, 2004 1:15 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 2 guests