AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   message_write? (https://forums.alliedmods.net/showthread.php?t=13411)

BioHazardousWaste 05-15-2005 11:28

message_write?
 
Hey all :)

What I wanted to do is make a laser scope. I think TFC had one. But, I want it for the scout. I figured you could use trace line, but from the funcwiki it doesn't look like you can actually use that to draw the line visibly. So I guess you'd have to use message_write. I don't know how it works though. Could someone give me an example/walkthrough/tutorial?

Thanx

v3x 05-15-2005 14:17

1 Attachment(s)
:D

BioHazardousWaste 05-15-2005 14:21

ha, i'll look through that and see if i can figure out waht it means

sambro 05-15-2005 23:15

I'll save you the effort (I'm so generous). Taken straight from my tempentity plugin (not finished yet).

Code:
//Creates a beam TE between two points. createBeamPoints(id) {   message_begin(MSG_BROADCAST, SVC_TEMPENTITY);   //The type of temp entity.   write_byte(TE_BEAMPOINTS);   //Start position.   write_coord(floatround(vector_source[0]));   write_coord(floatround(vector_source[1]));   write_coord(floatround(vector_source[2]));   //End position   write_coord(floatround(vector_destination[0]));   write_coord(floatround(vector_destination[1]));   write_coord(floatround(vector_destination[2]));   //Beam sprite.   write_short(sprite_dot);   //Sprite start frame. Usually fine to just leave this at 1.   write_byte(1);   //Frame rate per 1/10 second.   write_byte(1);   //Lifetime of the TE, in tenths of a second.   write_byte(100);   //Width of the beam.   write_byte(20);   //Noise amplitude. No idea wtf this is. Best to leave it at 0.   write_byte(0);   //Color of the beam. RGB.   write_byte(0);   write_byte(255);   write_byte(255);   //Brightness of the beam.   write_byte(255);   //"scroll-speed". No clue again. Left at 0.   write_byte(0);   //We're done.   message_end(); }

sambro 05-15-2005 23:17

Forgot to mention, you'll obviously need to find the exact point of the weapon so you cna make it look as real as possible, not sure how you'd do this.

Also, the sprite_dot is a variable that holds the id of the sprite "sprites/dot.spr".

You'll need to precache it and store it's id in a var.

Code:
public plugin_precache() {   sprite_dot = precache_model("sprites/dot.spr"); }

Cheap_Suit 05-16-2005 01:11

Quote:

Originally Posted by v3x
:D

this is sweet info v3x

sambro 05-16-2005 03:01

Quote:

Originally Posted by Cheap_Suit
Quote:

Originally Posted by v3x
:D

this is sweet info v3x

Actually, it was. He supplied the const.h file which has a list of all the Temp Entities you can create and even shows the parameters you supply.

BioHazardousWaste 05-16-2005 07:55

wow, thanx. Just wondering though. How do you know that. Like what makes write_bite (1) the start frame for example?

sambro 05-16-2005 09:23

If you look at the const.h file, it defines all of the temp entities with some nicer names, then it also has some comments tellign you what it expects for that message.

v3x 05-16-2005 13:56

Yea, that file was from the HL SDK or w/e. :D


All times are GMT -4. The time now is 16:42.

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