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!
Scholar
Original Poster
#1 Old 14th Dec 2020 at 12:36 AM
Default Jazz Script issues
So in my Enhanced Witches mod Dueling between Adults and Children cause stretching. So I tried to fix it by editing the Jazz Script to add a new parameter.





Actors:Age is the parameter. Adult_Adult, Adult_Child, Child_Adult are the 3 values that this parameter can have. And I copied and renamed the adult and child dueling animations so the child animations had a ...._child_x and adult ones had ..._adult_x etc. These animations I thought will not stretch because the adult side only has the adult version and the child side only has the child version so I thought no stretching will happen. But it's still happening. I don't know if the parameter is working and the new animations are being used or not.

Code:
if (Actor.SimDescription.Child && Target.SimDescription.Child)
                    {
                        base.SetParameter("Actors:Age", "Adult_Adult");
                    }
                    else if (Actor.SimDescription.TeenOrAbove && Target.SimDescription.TeenOrAbove)
                    {
                        base.SetParameter("Actors:Age", "Adult_Adult");
                    }
                    else if (Actor.SimDescription.TeenOrAbove && Target.SimDescription.Child)
                    {
                        base.SetParameter("Actors:Age", "Adult_Child");
                    }
                    else if (Actor.SimDescription.Child && Target.SimDescription.TeenOrAbove)
                    {
                        base.SetParameter("Actors:Age", "Child_Adult");
                    }


And this is what I added in the script of the mod. I thought this would work but it's not.

I'm not sure why @Lyralei you know about Jazz Scripts a lot more so do you know what I need to do?
Screenshots

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
Advertisement
Virtual gardener
staff: administrator
#2 Old 14th Dec 2020 at 12:13 PM
Jazz scripts are a bit interesting to get used to, because the mistake you made I did exactly the same thing :p

So, just to get it out of the way and inform others on how setParameters() actually work, when thinking about parameters (and how we handle the info given from our C# script > Jazz) has the following road to travel. I'll use the treehouse as an example:

Code:
 public void SetParametersForPart(UsableParts part)
        {
            switch (part)
            {
            case UsableParts.BalconyA:
                base.mCurrentStateMachine.SetParameter("isMirrored", true);
                break;
            case UsableParts.BalconyB:
                base.mCurrentStateMachine.SetParameter("isMirrored", false);
                break;   
      }
}
We've got one SetParameter that returns 'true' and the other 'false' 

If we look at the original code for 'SetParameter' we see the following:

Code:
 public void SetParameter(string paramName, bool paramValue)
{
    if (paramValue)
    {
        SetParameter(paramName, YesOrNo.yes);
    }
    else
    {
        SetParameter(paramName, YesOrNo.no);
    }
}
What it does is, it converts our boolean to the actual words 'No' and 'yes'. But why? Well:

(inside the jazz script for treehouse: )
Code:
 Parameter "IsMirrored" = "yes"
Yes, being of course, the default setting for it. But it will change since our script might have communicated that it's a 'No'. So in the case of this:

Code:
Select on Parameter "IsMirrored"
        {
            Value "no"
            {
                Play "a2o_treehouse_balconySit_start_treehouse" for "treehouse"
                {
                    Track Mask "TreehouseDoorMask"
                }
                Play "a2o_treehouse_balconySit_start_x" for "x"
            }
            Value "yes"
            {
                Play "a2o_treehouse_balconySit_start_treehouse" for "treehouse"
                {
                    Track Mask "TreehouseDoorMask"
                }
                Play "a2o_treehouse_balconySit_start_mirror" for "x"
            }
        }
It basically says 'Did the C# script return a 'yes' then do that animation, if it's no, then do the other.' So, with Jazz scripts always remember the C# script communicates to the Jazz script. Not the other way around

Anyways! back to your question  x:Age is also a derived parameter from our C# 'data' so to speak. There's a reason why you usually don't see EA specifying age in their 'setParameters()' and that's because it's already been given to the Jazz script. So I'd assume you can even do something like:

Code:
State "MagicStuffs"
{
   Transitions to "Exit"
   Select on Parameter "x:Age"
   {
       Value "adult"
       {
            //Blah blah
       }
           Value "elder"
               {
                   // Blah blah
            }
            Value "young_adult"
            {
                //Blah Blah
            }
        Value "child"
         {
            //Blah blah
       }
   }
      Select on Parameter "y:Age"
   {
       Value "adult"
       {
            //Blah blah
       }
           Value "elder"
               {
                   // Blah blah
            }
            Value "young_adult"
            {
                //Blah Blah
            }
        Value "child"
         {
            //Blah blah
       }
   }
}
That way you don't have to derive it the way you're doing it right now  Alternatively, you could also do the following:

Code:
base.SetParameter("Actors:Age",  Actor.SimDescription.TeenOrAbove);
And then just do, instead of "Adult_Adult" you use the notations I showed above ("adult", "elder" etc). 
Scholar
Original Poster
#3 Old 14th Dec 2020 at 3:42 PM
@Lyralei Thank you so much It seems like creating a true or false boolean will be easier. IsChild yes or no. Doing it with x:age or y:age will make the jazz script really really long.

Can you help me do it correctly?

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
Virtual gardener
staff: administrator
#4 Old 14th Dec 2020 at 10:08 PM
Quote: Originally posted by PuddingFace
@Lyralei Thank you so much It seems like creating a true or false boolean will be easier. IsChild yes or no. Doing it with x:age or y:age will make the jazz script really really long.

Can you help me do it correctly?
Doesn't actually have to be!  Because from the looks of it, you're basically checking "If child vs adult" or "If adult vs adult" or even "child vs child" right?

Technically, just by doing the following should already do the trick:
[*]
Code:
[*]State "MagicStuffs"[*]{[*]   Transitions to "Exit"[*]   Select on Parameter "x:Age"[*]   {[*]       Value "adult"[*]       {[*]            //Blah blah[*]       }[*]        Value "child"[*]         {[*]            //Blah blah[*]       }[*]   }[*]    Select on Parameter "y:Age"[*]   {[*]       Value "adult"[*]       {[*]            //Blah blah[*]       }[*]        Value "child"[*]         {[*]            //Blah blah[*]       }[*]   }[*]
Not too sure if you need the whole "Elder, young adult, etc" stuff. I don't think so? but it's worth testing! But for the Jazz this is really all you need. Else I don't think there is really a smaller way of doing it :/
Scholar
Original Poster
#5 Old 14th Dec 2020 at 11:45 PM
For now I am going to do x:IsChild y:IsChild boolean. I think it will be easier.

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
Scholar
Original Poster
#6 Old 16th Dec 2020 at 11:20 PM
It's working!



Screenshots

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
Back to top