Display the name of a trace entity

Have a question about modding, modelling or skinning? Have a tutorial to post? Post here!

Moderator: Core Staff

Post Reply
F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Display the name of a trace entity

Post by F |Madness| U » December 25th, 2012, 2:39 pm

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
-

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests