Welcome to
Mod The Sims
Online: 2279
News:
Have an account? Sign in:
pass:
If you don't have an account, why not sign up now? It's free!
Other sites: SimsWiki
Reply  Replies: 10 (Who?), Viewed: 2509 times.
Search this Thread
Old 15th Jan 2012, 11:40 PM DefaultInstanceName #1
douglasveiga
Original Poster

Field Researcher

Join Date: Oct 2011
Posts: 333
Thanks: 7122 in 7 Posts
9 Achievements


i cloned the "Flamingo", then i just changed the InstanceName (OBJD) to "FlamingoX", but when i try to call him using scripts, my game can't find it.


>>> this works (calling the original Flamingo) (the game will add the "Flamingo" in the world, with all the functionally(interactions) of the original Flamingo)

Flamingo aa = GlobalFunctions.CreateObjectOutOfWorld("Flamingo") as Flamingo;
aa.AddToWorld();
aa.SetPosition(position);

>>> this doesn't work. (calling my cloned FlamingoX) (the game will add a "White Box" in the world, with all the functionally(interactions) of the original Flamingo)

Flamingo aa = GlobalFunctions.CreateObjectOutOfWorld("FlamingoX") as Flamingo;
aa.AddToWorld();
aa.SetPosition(position);

what's wrong? i mean, why a "White Box"?

ps: if i just leave the InstanceName,"Flamingo", as S3OC did, the game will Not add anything in the world using the script above.
Old 16th Jan 2012, 12:16 AM #2
Inge Jones
Mad Poster

Join Date: Sep 2004
Posts: 6,879
Thanks: 7430 in 17 Posts
18 Achievements


When you want to refer to a cloned object in a script, you need to use the "Use 32 bit ID" option in s3oc, because that is how the name is hashed. Not sure if that alone will be enough to fix your problem, but it is a prerequisite.

simlogical
Please do not PM me with questions about modding. Please post in an appropriate forum and send me a link to the thread if you would like me to try and help.
Old 16th Jan 2012, 07:48 AM #3
Buzzler
1978 gallons of pancake batter



Join Date: May 2006
Posts: 2,211
Thanks: 28074 in 74 Posts
22 Achievements

View My Journal


Quote:
Originally Posted by douglasveiga
Flamingo aa = GlobalFunctions.CreateObjectOutOfWorld("Flamingo") as Flamingo;
The hash of the instance names won't get you anywhere. Note how the instance ids of the EAxian objects are just beginning from zero and incremented.

The game gets the instance id of the related OBJD from a NameGuidMap (NGMP) resource.

Quote:
Originally Posted by Inge Jones
When you want to refer to a cloned object in a script, you need to use the "Use 32 bit ID" option in s3oc, because that is how the name is hashed.
verbose, please, because I don't get what you mean.

Robot Armed With Down Comforter Levels Apartment Building, Holds Mayor Hostage.
Old 16th Jan 2012, 09:13 AM #4
Inge Jones
Mad Poster

Join Date: Sep 2004
Posts: 6,879
Thanks: 7430 in 17 Posts
18 Achievements


Not sure how much clearer I can get. Of course it only applies to those creators who use s3oc. You can leave off the bit after the comma, on second thoughts, as you pointed out it's not a hash of the name.

simlogical
Please do not PM me with questions about modding. Please post in an appropriate forum and send me a link to the thread if you would like me to try and help.
Old 16th Jan 2012, 07:55 PM #5
douglasveiga
Original Poster

Field Researcher

Join Date: Oct 2011
Posts: 333
Thanks: 7122 in 7 Posts
9 Achievements


thanks for the answers Buzzler and Inge_Jones.

i found the

Code:
OBJD from a NameGuidMap (NGMP) resource


but, how can i do to make the game recognize my cloned object, using the InstanceName or the hashed name?
Old 16th Jan 2012, 10:22 PM #6
douglasveiga
Original Poster

Field Researcher

Join Date: Oct 2011
Posts: 333
Thanks: 7122 in 7 Posts
9 Achievements


i got it, using the ResourceKey.

What i did:
i created a script to get the resource key of my cloned obj, so i got this string "319e4f1d:00000000:c1970eebed792964", then i used the function

ResourceKey.FromString("319e4f1d:00000000:c1970eebed792964")

to get back the ResourceKey;

then i got the cloned item, using:

Flamingo aa = GlobalFunctions.CreateObjectOutOfWorld(ResourceKey.FromString("319e4f1d:00000000:c1970eebed792964")) as Flamingo;
aa.AddToWorld();
aa.SetPosition(position);


so, it's working

thank you very much guys!
Old 17th Jan 2012, 08:41 AM #7
Inge Jones
Mad Poster

Join Date: Sep 2004
Posts: 6,879
Thanks: 7430 in 17 Posts
18 Achievements


Well that;s interesting. Means we don't have to use 32bit IIDs to call from scripts after all?

simlogical
Please do not PM me with questions about modding. Please post in an appropriate forum and send me a link to the thread if you would like me to try and help.
Old 17th Jan 2012, 11:46 AM #8
douglasveiga
Original Poster

Field Researcher

Join Date: Oct 2011
Posts: 333
Thanks: 7122 in 7 Posts
9 Achievements


Quote:
Originally Posted by Inge Jones
Well that;s interesting. Means we don't have to use 32bit IIDs to call from scripts after all?


i think so. after testing several times, i got that the Instancename or the hashed name (64 or 32), makes no difference in cloned objects (i don't know why). the only way i found was that, using the resourcekey.

that's really cool :D
Old 17th Jan 2012, 01:03 PM #9
Inge Jones
Mad Poster

Join Date: Sep 2004
Posts: 6,879
Thanks: 7430 in 17 Posts
18 Achievements


It could be that EA changed the definition of that data type to allow longer numbers, after realising what modders were doing about allocating IIDs - once they saw what the 3rd party tools were outputting.

simlogical
Please do not PM me with questions about modding. Please post in an appropriate forum and send me a link to the thread if you would like me to try and help.
Old 17th Jan 2012, 08:07 PM #10
douglasveiga
Original Poster

Field Researcher

Join Date: Oct 2011
Posts: 333
Thanks: 7122 in 7 Posts
9 Achievements


Quote:
Originally Posted by Inge Jones
It could be that EA changed the definition of that data type to allow longer numbers, after realising what modders were doing about allocating IIDs - once they saw what the 3rd party tools were outputting.



yes, maybe.
Old 8th Apr 2012, 07:56 AM #11
misukisu
Lab Assistant

Join Date: Aug 2005
Posts: 144
Thanks: 862 in 10 Posts
5 Achievements


If you need more info about how the mapping is done, see this thread: http://modthesims.info/showthread.php?t=435589&
Reply


Section jump:


Powered by MariaDB Some icons by http://dryicons.com.