Page 1 of 2

Snowfall for Black Mesa

Posted: Mon Nov 02, 2015 1:30 pm
by Painkiller
Could someone a snowfall plugin writing for Black Mesa?
Greeting Painkiller

Posted: Thu Nov 05, 2015 7:06 pm
by Painkiller
Nobody can help me ?

Posted: Fri Nov 06, 2015 3:20 pm
by Ayuto
I tested L'In20Cible's old snowfall addon with EventScripts on CS:S. Somehow, this was crashing my client when setting the precipitation model. Then I have also tested it with SP and it's crashing as well. We might need to figure out a new way of creating precipitation (or I was too tired yesterday and made a stupid mistake).

Posted: Tue Dec 08, 2015 5:20 pm
by Painkiller
Hi mates,
could someone take a look at it again?

Posted: Wed Dec 09, 2015 3:42 am
by Doldol
Painkiller wrote:Hi mates,
could someone take a look at it again?


This works in CSGO for me, but as said crashes CSS with a C++ error message, maybe CSS does some optimisation @ map compile time?
I guess you could test this out in Black Mesa?

Syntax: Select all

from events import Event
from entities.entity import Entity
from entities.helpers import create_entity
from filters.entities import EntityIter
from engines.server import global_vars
from colors import Color


@Event("round_start")
def round_start(game_event):
for worldspawn in EntityIter("worldspawn"):
break
else:
raise NotImplementedError("No world on round start ~ wut?")
for func_precipitation in EntityIter("func_precipitation"):
if func_precipitation.get_key_value_int("preciptype") == 3:
break
else:
func_precipitation = Entity(create_entity("func_precipitation"))
func_precipitation.set_key_value_string("model", "maps/{0}.bsp".format(global_vars.map_name))
func_precipitation.set_key_value_int("preciptype", 3)
func_precipitation.set_key_value_int("renderamt", 255)
func_precipitation.color = Color(218, 243, 255)
func_precipitation.set_key_value_int("renderfx", 255)
func_precipitation.set_key_value_int("rendermode", 3)
func_precipitation.get_input("Alpha")(250)
func_precipitation.spawn()
func_precipitation.mins = worldspawn.get_property_vector("m_WorldMins")
func_precipitation.maxs = worldspawn.get_property_vector("m_WorldMaxs")
func_precipitation.origin = (func_precipitation.mins + func_precipitation.maxs) / 2

Posted: Mon Dec 14, 2015 5:35 pm
by Painkiller
Does not work under Black Mesa and Half Life 2 Deathmatch

Posted: Mon Dec 14, 2015 6:22 pm
by satoon101
There is no round_start event in either of those games. Try using OnLevelInit instead (untested):

Syntax: Select all

from entities.entity import Entity
from entities.helpers import create_entity
from filters.entities import EntityIter
from colors import Color
from listeners import OnLevelInit


@OnLevelInit
def level_init(map_name):
for worldspawn in EntityIter("worldspawn"):
break
else:
raise NotImplementedError("No world on round start ~ wut?")
for func_precipitation in EntityIter("func_precipitation"):
if func_precipitation.get_key_value_int("preciptype") == 3:
break
else:
func_precipitation = Entity(create_entity("func_precipitation"))
func_precipitation.set_key_value_string("model", "maps/{0}.bsp".format(map_name))
func_precipitation.set_key_value_int("preciptype", 3)
func_precipitation.set_key_value_int("renderamt", 255)
func_precipitation.color = Color(218, 243, 255)
func_precipitation.set_key_value_int("renderfx", 255)
func_precipitation.set_key_value_int("rendermode", 3)
func_precipitation.get_input("Alpha")(250)
func_precipitation.spawn()
func_precipitation.mins = worldspawn.get_property_vector("m_WorldMins")
func_precipitation.maxs = worldspawn.get_property_vector("m_WorldMaxs")
func_precipitation.origin = (func_precipitation.mins + func_precipitation.maxs) / 2

Posted: Mon Dec 14, 2015 7:51 pm
by L'In20Cible
satoon101 wrote:

Syntax: Select all

@OnLevelInit
def level_init(map_name):
for worldspawn in EntityIter("worldspawn"):
break
else:
raise NotImplementedError("No world on round start ~ wut?")
I think I would rather recommend using:

Syntax: Select all

from entities.constants import WORLD_ENTITY_INDEX

@OnLevelInit
def level_init(map_name):
worldspawn = Entity(WORLD_ENTITY_INDEX)

Posted: Mon Dec 14, 2015 7:59 pm
by Mahi
L'In20Cible wrote:I think I would rather recommend using:

Syntax: Select all

from entities.constants import WORLD_ENTITY_INDEX

@OnLevelInit
def level_init(map_name):
worldspawn = Entity(WORLD_ENTITY_INDEX)
And even if WORLD_ENTITY_INDEX didn't exist, I'd say using next() is much more Pythonic than for: break

Posted: Wed Dec 16, 2015 4:16 pm
by Painkiller
satoon101 wrote:There is no round_start event in either of those games. Try using OnLevelInit instead (untested):

Syntax: Select all

from entities.entity import Entity
from entities.helpers import create_entity
from filters.entities import EntityIter
from colors import Color
from listeners import OnLevelInit


@OnLevelInit
def level_init(map_name):
for worldspawn in EntityIter("worldspawn"):
break
else:
raise NotImplementedError("No world on round start ~ wut?")
for func_precipitation in EntityIter("func_precipitation"):
if func_precipitation.get_key_value_int("preciptype") == 3:
break
else:
func_precipitation = Entity(create_entity("func_precipitation"))
func_precipitation.set_key_value_string("model", "maps/{0}.bsp".format(map_name))
func_precipitation.set_key_value_int("preciptype", 3)
func_precipitation.set_key_value_int("renderamt", 255)
func_precipitation.color = Color(218, 243, 255)
func_precipitation.set_key_value_int("renderfx", 255)
func_precipitation.set_key_value_int("rendermode", 3)
func_precipitation.get_input("Alpha")(250)
func_precipitation.spawn()
func_precipitation.mins = worldspawn.get_property_vector("m_WorldMins")
func_precipitation.maxs = worldspawn.get_property_vector("m_WorldMaxs")
func_precipitation.origin = (func_precipitation.mins + func_precipitation.maxs) / 2



This Error come on
Half Life 2 Deathmatch and Black Mesa Source


Syntax: Select all

18:02:26 [SP] Loading plugin 'snow'... 

[SP] Caught an Exception:
Traceback (most recent call last):
File '../addons/source-python/packages/source-python/plugins/manager.py', line 71, in __missing__
instance = self.instance(plugin_name, self.base_import)
File '../addons/source-python/packages/source-python/plugins/instance.py', line 82, in __init__
self._plugin = import_module(import_name)
File '../addons/source-python/plugins/snow/snow.py', line 5, in <module>
from listeners import OnLevelInit

ImportError: cannot import name 'OnLevelInit'


[SP] Plugin 'snow' was unable to be loaded.

Posted: Wed Dec 16, 2015 4:21 pm
by satoon101
Update your Source.Python version.

Posted: Wed Dec 16, 2015 4:24 pm
by Painkiller
:( not yet
but it's ok I know.

Posted: Fri Dec 18, 2015 6:11 pm
by Painkiller
Ok i have the newest SP- Version and plugin load.

No error and not work.

Posted: Fri Dec 18, 2015 9:46 pm
by satoon101
I did test some code, but it only seemed to work on CS:GO. It isn't that it didn't "work" on CS:S, HL2:DM, or BM:S, it actually crashed my client on all 3. If I can get that figured out and fixed, I will post some code. Note that I will certainly test on both BM:S and HL2:DM before posting working code (if I can figure it out).

*Edit: I narrowed down the crashing of the client, but I really don't know why it does it. Here is my test script:

Syntax: Select all

from colors import Color
from entities.constants import WORLD_ENTITY_INDEX
from entities.entity import Entity
from engines.precache import Model
from engines.server import global_vars
from events import Event
from listeners import OnLevelInit
from listeners.tick import tick_delays


@OnLevelInit
@Event('round_start')
def create_snow(*args):
try:
worldspawn = Entity(WORLD_ENTITY_INDEX)
except ValueError:
tick_delays.delay(0, create_snow)
return
func_precipitation = Entity.find_or_create("func_precipitation")
func_precipitation.model = Model("maps/{0}.bsp".format(global_vars.map_name))
func_precipitation.precip_type = 3
func_precipitation.color = Color(218, 243, 255)
func_precipitation.render_mode = 3
func_precipitation.spawn()
func_precipitation.mins = worldspawn.world_mins
func_precipitation.maxs = worldspawn.world_maxs
origin = (func_precipitation.mins + func_precipitation.maxs) / 2
func_precipitation.origin = origin

create_snow()


If I comment out setting the model, the client does not crash, but there is no effect. This code works perfectly on CS:GO. If I comment out setting the model in CS:GO, the effect does not show. So, setting the model is necessary, but crashes the client on CS:S, HL2:DM, and BM:S (probably DOD:S and TF2, as well).


*Edit2: I did notice that in this addon, sicman_adrian uses env_smokestack instead of func_precipitation. This requires multiple entities to be created and for locations to be specified in data files. I will do some testing to see if that works on all games.

Posted: Sat Dec 19, 2015 4:16 pm
by Painkiller
Thanks in Advance

Posted: Wed Dec 23, 2015 3:25 pm
by Painkiller
still no snow :(

Winter is NOT coming !

Posted: Thu Dec 24, 2015 3:24 am
by L'In20Cible

Re: Snowfall for Black Mesa

Posted: Tue Oct 10, 2017 4:54 pm
by Painkiller
Is there any new information?


Code: Select all

18:51:38 sp plugin load snow
18:51:38 [SP] Loading plugin 'snow'...
         
         [SP] Caught an Exception:
         Traceback (most recent call last):
           File "../addons/source-python/packages/source-python/plugins/command.py", line 162, in load_plugin
             plugin = self.manager.load(plugin_name)
           File "../addons/source-python/packages/source-python/plugins/manager.py", line 193, in load
             plugin._load()
           File "../addons/source-python/packages/source-python/plugins/instance.py", line 74, in _load
             self.module = import_module(self.import_name)
           File "../addons/source-python/plugins/snow/snow.py", line 8, in <module>
             from listeners.tick import tick_delays
         
         ImportError: cannot import name 'tick_delays'
         
         
         [SP] Plugin 'snow' was unable to be loaded.

Re: Snowfall for Black Mesa

Posted: Tue Oct 10, 2017 5:25 pm
by Ayuto
That exception is unrelated to the crash mentioned in the previous posts. And since there haven't been any updates to HL2DM I highly doubt it's now working without crashing.

Re: Snowfall for Black Mesa

Posted: Tue Oct 10, 2017 6:30 pm
by Painkiller
This is the current error code when I loaded it.