View Full Version : InstanceName
douglasveiga
15th Jan 2012, 11:40 PM
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.
Inge Jones
16th Jan 2012, 12:16 AM
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.
Buzzler
16th Jan 2012, 07:48 AM
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.
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.
Inge Jones
16th Jan 2012, 09:13 AM
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.
douglasveiga
16th Jan 2012, 07:55 PM
thanks for the answers Buzzler and Inge_Jones.
i found the
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?
douglasveiga
16th Jan 2012, 10:22 PM
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!
Inge Jones
17th Jan 2012, 08:41 AM
Well that;s interesting. Means we don't have to use 32bit IIDs to call from scripts after all?
douglasveiga
17th Jan 2012, 11:46 AM
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 :D
Inge Jones
17th Jan 2012, 01:03 PM
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.
douglasveiga
17th Jan 2012, 08:07 PM
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.
misukisu
8th Apr 2012, 07:56 AM
If you need more info about how the mapping is done, see this thread: http://modthesims.info/showthread.php?t=435589&
vBulletin v3.0.14, Copyright ©2000-2013, Jelsoft Enterprises Ltd.