Posts: 75
Thanks: 5108 in 99 Posts
13 Achievements
Help with python script
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
Code:
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
Code:
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
Code:
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:
Code:
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
Quote:
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?