|
Post by Flerb on Dec 10, 2017 21:24:40 GMT -5
hey all, I'm putting together my first xml mod this weekend, figured out a lot of things by reverse engineering some other mods but i'm stuck. The goal is to override the "loot_Buff_Fire_Singed_HygieneDecrease" to automatically add my CAS burn scars skin detail to sims when they survive a fire. Here's my CAS modthesims.info/download.php?t=597048so far the following is working (i've been burning a lot of sims for science): The override action adds a visible trait > the trait gives the sim a hidden buff which changes the CAS skin detail to my scars. It actually works! this xml placed in the override IS also working to add the scars by chance, i.e. there's a 50% chance the sim gets the trait and CAS assigned: <V t="trait_add"> <U n="trait_add"> <T n="trait">15922850084989543648<!--trait_right100--></T> </U> <U n="chance"> <T n="base_chance">50</T> </U> </V> however, when I add another trait to the code, both traits are assigned according to the last chance, i.e. both traits are assigned 90% of the time, the first base_chance is ignored. <V t="trait_add"> <U n="trait_add"> <T n="trait">15922850084989543648<!--trait_right100--></T> </U> <U n="chance"> <T n="base_chance">0</T> </U> </V> <V t="trait_add"> <U n="trait_add"> <T n="trait">15771698387283226715<!--trait_left100--></T> </U> <U n="chance"> <T n="base_chance">90</T> </U> </V> perhaps I need to nest things differently? Or is there a tuning I can extract that shows an example of assigning traits by chance? Any ideas would be appreciated!
|
|
|
Post by Basemental on Dec 11, 2017 3:38:04 GMT -5
What you can do is make two different trait add action loots with a 100% base chance, and add a dual outcome to the interaction that assigns the action loots like this:
<V t="dual" n="outcome"> <U n="dual"> <U n="failure_actions"> <L n="loot_list"> <T>0000000000000000000<!--Loot Buff - trait_right100--></T> </L> </U> <U n="success_actions"> <L n="loot_list"> <T>0000000000000000111<!--Loot Buff - trait_left100--></T> </L> </U> <U n="success_chance"> <T n="base_chance">90</T> </U> </U> </V>
This will make sure you will always get one of them with a 90% chance you will get the one defined in the success_chance and 10% for the failure one.
|
|
|
Post by Flerb on Dec 11, 2017 15:55:28 GMT -5
Oh interesting thanks! I plan on having many more than 2 outcomes, perhaps as many as 12 (likely less). Do you know if this would this work in a nested fashion?
|
|
|
Post by Basemental on Dec 11, 2017 15:59:14 GMT -5
You could also use Tested Outcomes instead of Dual Outcomes, but the dual outcomes only dictate 1 success and 1 failure outcome. The Potential Outcomes of the Tested Outcomes is dictated by the test underneath each potential outcome, usually blacklisted or whitelisted buffs or traits.
But you can also put Tests directly in your Action Tuning instead and have outcomes there if you want to add the outcomes dictated by buffs or traits.
One thing I suspect might work better with your first example is (bare in mind I have not tried this out, as I have not used trait add loots with more than one trait, but I think it will work as it would with buffs)
<V t="trait_add"> <U n="trait_add"> <T n="trait">15922850084989543648<!--trait_right100--></T> </U> <U n="chance"> <T n="base_chance">20</T> </U> </V> <V t="trait_add"> <U n="trait_add"> <T n="trait">15771698387283226715<!--trait_left100--></T> </U> <U n="chance"> <T n="base_chance">100</T> </U> <L n="tests"> <L> <V t="trait"> <U n="trait"> <L n="blacklist_traits"> <T>15922850084989543648<!--trait_right100--></T> </L> </U> </V> </L> </L> </V>
In this example, this will give you a 20% chance of getting that first trait, and if you get it that second trait won't be added because the first one mentioned in the tuning is blacklisted in the test of the second one. If you however won't get that first one, the second one will be added with a 100% certainty.
You can use that creatively to get the result you are after with 12 different potential outcomes directly in the action loot tuning I think.
|
|
|
Post by Flerb on Dec 11, 2017 23:29:54 GMT -5
Excellent! Got it, adding tests was my next hunch before posting here, but I had only seen it with buffs. I'm going to be giving it a go soon.
|
|
|
Post by Basemental on Dec 12, 2017 8:45:11 GMT -5
Best of luck with it
|
|
|
Post by Flerb on Dec 12, 2017 17:24:26 GMT -5
turns out the tests doesn't seem to work with adding traits. I may have a solution based on your first suggestion tho, I'll post it here if it works.
|
|
|
Post by Basemental on Dec 12, 2017 17:51:17 GMT -5
It seems like the tests for trait add action loots is set up a bit differently, if you look at the tuning for loot_Trait_Rando_Fruitcake it is set up like this:
<I c="LootActions" i="action" m="interactions.utils.loot" n="loot_Trait_Rando_Fruitcake" s="119724"> <L n="loot_actions"> <V t="trait_add"> <U n="trait_add"> <U n="chance"> <T n="base_chance">30</T> </U> <L n="tests"> <L> <V t="trait"> <U n="trait"> <L n="blacklist_traits"> <T>124839<!--trait_Hidden_Hates_FruitCake_Controller--></T> <T>27176<!--trait_Foodie--></T> <T>16843<!--trait_Glutton--></T> <T>9620<!--trait_Snob--></T> <T>119187<!--trait_Hidden_Hates_Fruitcake--></T> <T>119186<!--trait_Hidden_Likes_Fruitcake--></T> </L> </U> </V> </L> </L> <T n="trait">119186<!--trait_Hidden_Likes_Fruitcake--></T> </U> </V>...
|
|
|
Post by Flerb on Dec 15, 2017 0:42:36 GMT -5
yep the format from the fruitcake works! I never saw that because it's named rando not 'random' which i had searched for. I also was looking at the xml that assigns random buffs to moody teens and children which appears to use a weighted system.
weird behavior with the chances plus black lists: with two traits and two chances it was clear enough to set the first trait to 50% and the next to 100% to result in a 50-50 chance, but when it comes to 3+ traits I cannot seem to comprehend how it's calculating the chance percentages. For example, setting the chances as 33, 50, then 100 resulted in ~45% ~15% ~40% in game (after 20 trials).... Other settings resulted in similarly weird results in game. Setting them to 33%, 33%, then 100% finally seems to result in an exact even 1/3 chance for all 3 traits. I'd assume the pattern continues so for 4 traits 25, 25, 25, 100.
here's the code for anyone interested:
<V t="trait_add"> <U n="trait_add"> <U n="chance"> <T n="base_chance">33</T> </U> <L n="tests"> <L> <V t="trait"> <U n="trait"> <L n="blacklist_traits"> <T>15771698387283226715<!--Flerb_scarredtrait_Trait_left100--></T> <T>15922850084989543648<!--Flerb_scarredtrait_Trait_right100--></T> <T>17134930008162446762<!--Flerb_scarredtrait_Trait_Full100--></T> </L> </U> </V> </L> </L> <T n="trait">15922850084989543648<!--Flerb_scarredtrait_Trait_right100--></T> </U> </V> <V t="trait_add"> <U n="trait_add"> <U n="chance"> <T n="base_chance">33</T> </U> <L n="tests"> <L> <V t="trait"> <U n="trait"> <L n="blacklist_traits"> <T>15771698387283226715<!--Flerb_scarredtrait_Trait_left100--></T> <T>15922850084989543648<!--Flerb_scarredtrait_Trait_right100--></T> <T>17134930008162446762<!--Flerb_scarredtrait_Trait_Full100--></T> </L> </U> </V> </L> </L> <T n="trait">15771698387283226715<!--Flerb_scarredtrait_Trait_left100--></T> </U> </V> <V t="trait_add"> <U n="trait_add"> <U n="chance"> <T n="base_chance">100</T> </U> <L n="tests"> <L> <V t="trait"> <U n="trait"> <L n="blacklist_traits"> <T>15771698387283226715<!--Flerb_scarredtrait_Trait_left100--></T> <T>15922850084989543648<!--Flerb_scarredtrait_Trait_right100--></T> <T>17134930008162446762<!--Flerb_scarredtrait_Trait_Full100--></T> </L> </U> </V> </L> </L> <T n="trait">17134930008162446762<!--Flerb_scarredtrait_Trait_Full100--></T> </U> </V>
|
|
|
Post by Basemental on Dec 15, 2017 3:59:26 GMT -5
That makes sense though, seeing that the first trait add is read first, so it works like this: You get a 33% chance that the first one is added, if it is you won't get the 2 next no matter what due to the blacklisted tests. If you won't get the first one, there is a 33% chance you will get the second, if you do you won't get the last due to the blacklisted test. If you won't get the second one you will get the 3rd one guaranteed.
So, you are right on the assumption that if you want to add 4 tests with a 25% chance you need to do 1st 25% 2nd 25% 3rd 25% 4th 100% - With the corresponding blacklists obviously
This obviously doesn't explain why 33, 50, 100 resulted in 45, 15, 40. I am curious how you came to that conclusion. Was there at any point no traits assigned? I am skeptical about doing 20 trials to determine that outcome as RNG is always a factor with percentage chances.
|
|
|
Post by Flerb on Dec 17, 2017 21:51:59 GMT -5
i'm just not sure, some other combinations I tried like 33 33 33 resulted in strange unexpected behaviors. I didn't write it down, but I have a tally sheet where some combination resulted in 50 50 0. in short I could only figure it doesn't seem to read the traits linearly from top to bottom. However much progress has been made this week I might be able to update the mod tonight! thanks again for your help!
|
|
|
Post by Basemental on Dec 18, 2017 6:12:42 GMT -5
Sounds weird. I guess your best option would be to work it into the actual interaction instead then.
|
|
|
Post by Flerb on Dec 22, 2017 18:24:36 GMT -5
|
|
|
Post by Flerb on Jan 28, 2018 17:50:45 GMT -5
hey everyone, I noticed a bug in my mod, i just don't know my way around the XML well enough to fix it.
Basically, these automatic scars are designed to decay over time using a statistic. When the decay runs down to 0 it triggers a "loot action on removal" which clears the buffs/traits and replaces them with healed traits/buffs. But it only triggers the removal while a sim is on the active lot. When sims are off screen, the decay still runs to 0 but it gets stuck there without triggering the removal. Is there a way to force it to trigger the removal if it's at zero, like a less than or equal function? or perhaps initializing it with a higher value than zero so it can decay? Here's the xml as is
<?xml version="1.0"?> <I c="Commodity" i="statistic" m="statistics.commodity" n="Flerp_scarredtrait_Loot_comm" s="12778294151255613560"> <T n="_default_convergence_value">0</T> <T n="_time_passage_fixup_type">FIXUP_USING_TIME_ELAPSED</T> <U n="arrow_data"> <T n="negative_double_arrow">-20</T> <T n="negative_single_arrow">-1</T> <T n="negative_triple_arrow">-30</T> <T n="positive_double_arrow">20</T> <T n="positive_single_arrow">1</T> <T n="positive_triple_arrow">30</T> </U> <T n="auto_satisfy_curve_random_time_offset">1728</T> <T n="decay_rate">1</T> <U n="initial_tuning"> <T n="_use_auto_satisfy_curve_as_initial_value">False</T> <T n="_use_stat_value_on_init">True</T> <T n="_value">1728</T> </U> <T n="max_value_tuning">1728</T> <T n="min_value_tuning">0</T> <L n="states"> <U> <U n="buff"> <V n="buff_reason" t="enabled"> <T n="enabled">0xC30E9123</T> </V> <T n="buff_type">15513148231618139955<!--Flerp_asd_Loot_severetimer--></T> </U> <T n="value">0</T> </U> </L> </I>
|
|
|
Post by Basemental on Feb 23, 2018 5:24:55 GMT -5
I just noticed you uploaded your sunburns mod the other day. Really cool idea and it looks as if it's extremely well implemented! Looking forward to try it out
|
|