PDA

View Full Version : Help needed with Create New Object Instance (CNOI)


Aysarth
6th Mar 2017, 1:52 PM
I am trying to add an interaction to a cloned orchard tree which enables a Sim to pick a fruit off the tree and eat it, but I have been failing, for weeks now, to get the fruit to appear in the Sims hand. I have attached the BHAV and error log for my latest attempt of many. It fails, and I don't know why.

N.B. You can see from the two last unused lines of code I have also tried creating the object out of world and putting it in the Sims inventory - this does work, and I can see it there in game. However, if I follow this with the snap into hand command nothing happens - and no error message is generated either.

I cloned the accessory fruit from the chocolate can accessory used by the hot chocolate maker small appliance. This is created - directly into the Sims hand- using CNOI, waved around a bit then deleted using ROI, which is basically what I want to do with the fruit, so the object placement flags of the accessory should already be set correctly.

Please can anyone see what I am doing wrong?

clsve
7th Mar 2017, 7:42 AM
The code in the screenshot has the value of "0A" in operand 4 (CreatePlace) of primitive 2A (CNOI) which is "in user defined slot of object in temp 0". Put in My Hand has the value of "02".
The thrown error is: (Text from Sims Wiki)
8. Undefined Transition
This occurs when a node's true, or false branch lead it to error (a value of 0xFFFC), rather than another line, or ending the BHAV as true(0xFFFD) or false(0xFFFE). The intentional insertion of error(0xFFFC) tests during code development is a useful means of debugging, but ideally these should be removed from production code in favour of either silent error handling routines or the provision of user friendly error messages.
So something has gone wrong as the CNOI returns FALSE and the node leads to Error.

Aysarth
8th Mar 2017, 12:08 PM
Hi clsve

Yes, and operand 3 should set temp 0 to the Sims right hand slot. I had already tried "02" with no result, and with no error message generated.

clsve
9th Mar 2017, 8:47 AM
I have UC and Windows 10 Pro. I have made some "research" using SimPE (version 0_73_44-QA) and its Tool: PJSE/Semantics Resource Finder. I found that there was about 5000 calls to primitive 0x2A (Create New Object Instance) in various Behavior Functions of the game files, most in objects.packkage. Some of them handles interactions similar to your problem (create a new object instance and put it in a hand).

Take a look (in SimPE) at: (The BHAVs are to find in M&G's objects.package).

1. BHAV Event-Clean-Bath (Group: 0x7FE69E23, Instance 0x00002023):
in Nodes 0x14 and 0x16: CNOI create object Accessory - CleaningSponge (Group 7F393639 Guid: 0x5CDEDDC2) with value 0A in operand 4 (place: in user defined slot of object in temp 0)

2. BHAV Event-Clean-Shower (Group: 0x7FE69E23, Instance 0x00002016):
in Node 0x08: CNOI create object Accessory - CleaningSponge (Group 7F393639 Guid: 0x5CDEDDC2) with value 0A in operand 4 (place: in user defined slot of object in temp 0)4.

3. BHAV Event-Clean/Sponge Bath (Group: 0x7F7638B3, Instance: 0x00002017):
in Node 0x03: CNOI create object Accessory - CleaningSponge (Group 7F393639 Guid: 0x5CDEDDC2) with value 0x02 in operand 4 (place: in My hand)

4. BHAV Event - Clean Ball (Group: 0x7FE65F1A, Instance: 0x00001006):
in Node 0x02: CNOI create objectAccessory - Crystal Ball (Group 7F0DA0DE: Guid: 0xAF9A1FCC) with value 0x06 in operand 4 (place: out of world (put new object id in Stack Object),
in Node 0x05: CNOI create object Accessory - CleaningSponge (Group 7F393639 Guid: 0x5CDEDDC2) with value 0x06 in operand 4 (place: out of world (put new object id in Stack Object),

I noted in 1. that Temp 0 was loaded with the value of My 0x000B (object id)) in node 0x11 and in 2. in node 0xD.

Aysarth
10th Mar 2017, 12:47 PM
clsve- Thank you for taking the time and trouble to try to help.

i have taken a close look at BHAV Event - Clean-Bath and copied the codes and settings into my own object. The object does not error out, but also no fruit appears in the Sim's hand. I will take a look at Event-Clean Ball next, but at this stage I am discouraged and beginning to think I should give up on this project.

ankoyume
11th Mar 2017, 8:50 PM
at this stage I am discouraged and beginning to think I should give up on this project.
i don't have time now to look at your package file, but there's some tings you'd better know.

When something doesn't work even though it should, it's often something to do with defining stack object ID and Me ID.
You should look closer to see if "Me" and "stack object" are really what you want them to be after each line of code. Notice that "create an instance" primitive sometimes put the object you've just created in stack object, but sometimes not. It is important to know exactly which is stack object for the "snap into" to work.
And I think it's harder to snap an object into hand after it is put in inventory, so I wouldn't do that. I'd rather use the out of world ... or directly into hand.

N.B : using temps is good, but you must define the temps just before the line of code that use it, because the game often change those temps ...