Raised This Month: $ Target: $400
 0% 

Creating a zone box


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
stupok
Veteran Member
Join Date: Feb 2006
Old 06-26-2007 , 01:23   Re: Creating a zone box
Reply With Quote #1

Lets say that the X coordinate of pev_mins is 100 units to the left of the entity. That means that it is -100 with respect to the entity's X coordinate. That means the pev_mins X coordinate is -100 and the pev_absmin X coordinate is ent_x_coord - 100.

Here ya go

Code:
//ENGINE ent = create_entity("info_target"); entity_set_string(ent, EV_SZ_classname, "safebox_blue"); entity_set_int(ent, EV_INT_solid, SOLID_BBOX); entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY); origin = {1663.0, 3411.0, 679.0} entity_set_origin(ent, origin); mins = {-255.0, -115.0, -71.0} maxs = {255.0, 115.0, 71.0} entity_set_size(ent, mins, maxs); // This sets the blocking size? mins[0] = origin[0] - 255.0; mins[1] = origin[1] - 115.0; mins[2] = origin[2] - 71.0; maxs[0] = origin[0] + 255.0; maxs[1] = origin[1] + 115.0; maxs[2] = origin[2] + 71.0; message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BOX); write_coord(floatround(mins[0])); // boxmins write_coord(floatround(mins[1])); write_coord(floatround(mins[2])); write_coord(floatround(maxs[0])); // boxmaxs write_coord(floatround(maxs[1])); write_coord(floatround(maxs[2])); write_short(999999); // life in 0.1 s write_byte(255); // r write_byte(0); // g write_byte(0); // b message_end(); //FAKEMETA ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); set_pev(ent, pev_classname, "safebox_blue"); set_pev(ent, pev_solid, SOLID_BBOX); set_pev(ent, pev_movetype, MOVETYPE_FLY); origin = {1663.0, 3411.0, 679.0}; engfunc(EngFunc_SetOrigin, ent, origin); mins[0] = origin[0] - 255.0; mins[1] = origin[1] - 115.0; mins[2] = origin[2] - 71.0; maxs[0] = origin[0] + 255.0; maxs[1] = origin[1] + 115.0; maxs[2] = origin[2] + 71.0; set_pev(ent, pev_absmin, mins); set_pev(ent, pev_absmax, maxs); message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BOX); engfunc(EngFunc_WriteCoord, mins[0]); engfunc(EngFunc_WriteCoord, mins[1]); engfunc(EngFunc_WriteCoord, mins[2]); engfunc(EngFunc_WriteCoord, maxs[0]); engfunc(EngFunc_WriteCoord, maxs[1]); engfunc(EngFunc_WriteCoord, maxs[2]); write_short(999999); // life in 0.1 s write_byte(255); // r write_byte(0); // g write_byte(0); // b message_end();

I can't guarantee that either one will work for sure, but I feel confident about both of them.

Last edited by stupok; 06-26-2007 at 01:26.
stupok is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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