Page 1 of 1

Display the name of a trace entity

Posted: December 25th, 2012, 2:39 pm
by F |Madness| U
Firstly, merry christmas!

Now more importantly :P I'm using a bullet trace to find scripted entities, and I'm able to display and change the origin of the entities etc so the bullet trace is working correctly, I just want to know if there's a way to display the name of the entity?

Eg.

Code: Select all

trace = bullettrace(self gettagorigin("j_head"),self gettagorigin("j_head")+anglestoforward(self getplayerangles())*1000000,true,self);
self iprintlnbold(trace["entity"].origin);
self iprintlnbold(trace["entity"].name);//this is the line I need help with
(I didn't expect the last line to work, but that was just what I took a guess at because I had no idea). So I can print the origin of the entity but I don't know how to print the name of the entity itself, any help would be awesome thanks :)

If I use trace["entity"].classname I get script_brushmodel printed, however this doesn't really help as I need to work out the names of entities, such as platform_1 etc.

EDIT: Nvm got it, thanks to IzNoGod. It's trace["entity"].targetname, can't believe I didn't think of that :P