View Full Version : Adding a Semi-Global BHAV

26th Jan 2009, 11:40 PM
Can you add a BHAV to a semi-global group?

I naively assumed you could - created it - called it from another semi-global BHAV within the same group - SimPE linked them together (i.e. could correctly see the BHAV name in the caller), but in the game it fails with "Bad gosub tree number"

So now I'm thinking it's not as simple as that.

I could just put all my new code in the appropriate place in the existing semi-global BHAV - it just looked tidier wrapped up in it's own function was all.

Also, can you add semi-global BCONs? SimPE only believes they are there if you use the next free number - skip one and it doesn't believe it exists.


27th Jan 2009, 12:30 AM
You can add either type. It's hard to tell why it's not working in your case without seeing the package.

Sorry if this is a silly question, but are you sure you need to modify the global code though?
If this is to support your custom object, then importing the semi-globals into your object is safer. That way you can avoid a lot of the EP checks and hack conflicts.

27th Jan 2009, 11:01 AM
My object has no object, it is a global hack updating what the "Get Dressed" BHAV does when a Sim gets out of the bath/shower. Helpfully this BHAV has not changed since the Base Game so I am saved the usual need to add code to cover different EPs which I have had to do with other semi-global changes. Unfortunately I do not believe there is anyway to avoid a hack conflict with any other hack that changes this BHAV as this is where the code needs to go.

EDIT: Package attached
EDIT: I did something dumb - sometimes you can spend too long looking at something!

Thanks for the confirmation that I am not trying to do something that is known not to be allowed.

EDIT: OK - sorted out my fuddled brain. I think what I hit upon is that there must be an upper limit to the number you can make a semi-global. I decided it is probably a good idea not to simply take the next one free in a group as you will probably be broken by a future EP (although might be a moot point?). However, also you are presumably more likely to clash with another hack. So I picked a random number by taking the hex number representing each letter in MOG (as good as anything before you laugh :giggler: ) which is 0xD (13), 0xF (15) and 0x7 which have me 0x00002DF7 which is high enough not to clash hopefully, but maybe too high.

Using this high number gave me bad gosub so I changed it to the next free one and still got bad gosub (but I hadn't changed it everywhere - doh!).

So now I just wonder what the upper limit is?