- Site Map >
- Modding and Creation >
- Sims 2 Creation >
- Object Creation >
- Object Creation Workshop & Repair Center >
- Add item to Inventory?
- Site Map >
- Modding and Creation >
- Sims 2 Creation >
- Object Creation >
- Object Creation Workshop & Repair Center >
- Add item to Inventory?
Replies: 22 (Who?), Viewed: 12069 times.
#1
13th Nov 2011 at 9:16 PM
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
#2
14th Nov 2011 at 3:34 AM
Last edited by xiaoyun : 14th Nov 2011 at 9:34 AM.
Posts: 53
Thanks: 488 in 1 Posts
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)
; get current active sim nID to temp(0)
0 [prim 0x0002] Expression(StackObjectID 0x0000:=Global 0x0003 (SelectedPersonID)) T:1 F:F
0x0002 : 0000030000050A060000000000000000 T:1 F:F
1 [prim 0x0002] Expression(Temp0x0000:=StackObject's persondata 0x001F(neighborid)) T:2 :F:F
0x0002 : 00001F00000508130000000000000000 T:2 F:F
; guid of item which we want give to sim
2 [prim 0x002A] Create New Object Instance (GUID 0x8B2ED8D9,
place: out of world (put new object id in Stack Object),
Create object normally,
fail if tile is non-empty: False,
pass Temp 0 to main: False,
move in a new Sim: False,
copying design mode materials from object in Temp 5: False) T:3 F:E
0x002A : D9D82E8B0600FF010000000001000000 T:3 F:E
3 [prim 0x0033] ManageInventory(AddTokenAndInstanceInfoofStackObject (includecontainedobjects),
Category: 0x0C - visible non-memory,
Inventory (singular): Neighbor: Temp 0x0000) T:4 F:E
0x0033 : 13080000109199730F0C190000190000 T:4 F:E
4 [prim 0x0012] Remove Object Instance (Stack Object,
return immediately: False,
cleanup all: False) T:T F:E
0x0012 : 01000200000000000000000000000000 T:T F:E
(It uses only primitives so should be any EP compatible)
; get current active sim nID to temp(0)
0 [prim 0x0002] Expression(StackObjectID 0x0000:=Global 0x0003 (SelectedPersonID)) T:1 F:F
0x0002 : 0000030000050A060000000000000000 T:1 F:F
1 [prim 0x0002] Expression(Temp0x0000:=StackObject's persondata 0x001F(neighborid)) T:2 :F:F
0x0002 : 00001F00000508130000000000000000 T:2 F:F
; guid of item which we want give to sim
2 [prim 0x002A] Create New Object Instance (GUID 0x8B2ED8D9,
place: out of world (put new object id in Stack Object),
Create object normally,
fail if tile is non-empty: False,
pass Temp 0 to main: False,
move in a new Sim: False,
copying design mode materials from object in Temp 5: False) T:3 F:E
0x002A : D9D82E8B0600FF010000000001000000 T:3 F:E
3 [prim 0x0033] ManageInventory(AddTokenAndInstanceInfoofStackObject (includecontainedobjects),
Category: 0x0C - visible non-memory,
Inventory (singular): Neighbor: Temp 0x0000) T:4 F:E
0x0033 : 13080000109199730F0C190000190000 T:4 F:E
4 [prim 0x0012] Remove Object Instance (Stack Object,
return immediately: False,
cleanup all: False) T:T F:E
0x0012 : 01000200000000000000000000000000 T:T F:E
#3
19th Nov 2011 at 3: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.
Attached files:
Phaenoh_DesignMajor.rar (9.6 KB, 16 downloads) - View custom content | ||||||||||
Size Packed Ratio Date Time Attr CRC Meth Ver ------------------------------------------------------------------------------- Phaenoh_DesignMajor.package 25817 9769 37% 18-11-11 21:47 .....A. 851E00BD m3b 2.9 ------------------------------------------------------------------------------- 1 25817 9769 37% |
#4
19th Nov 2011 at 12: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?)
#5
19th Nov 2011 at 10: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.
Attached files:
Phaenoh_DesignMajor.rar (10.1 KB, 9 downloads) - View custom content | ||||||||||
Size Packed Ratio Date Time Attr CRC Meth Ver ------------------------------------------------------------------------------- Phaenoh_DesignMajor.package 26996 10233 37% 19-11-11 16:52 .....A. 42FBD61D m3b 2.9 ------------------------------------------------------------------------------- 1 26996 10233 37% |
#6
20th Nov 2011 at 6:32 AM
Could you show me one of the supplies objects that you're trying to spawn?
#7
20th Nov 2011 at 9: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.
The code right now is some chair that xiaoyun suggested.
#8
20th Nov 2011 at 10:01 PM
Last edited by xiaoyun : 21st Nov 2011 at 1:40 AM.
Posts: 53
Thanks: 488 in 1 Posts
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.
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.
#9
21st Nov 2011 at 10: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?
#10
22nd Nov 2011 at 7:32 AM
Posts: 53
Thanks: 488 in 1 Posts
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.
Ok, im just looking into this now and will tell you soon what i have found.
#11
22nd Nov 2011 at 7: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.
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.
#12
22nd Nov 2011 at 8:20 AM
Last edited by xiaoyun : 22nd Nov 2011 at 4:14 PM.
Posts: 53
Thanks: 488 in 1 Posts
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 >,<
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 >,<
#13
22nd Nov 2011 at 9: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?
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?
#14
24th Nov 2011 at 2:05 AM
Last edited by xiaoyun : 24th Nov 2011 at 3:04 AM.
Posts: 53
Thanks: 488 in 1 Posts
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.
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.
#15
24th Nov 2011 at 2: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.
#16
24th Nov 2011 at 8: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)
Attached files:
ObjectError_F001_t126807.rar (10.7 KB, 5 downloads) - View custom content | ||
Size Packed Ratio Date Time Attr CRC Meth Ver ------------------------------------------------------------------------------- ObjectError_F001_t126807.txt 59385 10857 18% 24-11-11 01:20 .....A. D05CBE0A m3b 2.9 ------------------------------------------------------------------------------- 1 59385 10857 18% |
#17
24th Nov 2011 at 8: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?
Is Delilah your sim?
#18
24th Nov 2011 at 5: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.
Here's my current mess of code.
Attached files:
Phaenoh_DesignMajor.rar (10.1 KB, 5 downloads) - View custom content | ||||||||||
Size Packed Ratio Date Time Attr CRC Meth Ver ------------------------------------------------------------------------------- Phaenoh_DesignMajor.package 27150 10279 37% 24-11-11 00:59 .....A. 5F7D5E3F m3b 2.9 ------------------------------------------------------------------------------- 1 27150 10279 37% |
#19
24th Nov 2011 at 7:40 PM
Posts: 53
Thanks: 488 in 1 Posts
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.
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.
(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.
Attached files:
Phaenoh_DesignMajor_Test1.zip (10.4 KB, 8 downloads) - View custom content | ||||||||||
27035 11-24-11 20:25 Phaenoh_DesignMajor.package -------- ------- 27035 1 file |
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.
#20
25th Nov 2011 at 5:08 AM
Last edited by Phaenoh : 25th Nov 2011 at 8: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.
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.
Attached files:
Phaenoh_ProductDesignMajor.rar (10.1 KB, 8 downloads) - View custom content | ||||||||||
Size Packed Ratio Date Time Attr CRC Meth Ver ------------------------------------------------------------------------------- Phaenoh_ProductDesignMajor.package 26852 10227 38% 25-11-11 03:06 .....A. C05B8E89 m3b 2.9 ------------------------------------------------------------------------------- 1 26852 10227 38% |
#21
25th Nov 2011 at 6:31 PM
Posts: 53
Thanks: 488 in 1 Posts
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.
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.
#22
26th Nov 2011 at 6: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?
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?
#23
2nd Dec 2011 at 6: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....
Who Posted
|