- Site Map >
- Modding and Creation >
- Sims 4 Creation >
- Modding Discussion >
- Looking for help with a python script
- Site Map >
- Modding and Creation >
- Sims 4 Creation >
- Modding Discussion >
- Looking for help with a python script
Replies: 0 (Who?), Viewed: 2205 times.
#1
14th Dec 2018 at 9:44 PM
Posts: 106
Thanks: 561 in 4 Posts
Looking for help with a python script
Hiya Im making a magic mod and Im trying to make the sim paint only masterpieces with their associated value. This is my first fore into modding with python so please excuse the terrible code. Thank you in advance...The python Code for the spell
Code:
import sims4.commands from crafting.crafting_ingredients import IngredientTuning from crafting.crafting_tunable import CraftingTuning from crafting.recipe import Phase, Recipe import algos import autonomy import distributor import gsi_handlers import mtx import objects.components.types import services import sims4.log import sims4.reload import sims4.resources import telemetry_helper @sims4.commands.Command('WildWitch_MagesandMagic_MaketheItemMasterwork', command_type=sims4.commands.CommandType.Live) def WildWitch_MagesandMagic_MaketheItemMasterwork(self, obj): masterwork_data = self.recipe.masterworks_data logger.debug('Masterwork succeeded', owner='nbaker') self.set_state(CraftingTuning.MASTERWORK_STATE, CraftingTuning.MASTERWORK_STATE_VALUE) if obj is self.original_target: return value_modifiers = self.recipe.simoleon_value_modifiers modifier = 1 for (state_value, value_mods) in value_modifiers.items(): if state_value.state is None: pass elif obj.has_state(state_value.state): actual_state_value = obj.get_state(state_value.state) if state_value == actual_state_value: modifier *= value_mods.random_float() if obj.get_state(CraftingTuning.MASTERWORK_STATE) == CraftingTuning.MASTERWORK_STATE_VALUE: value_multiplier = self.recipe.masterworks_data.simoleon_value_multiplier modifier *= value_multiplier.random_float() if obj.has_state(CraftingTuning.MASTERWORK_STATE) and self.crafter is not None: simoleon_value_skill_curve = self.recipe.simoleon_value_skill_curve if simoleon_value_skill_curve is not None: modifier *= simoleon_value_skill_curve.get_multiplier(SingleSimResolver(self.crafter), self.crafter) if obj.get_state(CraftingTuning.COPY_STATE_VALUE.state) == CraftingTuning.COPY_STATE_VALUE: modifier *= CraftingTuning.COPY_VALUE_MULTIPLIER retail_price = self.recipe.retail_price if self.recipe.base_recipe is not None: retail_price = self.recipe.base_recipe.retail_price self.crafted_value = int(retail_price*modifier) obj.base_value = self.crafted_value @classproperty def masterworks_data(cls): return cls.final_product.masterworks
And for the buff its attached to....
Code:
<U n="game_effect_modifier"> <L n="_game_effect_modifiers"> <V t="affordance_modifier"> <U n="affordance_modifier"> <L n="affordances"> <T>38890<!--canvas_PaintPainting_Staging_Large--></T> <T>13129<!--canvas_PaintPainting_Staging_Medium--></T> <T>99758<!--canvas_PaintPainting_Staging_Medium_Angry--></T> <T>99760<!--canvas_PaintPainting_Staging_Medium_Confident--></T> <T>99761<!--canvas_PaintPainting_Staging_Medium_Flirty--></T> <T>99762<!--canvas_PaintPainting_Staging_Medium_Playful--></T> <T>99764<!--canvas_PaintPainting_Staging_Medium_Sad--></T> <T>40764<!--canvas_PaintPainting_Staging_Practice--></T> <T>38889<!--canvas_PaintPainting_Staging_Small--></T> <T>200428<!--sketchpad_Staging_Paint_Medium--></T> <T>200336<!--sketchpad_Staging_Paint_Small--></T> <T>200429<!--sketchpad_Staging_Paint_Large--></T> </L> <L n="basic_extras"> <V t="state_change"> <U n="state_change"> <V n="timing" t="immediately"/> <V n="new_value" t="single_value"> <U n="single_value"> <T n="new_value">30178<!--CanvasSalability_Gallery--></T> </U> </V> <E n="state_change_target">CraftingObject</E> </U> </V> <V t="do_command"> <U n="do_command"> <V n="timing" t="at_beginning"/> <L n="arguments"> <V t="participant"> <U n="participant"> <E n="argument">CraftingObject</E> </U> </V> </L> <T n="command">WildWitch_MagesandMagic_MaketheItemMasterwork</T> </U> </V> </L> </U> </V> </L> </U>
Who Posted
|