![]() |
draw beam
okay I've been making a new bot template from botmans so far, I'm trying to do some waypoint stuff, just trying to wonder how to draw a waypoint.
I can't really include the beam stuff as I need to include lots of files that can't find lots of stuff. I have: Code:
Code:
class CEdictRecipient : public IRecipientFilter |
Re: draw beam
Isn't there a beam entity?
|
Re: draw beam
aye but remember that this is a plugin, no access to lots of stuff, and when you try to include the beam code you get hundreds of errors and external errors because a lot of the stuff is non plugin related.
|
Re: draw beam
You might want to consider using NDebugOverlay stuff instead of beams. NDebugOverlay includes...
Code:
void Box(const Vector &origin, const Vector &mins, const Vector &maxs, int r, int g, int b, int a, float flDuration); I'm not sure if/how NDebugOverlay would work from a plugin, but it seems like a much better system for drawing "debug" lines/boxes/text/etc in the game. botman |
Re: draw beam
thanks, yeah I've had a small look at that. There is a small thing though, there was a comment saying that is won't work on HL dedicated server (The interface would be NULL), meaning that clients wanting to make waypoints on a dedicated server might not be able to. I'll have a go at it anyway for now.
edit: Actually I think the DebugOverlay stuff will ever only work for the local client, there is no input as to what player this should be sent to, even in the Line function it just picks the local player and works with it to determine what the local player can see to clip lines, but is not passed to the engine debugoverlay functions. |
Re: draw beam
Is there a network message you can send to trigger a beam on the client?
|
Re: draw beam
The only thing I know is I need to fire a TempEntity net message, with TE_BEAMPOINTS. But that needs access to a ServerClass() what ever that is, which means you really need the TE_BeamPoints class, but again when you try to include that it's a pian because it includes lots of non plugin stuff.
|
Re: draw beam
Actually I think I#ve got it, I think you've got to get the Server Effects Interface :
IEffects *g_pEffects = NULL; .. g_pEffects = (IEffects* )interfaceFactory(IEFFECTS_INTERFACE_VERSION,NULL) ; ... g_pEffects->Beam(..,..); Haven't tried it yet though but it compiles okay Edit: Arrrrgh.. Okay the interfaceFactory returns NULL.. :@ |
Re: draw beam
Quote:
Use this instead: Code:
effects = (IEffects*)gameServerFactory(IEFFECTS_INTERFACE_VERSION, NULL); |
Re: draw beam
Thanks!
|
Re: draw beam
1 Attachment(s)
yay, here are some waypoints in the game, they're a bit small and fat.. still to work out the best size for them :)
thanks all edit: seems as though the origin from the "CollideOrigin" returns a vector on the players feet, thats why the waypoints were small, had to move them up from the origin. again though this seems to only work with all players at once, no input entity. I really need to get the TempEntity interface, but doesn't seem like its possibile to get that. |
Re: draw beam
Superb! Once you guys find a clean way to do that, ------------> wikiwikiwiki plz :)
|
Re: draw beam
You can get the player 'head' vector by using the Ear position, lemme search the correct line of code:
Code:
// position of ears (= eyes) THe only thing that still fails on me, is the code in the think function to get the first human players vector, as the plugin (and startframe code) runs while starting up the server, it crashes on init or something. As somehow the playerinfo or the other info from a client is not properly inited yet and i want to access it. Perhaps with a timer ;) But i have to do this later, i have no time now :D |
Re: draw beam
In your server plugin, use LevelInit() and LevelShutdown() to set a global flag that indicates whether a map is running or not.
If the map hasn't been initialized yet, you can skip over everything you added in the GameFrame() function. P.S. Note that in Half-Life2, plugins get loaded by the engine BEFORE the game actually starts running. You r plugin will be running while the Half-Life2 main menu is displayed (since the menu actually loads a small map as the "background" image). botman |
Re: draw beam
ah, thanks for the tip botman, that will make it easier then using an ugly timer.
|
Re: draw beam
i tried it, but i still needed a timer to prevent it from crashing.
EDIT: Correction, somehow the code crashed somewhere else, though the debugger in MSVC pointed to this line where you call the engine function. But, i did not really trust it, so i did not use my own function to return this vector, but using the engine function itself. It works flawlessley, yeey, i hate timers ;) |
Re: draw beam
It would be good to get the player Max's and min's, simply set up the waypoint size to be the player size at the time of creation (e.g. when crouched the size will be smaller so we can find the right size from it, sort of...)
Or does (CollideOrigin + EarPosition)/2 = center origin ?? |
Re: draw beam
heres how to get the very centre origin of any entity
Code:
Vector entityOrigin ( edict_t *pEntity ) |
Re: draw beam
w0h00! :D
* i also tried drawing waypoints, and i got them drawing, they are thinner and such. But somehow it only draws a few. I don't know yet how to make it draw more waypoints. It looks like as if i can draw way less wpts then in the HL1 engine? |
Re: draw beam
It draws all the waypoints for me, I think.
I think HL might be smart and cut some out if they aren't in your field of view. I'm using a 3d hashtable for mine to draw the waypoints nearest the player so only those in the nearest buckets to me get drawn. ps, just edited the code above, don't need GetServerEntity() it will work just from pEntity ;) |
Re: draw beam
you think? ;) i am writing the waypoint system from scratch, but i am talking about 20 wpts to be needed to be drawn. It somehow does not get drawn! here is my beam code:
Code:
void WaypointDraw(edict_t *pEdict) |
Re: draw beam
could be the "fadeLength" parameter, try making it 255. Maybe make the width a bit more to see it easier too ;)
heres what i use for drawing a waypoint (try copying the values) Code:
g_pEffects->Beam( m_vOrigin - Vector(0,0,WAYPOINT_HEIGHT/2), m_vOrigin + Vector(0,0,WAYPOINT_HEIGHT/2), CWaypoints::waypointTexture(), |
Re: draw beam
well, ok, the width is abit thin, but i like slim wpts ;) :D
i will try the fadelength. |
Re: draw beam
okay looks as though I can't edit my old posts :'(
anyway. this code works for bots and players and maybe even ohter entities which I havne't been able to test with yet (works with players and bots). you may need GetIServerEntity PHP Code:
|
Re: draw beam
rofl, i somehow remember that you said that could be left out? ;) well i changed it into the above code and i will try it asap.
|
Re: draw beam
yeah I thought that because it would still compile and thought it would do basically the same thing but never actually tested it. Better look before i leap :P
|
All times are GMT +2. The time now is 11:30. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.