Post by sigma1202 on Aug 4, 2019 21:15:42 GMT -5
So i am trying to override the "off grid" power cut functionality, but i am having difficulty doing so.
the first thing i tried is running this script
But it doesn't seem to have any effect while off the grid is set as the household trait
then i tried this one
This one actually worked, it brought the power back on, but it also brought back the plumbing which i didn't want, examining the "stop()" function i found the moment where it turn on the plumbing and power
its inside: zone_modifier.zone_modifier_household_actions
it looks like this
Now, when i try to call the "stop_action" function the sims 4 gives me a last exception. I think i am not calling it correctly?
Here's where i am now, with the last exception:
also here's the last exception i am getting
Has anyone any ideas on how to bring back electricity without the plumbing?
the first thing i tried is running this script
import sims4.commands
import services
@sims4.commands.Command('poweron', command_type=sims4.commands.CommandType.Live)
def turnonthepower(_connection=None):
household_id = services.owning_household_id_of_active_lot()
services.utilities_manager(household_id).restore_utility(0, 0)
But it doesn't seem to have any effect while off the grid is set as the household trait
then i tried this one
import sims4.commands
import services
@sims4.commands.Command('pooweron', command_type=sims4.commands.CommandType.Live)
def turnonthepower(_connection=None):
services.get_zone_modifier_service().stop()
This one actually worked, it brought the power back on, but it also brought back the plumbing which i didn't want, examining the "stop()" function i found the moment where it turn on the plumbing and power
its inside: zone_modifier.zone_modifier_household_actions
it looks like this
from sims.household_utilities.utility_operations import ShutOffUtilityModifier
from sims4.tuning.tunable import TunableVariant, TunableList, HasTunableSingletonFactory, AutoFactoryInit
class ZoneModifierHouseholdActionVariants(TunableVariant):
def __init__(self, *args, **kwargs):
super().__init__(*args, shut_off_utilities=ZoneModifierHouseholdShutOffUtility.TunableFactory(), default='shut_off_utilities', **kwargs)
class ZoneModifierHouseholdAction(HasTunableSingletonFactory, AutoFactoryInit):
def start_action(self, household_id):
raise NotImplementedError
def stop_action(self, household_id):
raise NotImplementedError
class ZoneModifierHouseholdShutOffUtility(ZoneModifierHouseholdAction):
FACTORY_TUNABLES = {'utilities': TunableList(description='\n A list of utilities to shut off.\n ', tunable=ShutOffUtilityModifier.TunableFactory())}
def start_action(self, household_id):
for utility_shut_off in self.utilities:
shut_off = utility_shut_off()
shut_off.start(household_id)
def stop_action(self, household_id):
for utility_shut_off in self.utilities:
shut_off = utility_shut_off()
shut_off.stop(household_id)
Now, when i try to call the "stop_action" function the sims 4 gives me a last exception. I think i am not calling it correctly?
Here's where i am now, with the last exception:
from zone_modifier.zone_modifier_household_actions import stop_action
import sims4.commands
import services
@sims4.commands.Command('poweron', command_type=sims4.commands.CommandType.Live)
def turnthepoweron(_connection=None):
household_id = services.owning_household_id_of_active_lot()
stop_action(household_id)
also here's the last exception i am getting
The listed script mod failed to load and should be removed or updated. Failure: 'example_mod' (example_mod) (ImportError: cannot import name 'stop_action' from 'zone_modifier.zone_modifier_household_actions' (F:\sims 4\Data\Simulation\Gameplay\simulation.zip\zone_modifier\zone_modifier_household_actions.pyc))
Has anyone any ideas on how to bring back electricity without the plumbing?