Getting light entities in a map
I'm trying to find all the light entities in the map. I decompiled the maps I tested and I can see int the entity report of Hammer that they have several light entities with the classname "light". This is how I'm trying to detect light entities:
PHP Code:
|
Re: Getting light entities in a map
Light entities are destroyed right after they are spawned if they do not have a valid targetname.
|
Re: Getting light entities in a map
Wow thanks a lot for clarifying that! Is there any way I can alter those entities and set a target name before they spawn?
|
Re: Getting light entities in a map
This should solve your problem:
Code:
|
Re: Getting light entities in a map
Thank you so much! The reason I wanted to keep them was to set flickering lights to normal. The map that I'm testing has lights set their appearance to "Flicker B", which corresponds to value 6 for m_iStyle
http://wiki.amxmodx.org/CLight_%28CS%29 From that link I actually verified that I can read that style using get_pdata_int(iEnt, 33) and I do read 6 for the ones that flicker. In your spawn hook function I added a set_pdata_int line and when I do that I do read 0 for the m_iStyle value; however the lights still flicker. PHP Code:
Thanks a lot again! |
Re: Getting light entities in a map
You could try just "style" as the key name.
|
Re: Getting light entities in a map
Wow thanks, never thought of it :shock:
I tried: DispatchKeyValue( iEnt, "style", "0") DispatchKeyValue( iEnt, "style", 0) In both cases m_iStyle did actually change to 0. But the lights still flicker. I also tried: DispatchKeyValue( iEnt, "pattern", "m") No luck :( |
Re: Getting light entities in a map
Try to create all stuff in plugin_precache, it sometimes help.
Also, sources may help you Code:
// |
Re: Getting light entities in a map
Connor I had already looked at that source but never paid attention to the >=32 check. That gave me new hopes but things still fail even when I set m_iStyle to 32 and try with and without dispatching a pattern value. The Dispatch functions are working and I can successfully set these values before entity spawn. Nonetheless, the lights still flicker.
Also I really don't understand what you mean when you say create everything in plugin_precache. |
Re: Getting light entities in a map
Maybe this can make things simpler. Is there any way I can remove a light entity as if it never existed in the map? Seems like when you remove light entities their lighting still remains. Just like when they don't have a targetname they get removed in the engine anyway.
|
| All times are GMT -4. The time now is 10:48. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.