• Need a function, or help in creating a function.
    5 replies, posted
The problem is this: I am making a custom gib mod for props and I need a function to return the material(s) of a prop that has just been destroyed. However, Entity:GetMaterial() will only return a value if a material has been applied to the prop, I have asked and been informed it is the expected behavior of Entity:GetMaterial() to return "" if no override material has been set, and what I need is the material that spawned with the prop. So, is it possible to get the material(s) that spawns with a prop? Any help would be much appreciated, thank you.
:wtc:
Try saving the material right as you set it. So then you have the original material.
[QUOTE=c-unit;26313580]Try saving the material right as you set it. So then you have the original material.[/QUOTE] That's the problem, you can not retrieve the material with Entity:GetMaterial(), and I don't want to set a new material, I just want to find out what material is on a prop at the time it is spawned. I am going to set the material I get on the Gibs I create. Edit: to clarify it doesn't have to be at the time of spawn, it will be at the time of destruction, but I want the material that is on the prop if an override has not been set.
There was a module that did this, gm_modelinfo or something similiar. Google it.
Cool, Thanks, I found a copy of it at [url]http://fox-warrior.com/Public/Modules/[/url] it looks like there are quite a few other modules there also. EDIT: ok, so this works good, after a little more searching I found how to use it [lua] local nIndex = modelinfo.GetIndex( Model( DeadEnt:GetModel() ) ); local Mats = modelinfo.GetMaterials( nIndex ) [/lua] Mats will be the material of the model retrieved from the DeadEnt Entity. I found the info on using it at [url]http://www.facepunch.com/threads/998953-Get-the-looking-at-entity-index[/url]
Sorry, you need to Log In to post a reply to this thread.