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!
Inventor
Original Poster
#1 Old 5th Dec 2020 at 3:34 PM Last edited by echoweaver : 6th Dec 2020 at 4:38 PM.
Default Indefinite interactions (like fishing)
....Soooo much like fishing it's actually fishing.

So, I have a functional fishing skill for cats with the bare minimum of features I'd like to have in it.

Source code on Github: https://github.com/Echoweaver/Sims3...CatFishingSkill
(Note the package file is also there. It should just drop in and run with the current state of the mod. This is my way of tracking the assets and package resources.)

What I'm trying to add now is an indefinite version of the fishing interaction for cats, much like one fishes with human sims -- an interaction that has multiple modes of Fish Indefinitely, Fish for X number Fish, and Fish until Skill Increases.

There are two things wrong with what I'm doing now: there's no interaction icon popping up in the upper left at all, much less one that I could drag to enlarge and pick a mode. I haven't created/specified specific icons for the interaction. I was assuming I could just point to the human fishing icons while I work on other stuff. It's possible that this doesn't work, so I'm not as worried about the icon yet.

Secondly, and what I've been pulling my hair out on, is that the action freezes after running through the animations once. The GAME doesn't freeze. My other test sims continue to wander around doing things autonomously. The fishing sim just seems to freeze and never come back.

Alternately, the fishing cat just resets at the end of the first loop. I'm not actually sure which it's doing in the current code.

This seems similar to what Lyralei talks about on this thread: https://modthesims.info/showthread.php?t=645786

However, I haven't been able to pull anything out of that thread that fixes my problem. I've tried the 4th parameter to the DoLoop method. I don't think I understand how DoLoop works. I assume initially that it was just a while loop wrapped in more game infrastructure, but in one of Lyralei's threads, she mentions the loop function being called once a second. What does it mean for the 4th parameter to DoLoop to notify on simMinutes? What notification?

I modeled my "Fish a While" interaction pretty heavily on the FishHere interaction for humans, so I'm getting pretty baffled.

Does anyone have insight?
Attached files:
File Type: zip  CatFishingSkill.package.zip (31.3 KB, 7 downloads)

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Advertisement
Inventor
Original Poster
#2 Old 8th Dec 2020 at 12:33 AM
I don't suppose anyone looked at this? I saw a couple of folks downloaded anyway. I realize there aren't all that many folks who could help.

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Scholar
#3 Old 8th Dec 2020 at 2:55 AM
I'm also having some problems with animation looping.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Inventor
Original Poster
#4 Old 8th Dec 2020 at 2:04 PM
PuddingFace: I've wondered if it's possible to loop without the DoLoop method with just an ordinary while loop. I haven't tried it yet. That seems like the wrong way to do it, though.

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Virtual gardener
staff: administrator
#5 Old 8th Dec 2020 at 5:38 PM
Assuming from the comments, the Jazz script is working but the code doesn't have a proper exit? it would explain the 'freezing' animations  

So, as an example, For the sewing table I basically did this for the project:

Code:
        public static bool IsComplete
      {
         get
         {
            return Progress >= 1f;
         }
      }
      public static float Progress;

      public void Loop(StateMachineClient smc, LoopData loopData)
            {
               Definition definition = base.InteractionDefinition as Definition;
            // Add a little bit to the 'Progress' var till it reaches '1.0f' (Aka, IsComplete)
               Progress += loopData.mDeltaTime / kBaseMinTimeMakeSewable;
               
               if(IsComplete)
               {
                  base.Actor.AddExitReason(ExitReason.Finished);
               }
            }
I deleted a whole bunch, but this is basically a bare-bone version of it  We need to give the code a reason to stop looping.

So, Loop in my case would stop looping once it reaches '1f'. as well with the (which is really important to add!) base.Actor.AddExitReason(ExitReason.Finished);

Really in the Loop function, we need some variable that won't trigger after the first time, but basically is being built up till you want the sim to finish  Sometimes this could even work with using something like:

Code:
if(RandomUtils.RandomChance(0.3f)
{
   base.Actor.AddExitReason(ExitReason.Finished);
}
and voila!  I also explained a little about it right here: https://modthesims.info/showthread.php?t=642029
Inventor
Original Poster
#6 Old 9th Dec 2020 at 12:54 PM
Lyralei: I'm creating a new interaction, but I'm using the animation from the old interaction, so I'm not providing a custom jazz script.

So, the freezing animation comes from a lack of proper exit? I'm confused about when the animations would loop rather than freezing to wait for an exit.

Hmmmm.... I wonder if I don't understand the way animations work. I have a sequence of animations: prepounce, fish, and exit as either success or failure. I assumed that if there was no exit, the animation sequence would start again from the beginning. Is this not true? I know there are animations that loop indefinitely -- does DoLoop expect one of those? Is there a way to do a series of animations over and over again until exit?

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Senior Moderator
staff: senior moderator
#7 Old 9th Dec 2020 at 9:20 PM
I think the problem might be because in the jazz script the state FishLoop (despite the name), doesn't appear to be a looped state. It has "Properties Public, Explicit" rather than "Properties Public, Loop, Explicit" which 
PrePounceLoop does actually have. So I'm not sure why it's called FishLoop, because nothing there is looped :P
What actually happens, is the PrePounceLoop has 4 states it can transition to - 2 of which are states with waiting animation which then loop back to PrePounceLoop, and 1 that goes to an exit animation (probably from cancelling) and then one which is the Pounce animation, which then leads to FishLoop. And FishLoop has 3 states which are animations for fishing with a success, with a fail, and with eating.

So you might need to make a custom jazz script if you want that to loop :P
Although I wonder if you could use a while loop and just have AnimateSim(FishLoop) or whatever, and check if they have gained a skill/caught 5 fish etc. Though I'm not sure how you could do the exiting for bad motives with that.
Inventor
Original Poster
#8 Old 11th Mar 2021 at 5:38 PM
I'm back and I have something working.

The only ACTUAL animation loop that can run indefinitely in this state machine is PrePounceLoop, even though FishLoop has loop in the name.

I think the lesson learned is that calling AnimateSim on any animation with "Exit" in the name, ie "ExitInventory" seems to exit the state machine or at least make it impossible to loop within in.

I tried everything on this thread and from two Discord developer threads, and the only thing that worked was to abandon the DoLoop method used by the human indefinite FishHere interaction and just manually loop on my own method. My LoopAnimation method enters and exits the state machine with each iteration.

To my surprise, this seems to work perfectly. It can be canceled in the middle just as I would expect. The indefinite, catch 5 fish, fish until skill increase settings seem to work.

Quote: Originally posted by zoe22
I think the problem might be because in the jazz script the state FishLoop (despite the name), doesn't appear to be a looped state. It has "Properties Public, Explicit" rather than "Properties Public, Loop, Explicit" which
PrePounceLoop does actually have. So I'm not sure why it's called FishLoop, because nothing there is looped :P
What actually happens, is the PrePounceLoop has 4 states it can transition to - 2 of which are states with waiting animation which then loop back to PrePounceLoop, and 1 that goes to an exit animation (probably from cancelling) and then one which is the Pounce animation, which then leads to FishLoop. And FishLoop has 3 states which are animations for fishing with a success, with a fail, and with eating.


I would love to have a better idea on how you were able to deep dive into the jazz script here. I'd love to have a better idea of what my options might be for further refinement.

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Senior Moderator
staff: senior moderator
#9 Old 11th Mar 2021 at 9:37 PM
http://www.simlogical.com/ContentUp...te/uploads/842/
Smooth jazz! You can open the JazzData package (found in game files) with this tool and find the jazz script for the interaction/object
Back to top