PDA

View Full Version : Changing simbot behavior


lordredmage
26th Feb 2012, 09:30 PM
Hello everyone, this is my first post here on modthesims but I have been regularly using this site for quite some time now.

Recently I have gotten into writing my own scripting mods to change simbot behavior. Namely the reaction sims have from seeing them (removed it) and their walk animation(fixed to normal walk for child -> elder, need to apply to baby still), but I am having a little trouble with getting them to change clothes like a normal sim.

I can force change their clothes by using NRAAS Master Controller (props for that, it is a thing of beauty), but when they go to sleep / work out / go to a dress-up location they don't automatically change outfits. The thing is, I can't seem to find out how the game determines what occults can and cannot change outfits. I've been looking at the GameplayData.package and the entries for ChangeClothes_Sim and ChangeClothes_Dresser don't seem to have anything that would prevent occult sims from using the interactions.

If anyone can point me in the right direction I would be grateful.
(After this my next change is waterproofing my bots so they can swim!)

lordredmage
3rd Mar 2012, 01:23 AM
Anyone got any ideas? If nothing else, can someone tell me where / how occult statuses are defined, so maybe I can change it there?

velocitygrass
3rd Mar 2012, 09:14 AM
The function DisallowClothesChange() of the OccultManager in the Sims3GameplaySystems.dll returns true for Simbots and Mummies.

lordredmage
4th Mar 2012, 01:53 AM
The function DisallowClothesChange() of the OccultManager in the Sims3GameplaySystems.dll returns true for Simbots and Mummies.

So. . . I guess this means I need to do a core mod for this then? I did some quick reading up on core mods (this site has an awesome core mods for idiots guide), and it only looks a little intimidating. But if that is the route I have to take, then oh well.

On a side note: I (almost) finished waterproofing my simbots by neutering the ShortOut_Sim action, but I'm having trouble with stopping the loss of energy when entering a pool. In GameplayData.package it seems to be located under OccultFrankenstein_0xcblahblah.
<kEnergyWhenInPool value="-90">-->
<!--SimBot's energy will be set to this value when it first enters a pool.--> </kEnergyWhenInPool>
I've tried deleting this section from the _XML, but the effect doesn't seem to go away. Should I just delete the 'value="-90"' part? (will probably try this before a reply hits, but would still like some input)

Again, thank you for helping me out.

EDIT: Ok, I wrote my first core mod, and it works! The only thing is that I get a pop-up warning when I start the game about a custom mod not being for the right version of the code (which is odd).
Still, I would like to thank velocitygrass for pointing me in the right direction. Also BailaBaila99 for writing an awesome tutorial for core mods.

velocitygrass
4th Mar 2012, 07:53 AM
A core mod or a script mod, though a script mod will be more complicated because you have to override existing interactions. Congratulations on getting your first core mod to work. Have you double-checked if the Version and GameVersion values that you entered for the .dll are exactly the same as they are in the original?

As for the kEnergyWhenInPool setting. If you remove the section, the code will use the default value, which is in most cases the same as in the .xml. From the description of the value this seems to be an absolute and not a relative value, so if you want to leave your energy level unchanged when entering water, you'll need a core or scripting mod for that as well, that doesn't reset the energy. This is done in the function SwimmingInPool::InitPosture(bool yield).

lordredmage
4th Mar 2012, 07:28 PM
A core mod or a script mod, though a script mod will be more complicated because you have to override existing interactions. Congratulations on getting your first core mod to work. Have you double-checked if the Version and GameVersion values that you entered for the .dll are exactly the same as they are in the original?

As for the kEnergyWhenInPool setting. If you remove the section, the code will use the default value, which is in most cases the same as in the .xml. From the description of the value this seems to be an absolute and not a relative value, so if you want to leave your energy level unchanged when entering water, you'll need a core or scripting mod for that as well, that doesn't reset the energy. This is done in the function SwimmingInPool::InitPosture(bool yield).

Ok so tooling around I found:


if (this.mSim.SimDescription.IsFrankenstein)
{
this.mSim.Motives.SetValue(CommodityKind.Energy, (float) OccultFrankenstein.kEnergyWhenInPool);
OccultFrankenstein.PushFrankensteinShortOut(this.mSim);
}

So I should just gut this branch of the function?

EDIT: Well, I found the corresponding area in the decompiled code, and it is confusing the hell out of me. I've tried to just delete the whole section, but I get an error when ilasm tries to build it. Any tips on what I need to change:

IL_0228: ldarg.0
IL_0229: ldfld class Sims3.Gameplay.Actors.Sim Sims3.Gameplay.Pools.SwimmingInPool::mSim
IL_022e: callvirt instance class Sims3.Gameplay.CAS.SimDescription Sims3.Gameplay.Actors.Sim::get_SimDescription()
IL_0233: callvirt instance bool Sims3.Gameplay.CAS.SimDescription::get_IsFrankenstein()
IL_0238: brfalse.s IL_0260
IL_023a: ldarg.0
IL_023b: ldfld class Sims3.Gameplay.Actors.Sim Sims3.Gameplay.Pools.SwimmingInPool::mSim
IL_0240: callvirt instance class Sims3.Gameplay.Autonomy.Motives Sims3.Gameplay.Actors.Sim::get_Motives()
IL_0245: ldc.i4 0x10f38d8
IL_024a: ldsfld int32 Sims3.Gameplay.ActorSystems.OccultFrankenstein::kEnergyWhenInPool
IL_024f: conv.r4
IL_0250: callvirt instance void Sims3.Gameplay.Autonomy.Motives::SetValue(valuetype Sims3.Gameplay.Autonomy.CommodityKind, float32)
IL_0255: ldarg.0
IL_0256: ldfld class Sims3.Gameplay.Actors.Sim Sims3.Gameplay.Pools.SwimmingInPool::mSim
IL_025b: call void Sims3.Gameplay.ActorSystems.OccultFrankenstein::PushFrankensteinShortOut(class Sims3.Gameplay.Actors.Sim)

lordredmage
5th Mar 2012, 12:25 AM
Ok, finally got it.
First try I changed the brfalse.s to brtrue.s on the IsFrankenstein() check, and while that did remove the change in energy for the simbots, everyone else entering a pool suffered from it. (lol)
So I tried a few other things out, and figured out that if I changed the check from IsFrankenstein() to IsMummy() both simbots and normal people are no longer affected.
As an odd bonus, Mummies are also exempt somehow. So I'll call it neutered for now.
Thanks everyone!

Now my simbots can swim, shower, change outfits, and eat scrap as early as teens (haven't tried children yet, but I fear the animation may get all weird.).

velocitygrass
5th Mar 2012, 09:53 AM
I'm glad you got it to work. It's strange that you couldn't remove the whole section. Maybe there's a jump to an address in this section further up. In the brfalse.s line in the section above this? If so, you might only need to change that address to IL_0260 to make the code skip to the next section.

dannyast87
22nd Sep 2012, 09:42 PM
I try to create a "Super Sim" combining all hidden states. The problem is that having the hidden state of Simbot and Mummy will not let me tranform into a werewolf by the inability to change clothes. I have looked at how to core mod, but I refused to program and can not find how to change the command in the file .IL. Help!