well, i'm sure everyone's thought of ways to make the enemy's ai more realistic. personally, i hate how they are deaf. they only pay attention to you when u are near them or they see your bullets.
is there any function like getlight but for sound? i imagine that if getsound were to exist, it would return as a float instead of a vector. has anyone thought of this before?
getsound?
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Just an idea, haven't really tried this. You could try to replace the sound() builtin with a QuakeC function that, when fired by a client, "awakes" nearby monsters. Something like this (UNTESTED!):
in defs.qc:
and at the end of the file:
in defs.qc:
Code: Select all
// void(entity e, float chan, string samp, float vol, float atten) sound = #8;
void(entity e, float chan, string samp, float vol, float atten) _sound = #8;
Code: Select all
void(entity e, float chan, string samp, float vol, float atten) sound =
{
local entity monster;
if (e.flags & FL_CLIENT)
{
// the player makes a noise, wake up nearby monsters
monster = findradius (e.origin, 300);
sight_entity = e;
sight_entity_time = time;
while (monster != world)
{
if (monster.enemy == world)
{
monster.enemy = e;
}
}
}
_sound (e, chan, samp, vol, atten);
}
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)
-
- Posts: 237
- Joined: Sat Feb 05, 2011 6:57 am
- Location: Tripoli, Libya
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
But the sound volume is not relevant to the proposed solution (although it would be a clever idea: higher volumes - like explosions - could use a bigger radius in findradius() ).behind_you wrote:yes thank you for this but the problem is that sound would be an off/on switch. ie. the loudness of the sound is not taken into consideration.
i guess the simple solution would be to code sound levels for every sound you input
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)