Replies: 22 (Who?), Viewed: 9789 times.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#1 Old 13th Nov 2011 at 10:16 PM
Default Add item to Inventory?
Ok, I hate the search function, it never seems to find me anything useful anymore.

I'm sure this is a relatively simple question, but my google-kung-fu has failed me. I'm working on a Major right now, and I want it to automatically purchase a few class supplies for me each time my sim makes it to the next semester. What BHAVs do I need to create an object in the inventory? I don't actually know where I need to stick them yet, but I imagine I can find it out easy enough.
Advertisement
Test Subject
#2 Old 14th Nov 2011 at 4:34 AM Last edited by xiaoyun : 14th Nov 2011 at 10:34 AM.
This will put item of guid 0x8B2ED8D9 (which is some chair) into current active sim inventory
(It uses only primitives so should be any EP compatible)

Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#3 Old 19th Nov 2011 at 4:24 AM
I'm using the code from adding the diploma to the inventory at the end and I stuck my code in in the same function that does that, but I don't think it's even being called.
Download - please read all instructions before downloading any files!
File Type: rar Phaenoh_DesignMajor.rar (9.6 KB, 11 downloads) - View custom content
Retired Duck
retired moderator
#4 Old 19th Nov 2011 at 1:17 PM
Quote:
Originally Posted by Phaenoh
I'm using the code from adding the diploma to the inventory at the end and I stuck my code in in the same function that does that, but I don't think it's even being called.


Which BHAVs are you working on? Function - Next Semester? If so, then it's almost certainly not getting called. The call sequence for that is:
TTAB -> Interaction - At Class -> Function - Grading -> Function - Next Semester. As is, the game will still be calling the original, semi-global versions of the functions.

(Also, I think you're missing some BHAVs. "Function - Next Semester" has a whole bunch of broken 0x1??? range BHAV references in it. Your pie menu resources are also still in the global group, although I'm not sure if that was intentional?)
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#5 Old 19th Nov 2011 at 11:15 PM
I reimported the BHAVs that were broken and tried to link everything up properly and rewrote the add to inventory bit like was suggested above and nothing happened when she became a sophomore.
Download - please read all instructions before downloading any files!
File Type: rar Phaenoh_DesignMajor.rar (10.1 KB, 9 downloads) - View custom content
Retired Duck
retired moderator
#6 Old 20th Nov 2011 at 7:32 AM
Could you show me one of the supplies objects that you're trying to spawn?
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#7 Old 20th Nov 2011 at 10:06 PM
'The Stacks' from FT, 0x73EB1B68. No custom objects, just things from FT or UNI or base. One career reward, the Architecture Drafting Desk, 0xB3FD5372

The code right now is some chair that xiaoyun suggested.
Test Subject
#8 Old 20th Nov 2011 at 11:01 PM Last edited by xiaoyun : 21st Nov 2011 at 2:40 AM.
Sorry for no reply earlier
I lost this thread somewhere and though it was solved allready,
but i see echo came to the rescue <waves>

Any findings ?

I think if we would agree to make global hook into this as a entry point (?)
then it would be enought to extract (0x7F17E3A4) 0x0000200C and leave it global.
Then make another copy of it but local one. (so we have two bhav's now)
Then at begining of global one, check major type - if its custom (its related to Uni majors project btw?)
then call our local modified clone which will give gifts related to this custom major ect,
and if its original major then just let it continue on unmodified global bhav.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#9 Old 21st Nov 2011 at 11:05 PM
I'd rather not make this a global mod. It should be able to be self contained. Any idea why my code isn't working?
Test Subject
#10 Old 22nd Nov 2011 at 8:32 AM
I allready knew the answer so it was rather question than solution.

Ok, im just looking into this now and will tell you soon what i have found.
Retired Duck
retired moderator
#11 Old 22nd Nov 2011 at 8:46 AM
Alas, I don't have free time, so that doesn't help me a lot. My reason for asking is that you're running a "CT" function on it from the major. Does your spawned object have a "CT - Init" BHAV in it? If not, you probably want to cut that line out.

If that doesn't work, then it's time to verify that the code is actually being run. Stick some "return error"s in there, and make sure you actually get the errors you're expecting.
Test Subject
#12 Old 22nd Nov 2011 at 9:20 AM Last edited by xiaoyun : 22nd Nov 2011 at 5:14 PM.
You very rite Echo from begining The code is not being run.
I was worried about it too, thats where from my previous idea came.

EDIT :
I turn enthusiastic too fast...
This really need alot of breakpoints, and since loading time of SimPE + game for each break point
(including not that small amount of code) it would need really a lot of time and effort and i think
it would be better to just find another way.

Maybe it help what i have found until now -
Lets suppose that it really have to use pie menu then OBJD's 0x0007 looks ok,
Life time would be - it "start self" then init, enters main loop which is allready in MajorGlobals and is shared betwin all majors,
(i assume "function - main" should keep which stack it run in (our) so theoreticaly at this point importing everything would
change not much) then its like : main --> sub - process() --> here it looks like still runing in own stack, checking for sim
and push interaction and alternatively calls another Sub - Goto Class(), (only these two trees use push interaction in MajorGlobals)
So not a bad idea would be import these 4 functions to have it localy main() / sub process() / sub - goto class()
and additionally "function - next semester" to have ability to alter it as private.
(Ofcourse there are also other ways to force other objects to do what we want than just push interaction but then theres more and more...)
Anyway what confuse me is line 0x3 in sub - goto class() which is not really clear to me and shows theres something "more".
and this "more" i think really would need breakpoints to find.
Anyway, more i analyze it more feeling i have that this "mayor creation method" is like a container
and is not really accurate as controller.

Theres no impossible things to do (but if effect will be worth the effort is another story)
So, theres 2 ways i would consider if i would want to accomplish what we want here,
1 - change the way how additional majors are build to fit it better to "live object" form, or
2 - make a separate controller which (in addition to this mod) would monitor if sim went to exam,
then after he back, evaluate his performance and give him what we want ect.
(and ofcourse it would destroy self / not run in any other lot than college)
I think the 2nd way would be more pleasant and give true feeling of unbounded creativity and new ideas,
than digging for hours in maxis code to find out which exacly "just one parameter" is wrong >,<
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#13 Old 22nd Nov 2011 at 10:48 PM
Ok, I have proof that my code is being run. I changed some text box entries on the local level.

I'm trying a new object, seeing if that helps. Now I'm aiming for that little wooden sim sculpture. Its a basegame object. It doesn't have a CT - Init line in it, nor in its painting semi-globals.

Well that was interesting. I added a couple extra messages and it seems like the object is being created and added just fine, just not to my sim's inventory. I had a text box use $me in it and it popped up with this random townie. I bet he has a little wooden sculpture in his inventory now. How do I make it use my sim instead?
Test Subject
#14 Old 24th Nov 2011 at 3:05 AM Last edited by xiaoyun : 24th Nov 2011 at 4:04 AM.
Wow, Grats !

Because $Me refers to "thread" in which current function is running and this not necessarily must be your sim (or even any sim)
You may try to "find" sim by yourself and refer to him with SO instead of $Me

First browse every sim on lot
0x001F Set to Next (Stack Object,person)
then think about something that is unique in your sim, and get only the one which "have this unique something" or look for another sim.

"family member" can be unique to playable sims, (theyre not visitors nor NPC)
0x0002 Expression (SO person data(Person Type) == Const 0x0104:0x00 ("Family Member"))

but there can be more playable (family members) sims on lot then maybe current selected sim
0x0002 Expression (Global (Selected Person ID) == SO person (neighbor id))

just something like this.
Retired Duck
retired moderator
#15 Old 24th Nov 2011 at 3:59 AM
Quote:
Originally Posted by Phaenoh
I had a text box use $me in it and it popped up with this random townie.

Well that's unexpected! Do you, by any chance, have an error log from this point in the code? I'd be very curious to see how that could happen.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#16 Old 24th Nov 2011 at 9:22 AM
So I'm thinking the problem is in the first line of the code in the 'Purchase Wooden Sim' command lines. -> get current active sim nID to temp(0)
Download - please read all instructions before downloading any files!
File Type: rar ObjectError_F001_t126807.rar (10.7 KB, 5 downloads) - View custom content
Retired Duck
retired moderator
#17 Old 24th Nov 2011 at 9:27 AM
I think you and I are looking at different versions of the Purchase Wooden Sim BHAVs... Because I can't see that line anywhere.

Is Delilah your sim?
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#18 Old 24th Nov 2011 at 6:13 PM
My mistake, I thought I was running xiaoyun's suggested code from above, but I guess not. Yes, Delilah O'Feef is my testing sim.

Here's my current mess of code.
Download - please read all instructions before downloading any files!
File Type: rar Phaenoh_DesignMajor.rar (10.1 KB, 5 downloads) - View custom content
Test Subject
#19 Old 24th Nov 2011 at 8:40 PM
Actualy since it run in sim thread, it turned to require only one line to work
(check attached file)


Btw, while giving item, you attempted to reffer to wooden doll by group ID,
while you must provide GUID from wooden doll's OBJD file.
Download - please read all instructions before downloading any files!
File Type: zip Phaenoh_DesignMajor_Test1.zip (10.4 KB, 8 downloads) - View custom content

Although im not english native, it does not exempt me from caring about my grammar, which is usually main reason for editing my posts after submitting.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#20 Old 25th Nov 2011 at 6:08 AM Last edited by Phaenoh : 25th Nov 2011 at 9:09 AM.
Rock on! That works! Thank you. I'll go through and do that with the rest of them and hopefully I don't run into any other problems with it.

Later: So everything is running perfectly, with one exception. Something wonky is happening with the first semester skill requirements and I can't seem to track it down. Even if my sim accomplishes all the required skills, the meter doesn't unlock the top tier. I went back and checked my numbers and it seems fine, so I don't really know what's going on. All the other semesters are fine.
Download - please read all instructions before downloading any files!
File Type: rar Phaenoh_ProductDesignMajor.rar (10.1 KB, 7 downloads) - View custom content
Test Subject
#21 Old 25th Nov 2011 at 7:31 PM
I have made completly new clean game (AGS), without any mods, not even downloads folder, then made new student and send him to college, and seems like i still cant raise this above white line even on default maxis major.
This may be not mod fault, rather i dont know how to play it or something wrong with game itself. Try with completly clean game if its the same for you.
Thats really strange.

Although im not english native, it does not exempt me from caring about my grammar, which is usually main reason for editing my posts after submitting.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#22 Old 26th Nov 2011 at 7:33 AM
I didn't have that experience. All my normal Uni majors work normally.

On a second, larger note. Any ideas how I can implement this type of inventory adding based on semester into the original majors? I tried just importing in those BHAVs, but I ran into the problem that all majors seem to share TTABs and everything else. How do I tell each major to use its new related BHAV Interaction - Next Semester?
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#23 Old 2nd Dec 2011 at 7:33 AM
I've been thinking about this for some time now and I'm still rather stuck on it. It can't just be as easy as cloning each major, Fixing Integrity to be custom, and then importing the Pie Menu and related BHAVs from it without changing their group numbers? I haven't had the time to be able to test that theory yet, its finals week and i should totally be working on my projects, but I can't seem to get this out of my head. But that couldn't work either, because all the majors share the same pie menu functions and changing it in one would replace it with that for all the others and I want different ones for each. But if I give them custom groups, then they won't be called in the first place. I'm just confused....
Back to top