AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Light Problem (https://forums.alliedmods.net/showthread.php?t=294284)

DarthMan 02-24-2017 02:30

Light Problem
 
Hello. I have a poblem on my mapm I can't spawn the light.
Someone told me that u can't sawn lights, but I am not sure.
Any help would be appreciated !
Thanks !

Code:

    new ent_light_1 = create_entity("light");
    DispatchSpawn(ent_light_1);
    DispatchKeyValue(ent_light_1, "style", "0");
    DispatchKeyValue(ent_light_1, "_light", "241.0,241.0,241.0,150.0");
    entity_set_origin(ent_light_1,Float:{-433.0,952.0,-165.0});
    entity_set_string(ent_light_1,EV_SZ_classname,"light");
    entity_set_string(ent_light_1,EV_SZ_targetname,"light_render");
    entity_set_string(ent_light_1,EV_INT_flags, "0");{241.0,241.0,241.0});


abdobiskra 02-24-2017 03:46

Re: Light Problem
 
Hi
You want spawn the light in some texteure in the map ?

DarthMan 02-24-2017 03:50

Re: Light Problem
 
Quote:

Originally Posted by abdobiskra (Post 2497989)
Hi
You want spawn the light in some texteure in the map ?

I mean spawn it at a given position, but ye, it would be cool if you could make it spawn 44 lights, for each entity by target name glass_votemap , a light on center top of the window entity. Each light should have the targetname set to light_render.

abdobiskra 02-24-2017 08:35

Re: Light Problem
 
I was looking for the components i have made in the past but lost
but as i remember its like this :
PHP Code:

public create_light(origin[3])
{
    
    
origin[0] = 5origin[1] = -2224origin[2] = -1803

    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(255);//r
    
write_byte(0);//g 
    
write_byte(0);//b 
    
write_byte(60);//t 
    
write_byte(20);//decay *0.1s
    
message_end();



DarthMan 02-24-2017 08:38

Re: Light Problem
 
Quote:

Originally Posted by abdobiskra (Post 2498060)
I was looking for the components i have made in the past but lost
but as i remember its like this :
PHP Code:

public create_light(origin[3])
{
    
    
origin[0] = 5origin[1] = -2224origin[2] = -1803

    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(255);//r
    
write_byte(0);//g 
    
write_byte(0);//b 
    
write_byte(60);//t 
    
write_byte(20);//decay *0.1s
    
message_end();



I don't want it to be a temp entity, I would like it to be in the map forever after it was added , and when the map starts again it shouldn't be there untill it is added.
Well basically the lights will be added after voting for the map is ready.

abdobiskra 02-24-2017 08:42

Re: Light Problem
 
Quote:

Originally Posted by DarthMan (Post 2498061)
I don't want it to be a temp entity, I would like it to be in the map forever after it was added , and when the map starts again it shouldn't be there untill it is added.
Well basically the lights will be added after voting for the map is ready.

You can revive it using set_task ?

DarthMan 02-24-2017 08:51

Re: Light Problem
 
Quote:

Originally Posted by abdobiskra (Post 2498063)
You can revive it using set_task ?

Ah great. 1 more thing I require is, let's say the map panel is called panel_x.
How could I then add a model for every panel with the size of the panel?
The models will basically be map images, and they should be loaded from mapvote_maps.ini .
It should pick a different map for eac panel, adn if more than 44 maps are in the ini it shouldn't repeat any of them, so for each panel a different map, if there are less than 44 maps, it should repeat depending on how many maps are in the ini etc. So if I ahve 15 maps for example it should repeat 3 tmes, so 15 maps, 15 maps and 14 for 44 panels to be filled. Thanks!

DarthMan 02-24-2017 09:46

Re: Light Problem
 
Quote:

Originally Posted by DarthMan (Post 2498061)
I don't want it to be a temp entity, I would like it to be in the map forever after it was added , and when the map starts again it shouldn't be there untill it is added.
Well basically the lights will be added after voting for the map is ready.

Here I need some help :

Code:

public create_light(origin[3])
{
    while( ( ent= find_ent_by_tname( ent, "glass_votemap" ) ) )
    {
    origin[0] = 5, origin[1] = -2224, origin[2] = -165
    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(255);//r
    write_byte(0);//g
    write_byte(0);//b
    write_byte(60);//t
    write_byte(20);//decay *0.1s
    message_end();           
    }
}

I want origin[0] and origin[1] to be the origins of the window entity, and so to assign a light for each entity with the glass_votemap name. Thanks !

abdobiskra 02-24-2017 11:46

Re: Light Problem
 
just get origin :
when you aiming to this window ! say /get
PHP Code:

public plugin_init() {

   
register_clcmd("say /get","Get")
}
public 
Get(id){
   new 
origin[3]
   
get_user_origin(idorigin3)
   
client_print(idprint_chat"origin ------> %d %d %d",origin[0],origin[1],origin[2])



DarthMan 02-24-2017 11:48

Re: Light Problem
 
Quote:

Originally Posted by abdobiskra (Post 2498116)
just get origin :
when you aiming to this window ! say /get
PHP Code:

public plugin_init() {

   
register_clcmd("say /get","Get")
}
public 
Get(id){
   new 
origin[3]
   
get_user_origin(idorigin3)
   
client_print(idprint_chat"origin ------> %d %d %d",origin[0],origin[1],origin[2])



No it's not that. Basically what I want is I created a task : set_task(6.0, "create_light", 0, "", 0, "b", 0).
On that task I want to automatically create lights for every glass_votemap entity.


All times are GMT -4. The time now is 20:46.

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