Creating a zone box
I saw this posted by VEN in another thread to make a zone box...
Quote:
1) How exactly would I know how to place one of these boxes in a certain location? 2) Is there a way to visually see the box that is created? 3) How would I detect when a player goes into one of the zones? |
Re: Creating a zone box
Code:
That's the best I can do, I'm not sure if everything is actually correct. Hopefully someone can correct me or confirm that I'm right. |
Re: Creating a zone box
Thanks for the reply, stupok69. Do I have to create an entity in the middle of the box? It looks like I do.
|
Re: Creating a zone box
Well you generally assign a box to entities so you can collide with them. I think tying the box to an entity is the only way you'll be later to detect if something touches the box. The origin of the entity doesn't actually matter, but generally the entity is in the center of the box, that's why I added your mins and maxs to the ent's origin.
|
Re: Creating a zone box
Ok thanks stupok69. I understand how this works now.
I am having a problem though. I can see the box outlined in TE_BOX, but some reason it's not blocking my player. I have the solid type set to BBOX so the whole box I created should block the player. The line... "entity_set_size(ent, mins, maxs);" should set the size to be blocked correct? Some reason it isn't working :( btw I use engine as you can see : / PHP Code:
|
Re: Creating a zone box
You're using engine, so it's a little bit different than my example. Originally I didn't understand the difference between pev_absmin and pev_mins but now I think I do.
pev_absmin contains the coordinates with respect to (0.0, 0.0, 0.0) pev_mins contains the coordinates with respect to the entity's origin When you are doing this: Code:
entity_set_size(ent, mins, maxs)Code:
set_pev(ent, pev_mins, mins)By the way, you should use "TE_BOX" instead of "31", it should be defined already. It's always better to avoid hard-coding when you can. |
Re: Creating a zone box
Alright I'm really confused now lol.
What do you mean by with respect to? |
Re: Creating a zone box
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 :wink: Code:
I can't guarantee that either one will work for sure, but I feel confident about both of them. |
Re: Creating a zone box
Ooo now I see what you meant lol.
Thanks a ton +karma :) |
| All times are GMT -4. The time now is 21:35. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.