getsound?
Moderator: InsideQC Admins
6 posts
• Page 1 of 1
getsound?
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?
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?
-

behind_you - Posts: 237
- Joined: Sat Feb 05, 2011 6:57 am
- Location: Tripoli, Libya
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;
and at the end of the file:
- 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)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
When a sound is played, do a findradius(); around the entity that played the sound. Then make monsters wake up or investigate if they are in that radius.
Edit: what frag.machine said. I should have read all comments befo posting.
Edit: what frag.machine said. I should have read all comments befo posting.
-

Error - InsideQC Staff
- Posts: 865
- Joined: Fri Nov 05, 2004 5:15 am
- Location: VA, USA
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 guess the simple solution would be to code sound levels for every sound you input
-

behind_you - Posts: 237
- Joined: Sat Feb 05, 2011 6:57 am
- Location: Tripoli, Libya
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
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() ).
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
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest