Home | Download | Discussion | Help | Site Map | New Posts | Sign in

Latest Site News

Guidelines/Rubrics Changes - posted on 16th Jun 2017 at 5:09 PM
Replies: 18 (Who?), Viewed: 3485 times.
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#1 Old 9th May 2017 at 5:09 PM
Default BHAV check on BCON value (or Add Item to Inventory on Chance Card Outcome)
I'm sure this is an easy question but either I never knew how to do this, or I've since forgotten during my hiatus.

I need a BHAV that checks the value of a BCON and then either does or does not do something based on the value it sees. What does that BHAV look like?

I want to add and item to my sim's inventory based on their chance card result. I'm guessing I can add in a BCON 'Tuning - Chance - Bad - A' and values for it like the skill points and motives, and have my BHAV see if it needs to add the item or not.

If there is a better way to add an item to inventory based on the chance card outcome, I'd love to hear it. Didn't Science peeps have a random chance of bringing home a satellite? I can't seem to find that code.

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Advertisement
Field Researcher
#2 Old 9th May 2017 at 9:42 PM
I don't understand why you want to do it via BCON, as BCON can't be change (not as attributes or locals or parameters ...). However, have you tried the finder "#STR" ou "string" ? Perhaps 'sattelite' should work just right (only if you get a message ingame when you get the sattelite...)

I believe in the "Thanks" button and its amazing powers !!!
Lab Assistant
#3 Old 9th May 2017 at 11:25 PM
I'm not sure I understand what you want to do, but wouldn't this be a simple check done through the Expression command?

I'm http://crispsandkerosene.tumblr.com/ on tumblr, admittedly not very active on MTS.
Instructor
#4 Old 10th May 2017 at 12:28 AM
Test would be done with primitive 0x0002 (Expr) using the "const 0x1001:0x02" style data access

Chance cards are processed in "Sub - Chance Card - Results" (for work cards) and "CT - Hobby Card - Results" (for hobby cards) in the JobDataGlobals (group 0x7F8F4EB6).

Chance card BCONs are typically accessed via an index "const [temp:0]:0x02" due to the job levels having different cards/outcomes (see the code in the two BHAVs given for examples)

The problem I can see is knowing which job(s) have been modified to include the BCONs (entries in existing BCONs) you want to use to store your conditions - as soon as the player uses a custom career without that BCON its "Cancel / Reset / Delete" time

Just call me William, definitely not Who-Ward
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#5 Old 10th May 2017 at 1:05 AM
Maybe I'm going about this the wrong way. I am trying to add an item to their inventory if they pick one one of the two options and had bad luck with the outcome. I only want to do this on specific chance cards. It's part of an entire default replacement career set I'm working on.

As for the custom careers that wouldn't have it, can't I first check to see if the BCON exists, and if not skip over my added parts?

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Lab Assistant
#6 Old 10th May 2017 at 5:11 AM
No you can't check for the existence of a constant without throwing an error when it does not exist. You can however do anything you like with the constants that do exist in every career but are never used. None of the constant tables that pertain to 'Skill - Gardening' are used, they are always 0, sims don't have gardening skill.
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#7 Old 10th May 2017 at 7:06 AM
Ohh, this could be fun!! Thank you both!

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Instructor
#8 Old 10th May 2017 at 8:29 AM Last edited by whoward69 : 10th May 2017 at 9:38 AM.
Quote:
Originally Posted by Chris Hatch
No you can't check for the existence of a constant without throwing an error when it does not exist. You can however do anything you like with the constants that do exist in every career but are never used. None of the constant tables that pertain to 'Skill - Gardening' are used, they are always 0, sims don't have gardening skill.


And hope that no one else has used the same columns.

Someone makes a mod that adds badge skill (robot/toy making, gardening, etc) boosts to certain base game chance cards (eg robot making for the "cut the red or blue wire" one). Even if the mods manage not to conflict, the sim will get an unexpected badge skill boost (albeit probably very small) when using the mod with Phaenoh's customised careers, and will get a Phaenoh's object in their inventory when using a standard career that gives the skill boost in the column also picked by Phaenoh.

(If this was only for one custom career, you may as well check that the GUID of the career the chance card is for matches the GUID of the custom career. That will solve the second issue above, but not the first. However, once you know the chance card is for the custom career, you can look the required data up from a custom career specific BCON, which solves both issues.)

The bigger problem is which BHAV do you over-ride to add the custom code into? Pick either of the two given above and (IIRC) you'll conflict with several commonly used mods that stop job progression (as they have to over-ride those two BHAVs to stop job promotion/demotion from chance cards) - which may or may not be a concern.

HTH

W

Just call me William, definitely not Who-Ward
Lab Assistant
#9 Old 10th May 2017 at 2:46 PM
Yes, absolutely.
Using the extra constants must include job global override(s) so if more than one person uses them they will become incompatible with each other. T&A and A&N already use those constants for a career, any override to the job globals will immediately be incompatible with my game.

When sims begin a career they begin at level 1, that is the lowest level so all of the constants for career level 0 are unused. T&A and A&N use constant 0x1000:0x00 (Tuning - Daily Wages) to indicate that those gardening skill constants are to be used for this career, if it has a value of 1 then use them otherwise don't. We could perhaps all use that constant, give it a value to indicate which code or mod should be used for that career.
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#10 Old 10th May 2017 at 5:09 PM
Less fun, I'd rather not conflict with either of those two heavy hitting popular mods. Is there another way to add an item to the inventory from a chance card outcome?

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Lab Assistant
#11 Old 11th May 2017 at 2:12 PM
There probably is as several op-codes are involved with chance cards but I'm not familiar with what or where those mods are to be able to say for sure.
Instructor
#12 Old 11th May 2017 at 10:51 PM
"Function - Chance Card Decision" in the JobDataGlobals group might have fewer conflicts, but you'd need to hook the many False (Bad) exits up to the code that does whatever you want to do.

Just call me William, definitely not Who-Ward
Lab Assistant
#13 Old 12th May 2017 at 7:21 AM
A&N uses 'Sub - Chance Card - Results' because all of the heavy lifting has already been done, Local:8 already returns the values from the Gardening Skill constants so there's not much more to do. Line 0x36 currently does nothing with the result so we just need to 'tap' into that. The file linked to here includes two files, one named 'CareerAddToInventory-SemiOveride.package' which taps into that and includes the extra code to add an item to the inventory. The other "CareerAddToInventory-Architecture.package' is an example override for the Architecture career. As is it can add both good or bad items and although it's not likely anyone will want to add things for bad chance card results it does keep it flexible enough to be able to. It also reads constant 0x1000:0x00 as a flag, this allow more uses for it to be added later and either/or to be used.

https://app.box.com/s/1bcaje5cp6ergz2xe3hlkfoq2o7dfxyw
Note that this is just an example and not intended for real use, the items added are just random sculptures from various EPs and are not relevant to the career.
Instructor
#14 Old 12th May 2017 at 9:38 AM
Interesting. But it's still going to conflict with Job Stopinator, et al. Unless every modder agrees to include that code in their mods that also over-ride 'Sub - Chance Card - Results' I don't see the advantage. And then modders would need to agree on the meanings of the flags and include each others code that processed those flags - god I miss Lua events from Civilization V

Just call me William, definitely not Who-Ward
Instructor
#15 Old 12th May 2017 at 9:52 AM
Quote:
Originally Posted by Phaenoh
Is there another way to add an item to the inventory from a chance card outcome?


In the modern world, the player's decision from a chance card would trigger an event. Base game code would then listen for that event and perform the standard good/bad result outcomes. Modders would then be able to add their own code to listen for the same event and do additional actions (such as adding an item to inventory). Multiple modders can listen for the same event and do many different things. But Sims 2 isn't in the modern world - the player's decision is detected and runs directly through code. The only way to add something extra into that process is to copy the original code, add in the new action(s) and then replace (ie over-ride) the standard game code. This approach works for exactly one modder (unless the second modder uses the first modder's code as their starting point, etc, etc, etc). Otherwise the player has to decide whether to play with Mod A or Mod B as they conflict. Being late to the party, a lot of my initial research for my few mods has been around "what mods must I NOT conflict with" (or, if I'm going to conflict, how can I reduce that number and/or put non-essential features in separate packages so they can be deleted to avoid the conflict - which is why the non-essential "Pause/Unpause Promotions" options on the paybook are controlled from their own package, and also why the "automatically give teens acne cream" has also been split out).

It's certainly fun, like trekking through a soggy peat bog can be fun!

Just call me William, definitely not Who-Ward
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#16 Old 12th May 2017 at 4:43 PM
Quote:
Originally Posted by Chris Hatch
As is it can add both good or bad items and although it's not likely anyone will want to add things for bad chance card results it does keep it flexible enough to be able to.
Oohh, guess again. That is precisely my plan... *evil grin*

THANK you for that example package. I'm not entirely sure what I'm looking at yet, but I'll compare it to the original architecture career, and then get it in game and between the two I'll wrap my head around it.

Quote:
Originally Posted by whoward69
god I miss Lua events from Civilization V
IIRC, Sims does have some Lua code, but none of us ever really figured much of it out. The base game is where most of it resides.

Sounds like I'm just going to have to suck it up and conflict. I hear you about including aspects of popular mods. I'm also working on new schools atm and I've been scouring the simnet for all the popular fixes to include since they won't be default schools. I'll have to take a look at Job Stopinator and see if I can't accomplish it's same end goal with my careers. Having not looked at it in a while, I'm assuming it simply keeps too many sims from the tops of careers, and if that's mostly all it is, I can do that with harder skill reqs.

Quote:
Originally Posted by Chris Hatch
When sims begin a career they begin at level 1, that is the lowest level so all of the constants for career level 0 are unused. T&A and A&N use constant 0x1000:0x00 (Tuning - Daily Wages) to indicate that those gardening skill constants are to be used for this career, if it has a value of 1 then use them otherwise don't. We could perhaps all use that constant, give it a value to indicate which code or mod should be used for that career.
Does T&A and A&N use all the gardening constants, or just the level 0 ones? How bad is my conflict with your stuff gonna be? Is there a way to 'share' it as I think you are indicating? I'm doing these as a full set of default career overrides. Is yours also defaulted careers, or is it a custom career, or how are you using them? I must admit, I'm not terribly familiar with T&A and A&N.

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Instructor
#17 Old 12th May 2017 at 6:36 PM
Quote:
Originally Posted by Phaenoh
Sims does have some Lua code


It's as related to Lua as Anglo-Saxon is to American English


Just call me William, definitely not Who-Ward
Lab Assistant
#18 Old 13th May 2017 at 2:45 PM
Quote:
Originally Posted by Phaenoh
Does T&A and A&N use all the gardening constants, or just the level 0 ones? How bad is my conflict with your stuff gonna be? Is there a way to 'share' it as I think you are indicating? I'm doing these as a full set of default career overrides. Is yours also defaulted careers, or is it a custom career, or how are you using them? I must admit, I'm not terribly familiar with T&A and A&N.


Don't worry about compatibility with A&N, any worthwhile alteration and/or support for any good mod that I see will be built into A&N and T&A next update, (the code for this is already in the source). T&A uses all of them, at some career levels in T&A the constants are used to give a sim a romantic interlude with a stranger or for a disease for a bad chance choice. They invariably use a hex value of 0x0069 in the constant tables which is why I used 0x0072 (for good) and 0x0074 (for bad) in that example. You could change them to any other value if you prefer, just keep the values in 'Sub - Chance Card - Add to Inventory' consistent with your choice. The reason for a specific value is if a custom career does have some 'junk values' in those constants it's highly unlikely that they'd be those specific values.

I've no idea what a jobstopinator is, nor do I care. The whole purpose of mods is to be able to choose what we want and play our own game our own way. If you do share then it'd pay to mention any mods that you're aware of that it's not compatible with.
As that example is once the semi global override is in the download folder items can be added to sim's inventory via chance for any career, any level, Maxis or custom for both adult and teen/elder careers by just updating and adding the constants. Since it's using otherwise unused constants careers that have been prepared for it will still run error free without the override except the item won't be added into the inventory, so if/when you do share keep the override in a separate file from the career.
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#19 Old 13th May 2017 at 4:22 PM
I'm glad I won't be directly conflicting with your things. I'll stick with the values you've provided. I was wondering why those were the numbers, and now I have my answer.

I looked up the jobinator thing, and I don't mind conflicting with it. It appears to simply be an object you can place in the inventory to prevent further job promotions. The point being, I think, to keep too many sims from the top. I will be addressing that issue myself with my careers, so it won't be needed.

Now it looks like I have a TON of cloning and text editing to do. Why do I never pick small projects?

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Back to top