Raised This Month: $32 Target: $400
 8% 

[Solved] How to make this darkness effect?


Post New Thread Reply   
 
Thread Tools Display Modes
Guren
Senior Member
Join Date: Feb 2011
Location: Equestria, Ponyville
Old 11-24-2012 , 08:07   Re: How to make this darkness effect?
Reply With Quote #11

Quote:
Originally Posted by Leonardo View Post
and it is working for 10 seconds?
or not working at all? if so, try add AcceptEntityInput(Ambient,"TurnOn");

no.. it's still not working at all too.

Code:
public Darkness(client, Float:Time)
{
	new Float:clientposition[3];
	GetClientAbsOrigin(client, clientposition);
	new Ambient = CreateEntityByName("env_fog_controller");
	if(IsValidEntity(Ambient))
	{
		new String:positionstring[128], String:colorstring[128];
		
		Format(positionstring, 128, "%f %f %f", clientposition[0], clientposition[1], clientposition[2]);

		Format(colorstring, 128, "%d %d %d %d", 255, 255, 255, 255);

		DispatchKeyValue(Ambient, "fogcolor", "0 0 0");
		DispatchKeyValue(Ambient, "fogcolor2", "0 0 0");
		DispatchKeyValue(Ambient, "fogenable", "1");
		DispatchKeyValueFloat(Ambient,"fogstart", 200.0);
		DispatchKeyValueFloat(Ambient,"fogend", 10000.0);
		DispatchKeyValueFloat(Ambient,"fogmaxdensity", 1.0);
		DispatchKeyValueFloat(Ambient, "fogblend", 10.0);
		DispatchKeyValue(Ambient, "foglerptime", "10");
		DispatchKeyValue(Ambient, "farz", "-1");
		DispatchSpawn(Ambient);
		
		AcceptEntityInput(Ambient,"TurnOn");
	}
}
__________________

Nick : Chamamyungsu // Korean Brony

Last edited by Guren; 11-24-2012 at 08:21.
Guren is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 11-24-2012 , 18:53   Re: How to make this darkness effect?
Reply With Quote #12

env_fog_controller doesn´t work on some maps........
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
Guren
Senior Member
Join Date: Feb 2011
Location: Equestria, Ponyville
Old 11-25-2012 , 02:20   Re: How to make this darkness effect?
Reply With Quote #13

Quote:
Originally Posted by andi67 View Post
env_fog_controller doesn´t work on some maps........
omg
__________________

Nick : Chamamyungsu // Korean Brony
Guren is offline
Despirator
Senior Member
Join Date: Jun 2011
Location: Kazakhstan ->Shymkent
Old 11-25-2012 , 04:17   Re: How to make this darkness effect?
Reply With Quote #14

you need to spawn fog_controller on level init
Despirator is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 11-25-2012 , 05:49   Re: How to make this darkness effect?
Reply With Quote #15

Quote:
Originally Posted by andi67 View Post
env_fog_controller doesn´t work on some maps........
because of master env_fog_controller, eh?
(see VDC -> env_fog_controller -> flags)
Leonardo is offline
Guren
Senior Member
Join Date: Feb 2011
Location: Equestria, Ponyville
Old 11-25-2012 , 06:36   Re: How to make this darkness effect?
Reply With Quote #16

Quote:
Originally Posted by Despirator View Post
you need to spawn fog_controller on level init
what is level init?
__________________

Nick : Chamamyungsu // Korean Brony
Guren is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 11-25-2012 , 07:04   Re: How to make this darkness effect?
Reply With Quote #17

As far as I remember before OB-Update it worked on all maps , since OB the map must have buildin fogcontroller ........
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
Neobenedict
Junior Member
Join Date: Nov 2011
Old 11-25-2012 , 08:00   Re: How to make this darkness effect?
Reply With Quote #18

You're doing it wrong :-
1) Don't create a new fog controller. Change an existing one (if it exists - check for this, otherwise continue to make one).
2) Why are you parenting (teleporting) it to a player? env_fog_controller covers the entire map.
3) You need to detect if there's a fog controller /before/ loading the map, and if there isn't make one beforehand. (OnMapStart)

Last edited by Neobenedict; 11-25-2012 at 08:12.
Neobenedict is offline
Guren
Senior Member
Join Date: Feb 2011
Location: Equestria, Ponyville
Old 11-25-2012 , 13:00   Re: How to make this darkness effect?
Reply With Quote #19

Quote:
Originally Posted by Neobenedict View Post
You're doing it wrong :-
1) Don't create a new fog controller. Change an existing one (if it exists - check for this, otherwise continue to make one).
2) Why are you parenting (teleporting) it to a player? env_fog_controller covers the entire map.
3) You need to detect if there's a fog controller /before/ loading the map, and if there isn't make one beforehand. (OnMapStart)
oooooo... it's still not working


Code:
new Fogindex = -1;

public OnMapStart()
{
	Fog_Check();
}

public Darkness(number)
{
	if(number == 0) // OFF
		AcceptEntityInput(Fogindex, "TurnOff", Fogindex, Fogindex, 0);
	else if(number == 1) // ON
	{
		AcceptEntityInput(Fogindex, "StartFogTransition", Fogindex, Fogindex, 0);
		SetVariantInt(100);
		AcceptEntityInput(Fogindex, "SetStartDist", Fogindex, Fogindex, 0);
		SetVariantInt(200);
		AcceptEntityInput(Fogindex, "SetEndDist", Fogindex, Fogindex, 0);
		SetVariantString("0 0 0");
		AcceptEntityInput(Fogindex, "SetColor", Fogindex, Fogindex, 0);
		DispatchKeyValueFloat(Fogindex, "fogmaxdensity", 1.0);
		AcceptEntityInput(Fogindex, "TurnOn", Fogindex, Fogindex, 0);
	}
	PrintToChatAll("Fogindex : %d", Fogindex);
}

Fog_Check()
{
	new index = -1;
	Fogindex = -1;
	while((index = FindEntityByClassname(index, "env_fog_controller")) != -1)
	{
		Fogindex = index;
		break;
	}
	if(Fogindex == -1)
	{
		Fogindex = CreateEntityByName("env_fog_controller");
		DispatchSpawn(Fogindex);
	}
}
__________________

Nick : Chamamyungsu // Korean Brony
Guren is offline
Mitch
Junior Member
Join Date: Aug 2011
Old 11-25-2012 , 14:21   Re: How to make this darkness effect?
Reply With Quote #20

seeing how ive had this code since halloween
Code:
#include <sourcemod>
#include <sdktools>

new FogIndex = -1;
new Float:mapFogStart = 0.0;
new Float:mapFogEnd = 175.0;
new Float:mapFogDensity = 1.0;

public OnPluginStart()
{
    RegAdminCmd("sm_fogoff", fogoff, ADMFLAG_ROOT, "");
    RegAdminCmd("sm_fogon", fogon, ADMFLAG_ROOT, "");
}
public OnMapStart()
{
    new ent; 
    ent = FindEntityByClassname(-1, "env_fog_controller");
    if (ent != -1) 
    {
        FogIndex = ent;
    }
    else
    {
        FogIndex = CreateEntityByName("env_fog_controller");
        DispatchSpawn(FogIndex);
    }
    DoFog();
    AcceptEntityInput(FogIndex, "TurnOff");
}

public Action:fogoff(client, args)
{AcceptEntityInput(FogIndex, "TurnOff");}    

public Action:fogon(client, args)
{AcceptEntityInput(FogIndex, "TurnOn");}

DoFog()
{
    if(FogIndex != -1) 
    {
        DispatchKeyValue(FogIndex, "fogblend", "0");
        DispatchKeyValue(FogIndex, "fogcolor", "0 0 0");
        DispatchKeyValue(FogIndex, "fogcolor2", "0 0 0");
        DispatchKeyValueFloat(FogIndex, "fogstart", mapFogStart);
        DispatchKeyValueFloat(FogIndex, "fogend", mapFogEnd);
        DispatchKeyValueFloat(FogIndex, "fogmaxdensity", mapFogDensity);
    }
}
This should do what you are trying to do, or atleast replicate what i saw in the video

Last edited by Mitch; 11-25-2012 at 14:25.
Mitch is offline
Reply


Thread Tools
Display Modes

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 07:48.


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