PDA

View Full Version : Model name



strainik
17th April 2017, 09:42
Hi, i want to write hide and seek mod, but i have some problems.
How can i get model name by using aim throw bullettrace f.e? I need model from map, f.e. tree, barrels, cars or tanks models from toujane.


while(isAlive(self))
{
trace = bullettrace(self geteye() + (0, 0, 20), self geteye() + (0, 0, 20) + maps\mp\_utility::vectorscale(anglestoforward(self getplayerangles()), 99999), true, self);
self iprintlnbold(trace["entity"]); //display player name
}


Im junior in scripting, mb I'm using wrong steps, idk

serthy
17th April 2017, 10:19
trace[ "entity" ] is either the player, any other entity (script-models etc) or undefined

I do not know if your player has a static model, the trace-entity will show it as a player.

If so, check for these cases and pront the name:


ent = trace[ "entity" ];

if( IsDefined( ent ) && IsPlayer( ent ) )
IPrintLnBold( ent.name );


Also: you can only 'detect' models that are scrip-models. This means they must be entities (either set in the radiant or spawned via script). Normal models (like trees, barrels, tables etc.) cannot be detected via bullettrace afaik.

Also: in your script: you should add a wait-statement in there, otherwise it will issue an error.

strainik
17th April 2017, 10:32
Ok, thx.
Can there be alternative ways to determine the model? or its impossible?

Ni3ls
17th April 2017, 12:04
Decompile the map and open in radiant, then you can see the modelnames in Radiant.
Why do you want to know every model's name?

strainik
17th April 2017, 12:19
I want to make hide and seek, where user who is hiding saw the barrel or other object, pressed the f and took it model.

IzNoGoD
17th April 2017, 12:59
Then you might wanna decompile the map and create a list of all models in the map + their origin. Then see what the bullettrace["position"] is closest to, and use the list as a lookup.

strainik
17th April 2017, 13:11
Too expensive by time:(
Ok, can i add additional menu items(wm_messages) for one gametype, f.e?

Ni3ls
17th April 2017, 13:24
Yes you can. Check _menus.gsc how it's handeled

voron00
17th April 2017, 13:53
Also maybe add some triggers, so it would be like player can stand near a model and press f...?

IzNoGoD
17th April 2017, 13:59
Too expensive by time:(
Ok, can i add additional menu items(wm_messages) for one gametype, f.e?

I meant reading it through a script

kung foo man
17th April 2017, 17:06
Probably only models with High Collision LOD can be bullettraced. Maybe make e.g. a sphere in Maya, export it with High Collision into CoD2 and just link that sphere to every player.



player.sphere = createSomeTransparentSphereAndLinkTo(player);
player.sphere.player = player;


When bullettrace hits the sphere, you can access the player entity via trace["entity"].player

High Collision LOD in Asset Manager: https://killtube.org/showthread.php?1832-Question-Astar-(a*)-and-SetAlive-functions&p=9426&viewfull=1#post9426

strainik
17th April 2017, 17:38
I meant reading it through a script

in this way i decompile all maps of server, and find all model's origin, too hard for me(


Probably only models with High Collision LOD can be bullettraced. Maybe make e.g. a sphere in Maya, export it with High Collision into CoD2 and just link that sphere to every player.



player.sphere = createSomeTransparentSphereAndLinkTo(player);
player.sphere.player = player;


When bullettrace hits the sphere, you can access the player entity via trace["entity"].player

High Collision LOD in Asset Manager: https://killtube.org/showthread.php?1832-Question-Astar-(a*)-and-SetAlive-functions&p=9426&viewfull=1#post9426

I think u dont understand my question