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

What's the best way to detect entity type?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 12-20-2006 , 10:01   What's the best way to detect entity type?
Reply With Quote #1

Also I mean what's the fasterst way?

Most entities are detected by model name. But this is ineffective and not stable cause you can easily change entity model. Well, for beginning assume that i use standard models. Can i use modelindex for that? Or should i cache modelindex while getting a modelname because modelindex can be changed from map to map? May be there is a simple way to detect type via PrivateData (as VEN did with grenade types)?
Simon Logic is offline
Send a message via Skype™ to Simon Logic
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-20-2006 , 17:09   Re: What's the best way to detect entity type?
Reply With Quote #2

Using classname.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 12-21-2006 , 05:06   Re: What's the best way to detect entity type?
Reply With Quote #3

This is not good because classnames can be the same, but models are different for two (or more) objects.

What's the maximum possible in-game value for modelindex?
Simon Logic is offline
Send a message via Skype™ to Simon Logic
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-21-2006 , 20:01   Re: What's the best way to detect entity type?
Reply With Quote #4

Classnames aren't good for identifying what type of entity something is? Classname is what dictates what type of entity something is.

If you are just trying to individualize all of your entities, use their entity indexes, since they are all unique.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 12-22-2006 , 05:37   Re: What's the best way to detect entity type?
Reply With Quote #5

Well, i want to detect weapon type. Classnames are the same.

I did some research. modelindex is VERY unreliable & changes from state to state (when attached to player - it's zero; when trhowen - it can be very large). The only way is detection by model

The only optimization i see is to enchance equal() function to add one more argument which means what symbol index to start compare, because each model string starts with "moldes/".
Simon Logic is offline
Send a message via Skype™ to Simon Logic
The Specialist
BANNED
Join Date: Nov 2006
Old 12-22-2006 , 05:40   Re: What's the best way to detect entity type?
Reply With Quote #6

What exactly are you trying to do ?
The Specialist is offline
Send a message via AIM to The Specialist
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 12-22-2006 , 05:57   Re: What's the best way to detect entity type?
Reply With Quote #7

There is an array of weapon model strings. Each index corresponds to weapon id. I have an entity id. By classname i detected that it's a weapon ("weaponbox").Then i need to detect a weapon id. Sequental comparison of strings is a shitty method, but 100% workable.

I thought i can do like this:
1) first time detect a weapon id by sequantal comparison of model strings
2) make an association of modelindex -> weapon_id into modelindex2wid array assuming max model index is (for example) 255; so, next time i can get a weapon id immediately: weapon_id = modelindex2wid[entity.modelindex]

But that's not working (see my previous post)!

Is there any other common pev value for weapons of the same type/model, but unique for different types of weapons?
Simon Logic is offline
Send a message via Skype™ to Simon Logic
The Specialist
BANNED
Join Date: Nov 2006
Old 12-22-2006 , 06:16   Re: What's the best way to detect entity type?
Reply With Quote #8

getting by a model is a bad way to do it . Its unreliable and can throw off your entire plugin with a model changing plugin on a server , which is a very common thing in servers. Can you explaine what your trying to do ? Theres probly a better way to do it .
The Specialist is offline
Send a message via AIM to The Specialist
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 12-22-2006 , 06:26   Re: What's the best way to detect entity type?
Reply With Quote #9

I know this. I wrote about it above. That's why i'm asking for help.

I need to detect type of weapon (weapon id) be entity id as fast (less cpu load) as possible.
Simon Logic is offline
Send a message via Skype™ to Simon Logic
The Specialist
BANNED
Join Date: Nov 2006
Old 12-22-2006 , 06:28   Re: What's the best way to detect entity type?
Reply With Quote #10

what about
Code:
cs_get_weapon_id()
The Specialist is offline
Send a message via AIM to The Specialist
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 04:45.


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