Raised This Month: $32 Target: $400
 8% 

[TUT] Entities: what they are and how to use them


Post New Thread Reply   
 
Thread Tools Display Modes
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 08-28-2006 , 10:05   Re: Entities: what they are and how to use them
Reply With Quote #11

Quote:
Originally Posted by Illusionist View Post
Nice tutorial Hawk, I have a question though, using engine, how can I create 2 or more entities with the same command or function. For instance, how could I set clcmd "CmdSayCar" to spawn two cars instead of one? (this is not the best example but I'm hoping that you understand what I'm trying to ask)
Just make the code inside it a loop (for loop kinda like for(new Count;Count < 2;Count++) { do the spawning stuff })
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 11-29-2006 , 14:33   Re: Entities: what they are and how to use them
Reply With Quote #12

Great article! But it doesn't clearly cover the difference between using entity_set_vector(ent, EV_VEC_origin, val) and entity_set_origin(ent, origin). Does it mean that i have to use entity_set_origin() always? What's the difference in gameplay?

Last edited by Simon Logic; 11-29-2006 at 14:46.
Simon Logic is offline
Send a message via Skype™ to Simon Logic
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 11-29-2006 , 14:43   Re: Entities: what they are and how to use them
Reply With Quote #13

I'm assuming entity_set_origin sets up all the properties of a static entity, so that its interactable for touching etc.

Maniplating manually will more than likely won't allow for this, unless you play around with pev_absmin & pev_absmax (Bounding box) calculation for this is pev_origin - pev_min (absmin) pev_origin + pev_max (absmax).
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd
Orangutanz is offline
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 11-30-2006 , 05:18   Re: Entities: what they are and how to use them
Reply With Quote #14

Orangutanz, is it a correct conclusion that entity_set_origin() should be used for solid objects in general? I worked hardly with spawn points and i never called entity_set_origin(), just entity_set_vector(id, EV_VEC_origin, origin) or DispatchKeyValue(id, "origin", "x x x"). I did many tests and everything is Ok.
Simon Logic is offline
Send a message via Skype™ to Simon Logic
k007
BANNED
Join Date: Mar 2006
Location: bacon?
Old 11-30-2006 , 10:37   Re: Entities: what they are and how to use them
Reply With Quote #15

i have a question about that too, could you use DispatchKeyValue on a index lower than 33(playa) or it doesn't matter it could be any index?
k007 is offline
Send a message via MSN to k007
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 11-30-2006 , 11:24   Re: Entities: what they are and how to use them
Reply With Quote #16

Quote:
Originally Posted by k007 View Post
i have a question about that too, could you use DispatchKeyValue on a index lower than 33(playa) or it doesn't matter it could be any index?
I used DispatchXXX only for my own created entities (with ID less than 33; the first assigned ID was 17) when i was spawning them. For existent entities with any ID i used entity_set_vector().
Simon Logic is offline
Send a message via Skype™ to Simon Logic
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 11-30-2006 , 13:00   Re: Entities: what they are and how to use them
Reply With Quote #17

I suppose entity_set_origin is more likely to be used on solid objects more than non-solid, but for like players you are able to move them using the other technique because they are thinking and constantly updating there bounding box, obviously some other entities will be fine as well.

DispatchKeyValue should be possible to use on any entity.
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd
Orangutanz is offline
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 02-12-2009 , 23:07   Re: [TUT] Entities: what they are and how to use them
Reply With Quote #18

How would I be able to manipulate an existing entity by getting its name?

Let's say I have func_button named "button". It currently is a dummy button with no target. But how would I be able to change the buttons target to "target?"

I assume it has to do with fm_get_string and fm_set_string right?
VMAN is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-12-2009 , 23:26   Re: [TUT] Entities: what they are and how to use them
Reply With Quote #19

PHP Code:
EngFunc_FindEntityByString,    // edict)        (edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue); 
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 02-13-2009 , 00:25   Re: [TUT] Entities: what they are and how to use them
Reply With Quote #20

I feel like such a noob for this.

But is this right?

PHP Code:
new button engfunc(EngFunc_FindEntityByString,engfunc(EngFunc_AllocString,"button"))
set_pev(buttonpev_targetname"target"
VMAN is offline
Reply


Thread Tools
Display Modes

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 07:39.


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