Raised This Month: $51 Target: $400
 12% 

[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 02-13-2009 , 08:19   Re: [TUT] Entities: what they are and how to use them
Reply With Quote #21

No, read the parameters:
  • edict_t *pEdictStartSearchAfter
  • const char *pszField
  • const char *pszValue

I don't know what exactly you meant by "name" but if you didn't mean something else, you'd put "name" in pszField.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-13-2009 , 11:14   Re: [TUT] Entities: what they are and how to use them
Reply With Quote #22

Try with field "classname" and value:"func_button"
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-13-2009 , 12:19   Re: [TUT] Entities: what they are and how to use them
Reply With Quote #23

Quote:
Originally Posted by ConnorMcLeod View Post
Try with field "classname" and value:"func_button"
Well, the problem with that is that he would have to get the ent's name and check if it's "button" each time he finds a func_button.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 02-13-2009 , 15:55   Re: [TUT] Entities: what they are and how to use them
Reply With Quote #24

PHP Code:
new button engfunc(EngFunc_FindEntityByStringedict) (edict_t *pEdictStartSearchAfter, const char *name, const char *mybutton);
set_pev(buttonpev_targetname"mytarget"); 
Doesn't seem to compile. I must be doing something really wrong.

Sorry If I am wasting your time
VMAN is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-13-2009 , 16:24   Re: [TUT] Entities: what they are and how to use them
Reply With Quote #25

The parameters I gave you were for the VM. Here's how you read them:
  • EngFunc_FindEntityByString, // edict) - An edict is an entity structure. This means that the function returns an edict, or an entity ID.
  • edict_t *pEdictStartSearchAfter - Pointer to an edict. The pointer part is irrelevant for your purposes, but it's asking for an entity ID to start from.
  • const char *pszField - Pointer to a string denoted "Field". This is the member on the entity that you want to search.
  • const char *pszValue - Pointer to a string denoted "Value". This is the value you're looking for under "Field".
Again, I'm not sure what you mean by "name" because there are many variables that have to do with "name" (coincidentally not the string "name" itself), but if that made sense, it would look like this:

PHP Code:
new Ent engfunc(EngFunc_FindEntByString,-1,"name","button")
set_pev(Ent,pev_targetname,"mytarget"
Also, I think you want pev_target, since targetname is what you use to target that button with. For example, if I wanted to have another button which uses this button when that one is used, I would set this button's targetname to that button's target.

However, if I wanted to open a door when this button is used, I would set this button's target to the door's targetname.

I'm not sure about what you're trying to do, but I can't see an reason for needing a targetname on a button.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 02-13-2009 , 19:32   Re: [TUT] Entities: what they are and how to use them
Reply With Quote #26

Ah, pev_target is what I need .

Haven't done mapping for weeks .


Thank you so much for your time and patience.

+Karma
VMAN is offline
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 02-13-2009 , 21:01   Re: [TUT] Entities: what they are and how to use them
Reply With Quote #27

Getting an error compiling this


undefined symbol "EngFunc_FindEntByString"

Last edited by VMAN; 02-13-2009 at 21:24.
VMAN is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-13-2009 , 21:10   Re: [TUT] Entities: what they are and how to use them
Reply With Quote #28

EngFunc_FindEntityByString
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 02-13-2009 , 21:23   Re: [TUT] Entities: what they are and how to use them
Reply With Quote #29

Thanks!
VMAN is offline
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 08-20-2010 , 12:12   Re: [TUT] Entities: what they are and how to use them
Reply With Quote #30

Is there a specific order when setting values to custom ents?

For eg...
Create ent
Set classname
Set origin, size, movetype, solid, velocity
Set health, angles
Etc...

I remembered one time, one of my ent was not being made as I was playing around with the order of values being set for my ent.
Any advice on this would be great!
__________________
It's a mystery.

Last edited by Mini_Midget; 08-20-2010 at 12:15.
Mini_Midget 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 02:11.


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