Raised This Month: $51 Target: $400
 12% 

Light Problem


Post New Thread Reply   
 
Thread Tools Display Modes
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 02-24-2017 , 11:56   Re: Light Problem
Reply With Quote #11

i mean when u get the value of origin you can set it manually in the msg coord
__________________

Last edited by abdobiskra; 02-24-2017 at 11:57.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
DarthMan
Veteran Member
Join Date: Aug 2011
Old 02-24-2017 , 12:06   Re: Light Problem
Reply With Quote #12

Quote:
Originally Posted by abdobiskra View Post
i mean when u get the value of origin you can set it manually in the msg coord
Yes, but that is not what I want.

Code:
public create_light(origin)
{
    new light_ent = -1    
    while( ( ent = find_ent_by_tname( ent, "glass_votemap" ) ) )
    {    
    new find_glass_ent=fm_get_brush_entity_origin(ent, origin)
    fm_entity_set_origin(light_ent, find_glass_en)    
    message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    write_byte(TE_DLIGHT);
    write_coord(origin[0]);
    write_coord(origin[1]);
    write_coord(origin[2]);
    write_byte(30);//R 
    write_byte(241);//r
    write_byte(241);//g 
    write_byte(241);//b 
    write_byte(60);//t 
    write_byte(0);//decay *0.1s
    message_end();
   }
}
I guess it doesn't work that way. All i need is to create lights for every window.
DarthMan is offline
pizzahut
Senior Member
Join Date: Oct 2004
Old 02-25-2017 , 12:14   Re: Light Problem
Reply With Quote #13

There seems to be a limit of 32 dynamic lights. If there are more, some will turn off shortly after activation.

This variant creates dynamic lights with a 0.1s pause before creating the next one. It's good for debugging purposes.

The glass_votemap entities are models. They don't have an origin, so the average of the mins and maxs is used instead.

Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_plugin("test","1","pizzahut")     set_task(4.0, "create_light", 0, _, _, "b") } public create_light(ent) {     new Float:mins[3], Float:maxs[3], origin[3]     if ((ent = find_ent_by_tname(ent, "glass_votemap")))     {         entity_get_vector(ent, EV_VEC_mins, mins)         entity_get_vector(ent, EV_VEC_maxs, maxs)         origin[0] = floatround((mins[0] + maxs[0]) / 2.0)         origin[1] = floatround((mins[1] + maxs[1]) / 2.0)         origin[2] = floatround((mins[2] + maxs[2]) / 2.0)         message_begin(MSG_BROADCAST,SVC_TEMPENTITY)         write_byte(TE_DLIGHT)         write_coord(origin[0])         write_coord(origin[1])         write_coord(origin[2])         write_byte(10)  // radius         write_byte(255) // r         write_byte(255) // g         write_byte(255) // b         write_byte(40)  // life time         write_byte(0)   // decay         message_end()         set_task(0.1, "create_light", ent)     } }

Last edited by pizzahut; 02-25-2017 at 12:14.
pizzahut is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode