AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Bullet Whizz (https://forums.alliedmods.net/showthread.php?t=29852)

Cheap_Suit 06-14-2006 02:25

Bullet Whizz
 
3 Attachment(s)
.: Description :.
Now you can hear bullets fly by if an enemy is shooting at you. This seriously add suspense to cs.
Anyhow, I just wanted to test the new stock function KoST made for me.


.: Cvars :.
amx_bulletwhizz (D: 1) - on/off plugin
amx_bulletwhizz_dis (D: 35) - max distance to hear the whizz sound


.: Sound Files :.
- misc/whizz1.wav
- misc/whizz2.wav
- misc/whizz3.wav
- misc/whizz4.wav
- misc/whizz5.wav


.: Module(s) Required :.
  • Fakemeta
  • Engine

ThomasNguyen 06-14-2006 02:28

Nice. :up:

Xanimos 06-14-2006 02:36

Good job again. Like the origionality/realism.

chowdown 06-14-2006 03:40

I like it. Makes the game more interesting to play, and helps you out if you are getting shot at.

Cheap_Suit 06-14-2006 14:28

Small update.

Btw, this is not useless

KoST 06-14-2006 14:50

are u using fm_is_ent_visible because of this case?

Code:

|
|  o <- Victim
|
|
-------------------(Wall)
<Aim>
|
|
|
|
|
<Me>


Cheap_Suit 06-14-2006 14:55

Code:
stock bool:is_user_visible(id, target) {     new Float:myOrigin[3]     entity_get_vector(id, EV_VEC_origin, myOrigin)         new Float:fViewOfs[3]     entity_get_vector(id, EV_VEC_view_ofs, fViewOfs)         new Float:targetOrigin[3]     entity_get_vector(target, EV_VEC_origin, targetOrigin)         new Float:EyesPos[3]     xs_vec_add(myOrigin, fViewOfs, EyesPos)     new Float:hitOrigin[3]     new hitIndex = trace_line(id, EyesPos, targetOrigin, hitOrigin)         if(hitIndex == target) {         return true     }     return false }

Quote:

Originally Posted by VEN
Code:
fm_is_visible(index, const Float:point[3])
As you can see that function checks whether given point is visible to an entity/player.
If point is an origin of the other player it's not visible because it's enclosed into the solid box.
So function works as it should work.

Your function should work for all solid target-entities except SOLID_TRIGGER.

EDIT:

I implemented
Code:
bool:fm_is_ent_visible(index, entity)
which compatible with all entity solidity types.
Now you can check for any entity <-> entity visiblity.

PS: I might have miss understood you. Yea I used fm_is_user_visible because of that.

KoST 06-14-2006 15:42

[edit]

Code:

--------------<Aim>-------------- plane 1
                ^
                |
                | (me_aim vector)
                |
                |
--------------<Me>-------------- plane 2

you can imagine this like two planes which have me_aim as normal vector. this stock only returns positive values if victim is between them. no need to check for visibility i guess..

Code:
stock get_distance_to_line(Float:pos_start[3], Float:pos_end[3], Float:pos_object[3]) {     new Float:vec_start_end[3], Float:vec_start_object[3], Float:vec_end_object[3], Float:vec_end_start[3]     xs_vec_sub(pos_end, pos_start, vec_start_end) // vector from start to end     xs_vec_sub(pos_object, pos_start, vec_start_object) // vector from end to object     xs_vec_sub(pos_start, pos_end, vec_end_start) // vector from end to start     xs_vec_sub(pos_end, pos_object, vec_end_object) // vector object to end         new Float:len_start_object = getVecLen(vec_start_object)     new Float:angle_start = floatacos(xs_vec_dot(vec_start_end, vec_start_object) / (getVecLen(vec_start_end) * len_start_object), degrees)     new Float:angle_end = floatacos(xs_vec_dot(vec_end_start, vec_end_object) / (getVecLen(vec_end_start) * getVecLen(vec_end_object)), degrees)     if(angle_start <= 90.0 && angle_end <= 90.0)         return floatround(len_start_object * floatsin(angle_start, degrees))     return -1 }

it checks if alpha and beta are <=90 degrees if c is victim. if one of them is larger then we are outside the planes.
http://upload.wikimedia.org/wikipedi...reieck.svg.png

Cheap_Suit 06-14-2006 16:15

ic, thanks.

Arkshine 06-14-2006 17:01

Works perfectly.

Thanks. 8)


All times are GMT -4. The time now is 09:35.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.