Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Test Subject
Original Poster
#1 Old 30th Aug 2018 at 12:13 PM
Default Custom buff creation
Hi. I need custom buffs for my script mod. Some of them should be invisible, some should be visible, all of them with timeout.

I've downloaded Zerbu's tool and created some buffs there with correct default duration, but I've not found how to make them invisible.

Anyway, the question is: how to control those buffs from script, how to reference them? I don't know any internal names, and I don't even know how to reference EA-created buffs. Could please someone give me example code for, say, adding and removing EA and custom buff?
Advertisement
Test Subject
Original Poster
#2 Old 30th Aug 2018 at 8:59 PM
Ok, I've found out how to find out resource ID's of custom buffs (using s4pe). I even managed to attach custom buff to a sim. But I can't see how to set timeout for that buff: in Zerbu's tool I've set default timeout, but being added via script buff doesn't have one.
Deceased
#3 Old 31st Aug 2018 at 6:07 AM
In SimLotto I set buffs using a loot action and they timeout properly. Here's a snip from that showing how that functions:
Code:
        manager = services.get_instance_manager(Types.ACTION)
        sim_info = services.sim_info_manager().get(int(SIMLOTTO_PLAYER))
        if SIMLOTTO_PAYOUT > 0:
            client = services.client_manager().get_first_client()
            household = client.household
            household.funds.add(SIMLOTTO_PAYOUT, Consts_pb2.TELEMETRY_MONEY_CHEAT)
            if SIMLOTTO_PAYOUT > 50000:
                loot_to_add = manager.get(10486602114294631761)
        . . .
        . . .
        if loot_to_add:
            resolver = SingleSimResolver(sim_info)
            loot_to_add.apply_to_resolver(resolver)


Setting that via a loot action lets you do more than just that with a single script call as well, for instance that loot action referenced (10486602114294631761) adds the Happy_HugeWin buff and also removes any lesser or sad buffs at the same time.
Test Subject
Original Poster
#4 Old 4th Sep 2018 at 12:01 PM
Hm, I've created loot actions with Zerbu's Mod Constructor and was able to add buffs with them. But:

1) buffs are created invisible. They are working, just invisible without setting .visible= True with script. That's not good
2) loot actions adds buffs successfully, but they fail to remove buffs
3) (probably same issue as 2) timeout is there now, but buffs aren't disappear after timeout counts to zero. Maybe buffs I've created are indestructible in some reason?
Test Subject
Original Poster
#5 Old 4th Sep 2018 at 1:23 PM
Ok, I figured out (1), buffs with mood weight equal to 0 are created with visible = False by Mod Constructor. But 2 and 3 are serious issues for me and aren't solved yet
Test Subject
Original Poster
#6 Old 5th Sep 2018 at 1:07 PM
As a temporary solution I decided to remove buffs via script, not via loot
Deceased
#7 Old 6th Sep 2018 at 11:03 AM
Quote: Originally posted by Renha
3) (probably same issue as 2) timeout is there now, but buffs aren't disappear after timeout counts to zero. Maybe buffs I've created are indestructible in some reason?


Are you using the latest test version of Zerbu's constructor version 3? If not then this could be a major source of your problems as version 2 of the mod constructor is quite outdated and can produce XML that no longer works properly in the game. Other than that, I'm not sure why any buff you're setting up could be unremovable via a loot action but removes properly using a script. Invalid XML could definitely cause that kind of behavior though, and a scripted removal would ignore any XML errors in the loot action.
Back to top