AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Entity real name (https://forums.alliedmods.net/showthread.php?t=319653)

ZaX 11-13-2019 00:01

Entity real name
 
Hey,
Is it possible to get the entity real name? Such as func_breakable, mappers name each entity on the map in VHE, or another program.
Is it possible to get the name?

Classname returns the entity class, globalname doesnt work and same for targetname

Natsheh 11-14-2019 05:48

Re: Entity real name
 
I assume it's retrieved in fakemeta using pev_targetname

edon1337 11-14-2019 06:06

Re: Entity real name
 
Quote:

Originally Posted by Natsheh (Post 2672889)
I assume it's retrieved in fakemeta using pev_targetname

He already mentioned that targetname doesn't work.

Natsheh 11-14-2019 09:57

Re: Entity real name
 
Such as func_breakable ?

That is a class name if he named the class name to something different it may not even function it wouldn't be an entity just an object.

JocAnis 11-14-2019 10:12

Re: Entity real name
 
It is possible to do, what exactly do you need?

OciXCrom 11-14-2019 10:18

Re: Entity real name
 
Quote:

Originally Posted by Natsheh (Post 2672908)
Such as func_breakable ?

That is a class name if he named the class name to something different it may not even function it wouldn't be an entity just an object.

No. Each entity can be assigned a name in VHE.

It should indeed be targetname. Take a look at this BaseBuilder mod - https://forums.alliedmods.net/showthread.php?t=144287
It uses entities named "barrier" to do stuff.

PHP Code:

g_iEntBarrier find_ent_by_tname( -1"barrier" ); 

And entities named "ignore" for other things. Here the guy got the name like this:

PHP Code:

new szClass[10], szTarget[7];
entity_get_string(entEV_SZ_classnameszClass9);
entity_get_string(entEV_SZ_targetnameszTarget6);
if (!
equal(szClass"func_wall") || equal(szTarget"ignore"))
    return 
PLUGIN_HANDLED


JocAnis 11-14-2019 10:35

Re: Entity real name
 
i have been fighting with these names from VHE for 2man kz maps, and how i remember it was a little confusing, like target in .sma was name in VHE or something like that, try these things:
Code:

1)
entity_get_string( ent, EV_SZ_target, target, charsmax( target ) )
entity_get_string( ent, EV_SZ_targetname, target2, charsmax( target2 ) )

and i had this also:

2)
new targetent = FM_NULLENT;

//this below was done in plugin_init, cant remember if it must be there, but just to let you know:
while(( targetent = engfunc(EngFunc_FindEntityByString, targetent, "name", target ) != 0))
{
//your code
}

i dont have time to test it again, but i think second one is more accurate, you can test it

DJEarthQuake 11-14-2019 16:40

Re: Entity real name
 
1 Attachment(s)
Quote:

Originally Posted by ZaX (Post 2672774)
Hey,
Is it possible to get the entity real name? Such as func_breakable, mappers name each entity on the map in VHE, or another program.
Is it possible to get the name?

Classname returns the entity class, globalname doesnt work and same for targetname

Pizza Hut's Entity Info.

TO DO: Find_sphere_class_highlighting.


Secret Door from Crossfire
https://forums.alliedmods.net/attach...1&d=1573765490

Entity 258
EV_INT_movetype = 7
EV_INT_solid = 4
EV_INT_modelindex = 64
EV_INT_spawnflags = 768
EV_INT_rendermode = 1
EV_FL_ltime = 2.940000
EV_FL_nextthink = -1.000000
EV_FL_speed = 200.000000
EV_FL_renderamt = 150.000000
EV_VEC_movedir = (-0.000000,0.000000,-1.000000)
EV_VEC_absmin = (638.000000,1438.000000,-1858.000000)
EV_VEC_absmax = (658.000000,1522.000000,-1758.000000)
EV_VEC_mins = (639.000000,1439.000000,-1857.000000)
EV_VEC_maxs = (657.000000,1521.000000,-1759.000000)
EV_VEC_size = (18.000000,82.000000,98.000000)
EV_VEC_rendercolor = (0.000000,255.000000,0.000000)
EV_ENT_pContainingEntity = 258
EV_SZ_classname = func_door
EV_SZ_model = *63
EV_SZ_targetname = secret_door
EV_SZ_noise1 = common/null.wav
EV_SZ_noise2 = doors/doorstop4.wav


Others:
Entity Network Monitor.
Entity Lab (Engine based) [Final]
Entity Tool
Ent Fun: unlock door!

Code:
new entlist[513]; find_sphere_class(0,"classname_to_find",radius_float,entlist,512,origin_vector);



https://developer.valvesoftware.com/...-Life_entities
https://wiki.alliedmods.net/Finding_Entities_(AMX_Mod_X)

ZaX 11-14-2019 20:02

Re: Entity real name
 
Quote:

Originally Posted by OciXCrom (Post 2672910)
No. Each entity can be assigned a name in VHE.

It should indeed be targetname. Take a look at this BaseBuilder mod - https://forums.alliedmods.net/showthread.php?t=144287
It uses entities named "barrier" to do stuff.

PHP Code:

g_iEntBarrier find_ent_by_tname( -1"barrier" ); 

And entities named "ignore" for other things. Here the guy got the name like this:

PHP Code:

new szClass[10], szTarget[7];
entity_get_string(entEV_SZ_classnameszClass9);
entity_get_string(entEV_SZ_targetnameszTarget6);
if (!
equal(szClass"func_wall") || equal(szTarget"ignore"))
    return 
PLUGIN_HANDLED


It didnt work aswell, im trying to get the entity name and print it in chat after it gets destroyed/killed
Correct me if i was mistaken
PHP Code:

        new szTargetname[7], szName[32]
        
get_user_namekillerszNamecharsmax(szName))
        
entity_get_string(entEV_SZ_targetnameszTargetname6)

        
client_print(0print_chat"*%s* was broken by *%s*"szTargetname szName

BTW, im not sure if targetname gets the entity name after it gets destroyed/killed, i think it gets the name when you aim on the entity

Quote:

Originally Posted by JocAnis (Post 2672914)
i have been fighting with these names from VHE for 2man kz maps, and how i remember it was a little confusing, like target in .sma was name in VHE or something like that, try these things:
Code:

1)
entity_get_string( ent, EV_SZ_target, target, charsmax( target ) )
entity_get_string( ent, EV_SZ_targetname, target2, charsmax( target2 ) )

and i had this also:

2)
new targetent = FM_NULLENT;

//this below was done in plugin_init, cant remember if it must be there, but just to let you know:
while(( targetent = engfunc(EngFunc_FindEntityByString, targetent, "name", target ) != 0))
{
//your code
}

i dont have time to test it again, but i think second one is more accurate, you can test it


I have tried both of these, not working
PHP Code:

entity_get_stringentEV_SZ_targettargetcharsmaxtarget ) )
entity_get_stringentEV_SZ_targetnametarget2charsmaxtarget2 ) ) 

Whats the 'target'? the 4th arg in engfunc
PHP Code:

while(( targetent engfunc(EngFunc_FindEntityByStringtargetent"name"target ) != 0)) 




Quote:

Originally Posted by DJEarthQuake (Post 2672951)
Pizza Hut's Entity Info.

TO DO: Find_sphere_class_highlighting.


Secret Door from Crossfire
https://forums.alliedmods.net/attach...1&d=1573765490

Entity 258
EV_INT_movetype = 7
EV_INT_solid = 4
EV_INT_modelindex = 64
EV_INT_spawnflags = 768
EV_INT_rendermode = 1
EV_FL_ltime = 2.940000
EV_FL_nextthink = -1.000000
EV_FL_speed = 200.000000
EV_FL_renderamt = 150.000000
EV_VEC_movedir = (-0.000000,0.000000,-1.000000)
EV_VEC_absmin = (638.000000,1438.000000,-1858.000000)
EV_VEC_absmax = (658.000000,1522.000000,-1758.000000)
EV_VEC_mins = (639.000000,1439.000000,-1857.000000)
EV_VEC_maxs = (657.000000,1521.000000,-1759.000000)
EV_VEC_size = (18.000000,82.000000,98.000000)
EV_VEC_rendercolor = (0.000000,255.000000,0.000000)
EV_ENT_pContainingEntity = 258
EV_SZ_classname = func_door
EV_SZ_model = *63
EV_SZ_targetname = secret_door
EV_SZ_noise1 = common/null.wav
EV_SZ_noise2 = doors/doorstop4.wav


Others:
Entity Network Monitor.
Entity Lab (Engine based) [Final]
Entity Tool
Ent Fun: unlock door!

Code:
new entlist[513]; find_sphere_class(0,"classname_to_find",radius_float,entlist,512,origin_vector);



https://developer.valvesoftware.com/...-Life_entities
https://wiki.alliedmods.net/Finding_Entities_(AMX_Mod_X)

Im not sure if I understood all of it, but it seems your method shows the name when you aim on it

Quote:

Originally Posted by JocAnis (Post 2672909)
It is possible to do, what exactly do you need?

Print the entity name after it gets killed/destroyed

OciXCrom 11-14-2019 20:36

Re: Entity real name
 
Show us the code in which you're trying to get the name. You may be using it on a wrong entity index. Also, are you sure the entity even has a name?


All times are GMT -4. The time now is 15:17.

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