[SNIPPET] Beampoints from a player's weapon tip
1 Attachment(s)
I figured out how to do this a couple of days ago, and I thought that I might as well archive it in case others are curious.
Overview If you've used temp entities, you probably know what beampoints are. You may have also seen in HookMod and EntMod that it's possible to attach such beams to the tip of a player's weapon. To do this, you can't use TE_BEAMPOINTS, you will need to use TE_BEAMENTPOINT instead. The format for this temp entity is available in message_const.inc. In order to get it to attach to the player's weapon (instead of his origin), you must attach the 0x1000 flag to the entity index in your write_short. Below is a screenshot of first- and third-person views. The red line is without the flag, and the blue line is with the flag. For example, these are the two different write_short's that you would use to get either line type. Code:
http://avalanche.epherion.com/images...rson_small.jpg http://avalanche.epherion.com/images...rson_small.jpg This flag also works for TE_BEAMENTS, as shown below. http://avalanche.epherion.com/images...uble_small.jpg You can see the exact code that I used to generate these lines in the attached SMA. Extra Details The exact way this works is by using the position of a model's attachments. Take the attachment index of the attachment that you want to use, add one to it, and then the flag for that attachment would be 0xn000. For example, in gign.qc: Code:
// 2 attachments You can use these attachment flags for almost any message that takes an entity index, and you can use it on any entities that have attachments. |
Re: [SNIPPET] Beampoints at the end of a player's weapon
Nice Snippet and good job.
|
Re: [SNIPPET] Beampoints from a player's weapon tip
wow.I was looking for this!Gj Avalanche.
|
Re: [SNIPPET] Beampoints from a player's weapon tip
Avalanche, would it be possible for you to make the beam follow the gunpoint like a tracer? Because when I tested this the point stayed on the floor and didn't move.
|
Re: [SNIPPET] Beampoints from a player's weapon tip
Only if you going to redraw that beam updating end point every time.
|
Re: [SNIPPET] Beampoints from a player's weapon tip
@Dark Kingdom
PHP Code:
@Avalanche :lol: :P |
Re: [SNIPPET] Beampoints from a player's weapon tip
You should use get_players in other case server will crash if there are no 32 players.
|
Re: [SNIPPET] Beampoints from a player's weapon tip
These two lines should be outside of the for loop.
Code:
|
Re: [SNIPPET] Beampoints from a player's weapon tip
Quote:
Quote:
|
Re: [SNIPPET] Beampoints from a player's weapon tip
Hey, this is a code snippet thread, not a plugin help thread! ;) Now shoo!
|
All times are GMT -4. The time now is 07:54. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.