- Site Map >
- Modding and Creation >
- Sims 2 Creation >
- Modding Discussion >
- Two quick questions
- Site Map >
- Modding and Creation >
- Sims 2 Creation >
- Modding Discussion >
- Two quick questions
Replies: 12 (Who?), Viewed: 5089 times.
#1
23rd Apr 2018 at 7:32 PM
Posts: 3,775
Thanks: 9625 in 44 Posts
Two quick questions
1. How do I tell if an object is sitting on the ground, as opposed to being attached to a wall or the ceiling, or sitting on a shelf?2. Is there a way to start some code during an interaction that runs in a separate thread concurrently with the rest of the interaction and does not block the sim while it finishes?
Advertisement
#2
23rd Apr 2018 at 9:54 PM
Posts: 12,936
Thanks: 3 in 1 Posts
1:
Ingame: Turn off Snapobjects and Moveobjects. If the object can't be placed on the ground, but snaps to the wall, it's a wall object.
SimPE: Most wall objects are in the "Wall deco" section, or they look like they're handing in mid-air in the thumbnail. Most will have wall shadows. Wall items can usually not be placed on shelves (unless they're a CC object cloned from a sculpture).
Most one-tile deco objects can be placed on shelves, and there's three main "sizes" of objects (small, medium, large). Only small objects can be placed on nearly all types of shelves in an unmodded game.
2: I think so, but you'd have to edit BHAVs. Not my area of expertise, but there are some tutorials you can take a look at in the modding tutorials.
Ingame: Turn off Snapobjects and Moveobjects. If the object can't be placed on the ground, but snaps to the wall, it's a wall object.
SimPE: Most wall objects are in the "Wall deco" section, or they look like they're handing in mid-air in the thumbnail. Most will have wall shadows. Wall items can usually not be placed on shelves (unless they're a CC object cloned from a sculpture).
Most one-tile deco objects can be placed on shelves, and there's three main "sizes" of objects (small, medium, large). Only small objects can be placed on nearly all types of shelves in an unmodded game.
2: I think so, but you'd have to edit BHAVs. Not my area of expertise, but there are some tutorials you can take a look at in the modding tutorials.
My site - TS2 baby stuff - ToU
My stories: Anna's diary - Memories are forever - Little Fire Burning
My stories: Anna's diary - Memories are forever - Little Fire Burning
#3
23rd Apr 2018 at 11:13 PM
Posts: 3,775
Thanks: 9625 in 44 Posts
Yeah, I am editing BHAVs, and for 1 I actually need to know how to find out if the object is on the ground from within a BHAV. I even want to know about objects that snap to walls, as long as they are on the ground and not pictures.
#4
24th Apr 2018 at 12:58 AM
Posts: 12,936
Thanks: 3 in 1 Posts
Not sure if you can easily spot that in the BHAVs, as the BHAVs don't seeem to have much information for paintings/wallhangings. However, it seems the "Global Data (GLOB)" may be of help. It shows which global functions an object has (and that's the end of my knowledge on that). Although, some sculptures seem to also have the "PaintingGlobals".
Maybe someone else can give you a better answer. I know only how to do a few things with BHAVs (mainly using them for poseboxes, making things shiftable, and possibly a couple other things).
Maybe someone else can give you a better answer. I know only how to do a few things with BHAVs (mainly using them for poseboxes, making things shiftable, and possibly a couple other things).
My site - TS2 baby stuff - ToU
My stories: Anna's diary - Memories are forever - Little Fire Burning
My stories: Anna's diary - Memories are forever - Little Fire Burning
#5
24th Apr 2018 at 3:41 AM
Posts: 3,775
Thanks: 9625 in 44 Posts
Ok, but as far as I know there is no way for a BHAV to know functions exist ahead of time. Surely there is a flag somewhere that just says whether or not it is on the floor.
#6
24th Apr 2018 at 5:45 AM
Posts: 355
Thanks: 65 in 4 Posts
Some about placement flags: http://www.modthesims.info/showthread.php?t=82685
Primitive 0x006A has a away to combine animation with events: http://modthesims.info/wiki.php?title=0x006A
Primitive 0x006A has a away to combine animation with events: http://modthesims.info/wiki.php?title=0x006A
#7
24th Apr 2018 at 9:47 AM
Last edited by Lamare : 24th Apr 2018 at 10:02 AM.
Posts: 1,530
Thanks: 15796 in 76 Posts
1. I understand, you need to make sure an object actually sits on the ground, from a BHAV. Here's some ideas of what you might want to check:
- object is in not off world (room number => 0)
- object is not contained by another object (container ID = 0) - this rules out shelves and the such
- object is visible (hidden and render flags) - unless it's not important for your cause
As for placement flags, they give you information about placement *rules* but you have to remember that if something is *meant* to be placed in a certain way, doesn't mean it actually *is* at any given point in time. Players use cheats, for one thing. Also, if an object *appears* to be attached to a wall or ceiling, it doesn't mean it's not on the ground. From a game's point of view, anyway.
There may be a way to check if there is a floor tile or terrain below an object (to rule out water/pool/roof, etc), but I can't recall now.
2. There could be several ways to achieve that:
- what clsve said (animation events)
- create/access an object that will do stuff; use attributes to specify things and synchronize it's actions with the sim
- object is in not off world (room number => 0)
- object is not contained by another object (container ID = 0) - this rules out shelves and the such
- object is visible (hidden and render flags) - unless it's not important for your cause
As for placement flags, they give you information about placement *rules* but you have to remember that if something is *meant* to be placed in a certain way, doesn't mean it actually *is* at any given point in time. Players use cheats, for one thing. Also, if an object *appears* to be attached to a wall or ceiling, it doesn't mean it's not on the ground. From a game's point of view, anyway.
There may be a way to check if there is a floor tile or terrain below an object (to rule out water/pool/roof, etc), but I can't recall now.
2. There could be several ways to achieve that:
- what clsve said (animation events)
- create/access an object that will do stuff; use attributes to specify things and synchronize it's actions with the sim
#8
24th Apr 2018 at 8:02 PM
Posts: 3,775
Thanks: 9625 in 44 Posts
1. Yes. Thanks, those are all good things to check. What is the "render" flag? I guess placement flags could be good enough to tell me if something can be placed on the ground without move_objects and the container ID will tell me if it's on top of something else, so that should be good enough for most purposes? Mainly I want to know if I can place a fire on the tile and expect it to destroy something and disappear after a while, as opposed to spawning under a light fixture and burning indefinitely.
2. Can I somehow pass the code off to the object that the sim was using, leaving the sim free to do other things, or do I need to create a new object? It's been a long time since I cloned an object.
2. Can I somehow pass the code off to the object that the sim was using, leaving the sim free to do other things, or do I need to create a new object? It's been a long time since I cloned an object.
#9
25th Apr 2018 at 5:38 AM
Posts: 1,530
Thanks: 15796 in 76 Posts
1. Render flags are about how an object is displayed. I saw it used for hiding objects in dorm rooms or apartments, but I don't know what values represent what, so I can't really help you with them.
Would placement flags be good enough for most purposes? I guess, that depends on what purposes we are talking about (destroying objects - no). Flags are not exclusive. If something can be placed on ground, it doesn't mean it can't be placed on water or doesn't require wall or ceiling to be attached to. You can make negative checks (doesn't require wall, isn't attached to ceiling, can't be placed on anything except ground or tables, etc, etc) to minimize uncertainty, but don't trust it 100%. Write your code in a way that if the 'ground check' was wrong, you're still in control of what happens next.
Fires don't burn indefinitely (well, unless they glitch out) and they already know what they should destroy and what they shouldn't, based on more than placement. When you place fire under an object, it takes care of things, leave it to it.
2. I'm not sure I follow. If you're asking "Do I need to create new object for the game in SimPE?", the answer is - not necessarily. You write your new BHAV and you need to stick it somewhere, right? Your options:
a) make new custom object and include your BHAV as its private tree,
b) modify an existing in-game object (add/change private BHAV),
c) modify global or semi-global library (add/change global/semi-global BHAV).
B and C should be used wisely - if you really have to do it. Overrides should be saved for things that can't be done without them. All in all, it depends on what you have in mind.
Would placement flags be good enough for most purposes? I guess, that depends on what purposes we are talking about (destroying objects - no). Flags are not exclusive. If something can be placed on ground, it doesn't mean it can't be placed on water or doesn't require wall or ceiling to be attached to. You can make negative checks (doesn't require wall, isn't attached to ceiling, can't be placed on anything except ground or tables, etc, etc) to minimize uncertainty, but don't trust it 100%. Write your code in a way that if the 'ground check' was wrong, you're still in control of what happens next.
Fires don't burn indefinitely (well, unless they glitch out) and they already know what they should destroy and what they shouldn't, based on more than placement. When you place fire under an object, it takes care of things, leave it to it.
2. I'm not sure I follow. If you're asking "Do I need to create new object for the game in SimPE?", the answer is - not necessarily. You write your new BHAV and you need to stick it somewhere, right? Your options:
a) make new custom object and include your BHAV as its private tree,
b) modify an existing in-game object (add/change private BHAV),
c) modify global or semi-global library (add/change global/semi-global BHAV).
B and C should be used wisely - if you really have to do it. Overrides should be saved for things that can't be done without them. All in all, it depends on what you have in mind.
#10
25th Apr 2018 at 6:26 AM
Posts: 3,775
Thanks: 9625 in 44 Posts
I'm not sure placement flags will do it. For one thing, there are objects that require a wall but which a usually/always placed on the ground, like counters.
What happens to a fire on a tile with only a light fixture or a painting? I haven't witnessed those destroying the light fixture/painting, or going out on their own. What does the fire use to decide what it can destroy, and how can I use that instead of relying on placement flags?
I'm already modifying a Maxis object's private BHAVs, so it would be easiest if I could make everything a modification of that object rather than creating a custom one. I just want the interaction to run in a different thread while the sim that initiated it is allowed to have autonomous responses to it as it happens/be directed by the player without cancelling the interaction.
What happens to a fire on a tile with only a light fixture or a painting? I haven't witnessed those destroying the light fixture/painting, or going out on their own. What does the fire use to decide what it can destroy, and how can I use that instead of relying on placement flags?
I'm already modifying a Maxis object's private BHAVs, so it would be easiest if I could make everything a modification of that object rather than creating a custom one. I just want the interaction to run in a different thread while the sim that initiated it is allowed to have autonomous responses to it as it happens/be directed by the player without cancelling the interaction.
#11
27th Apr 2018 at 4:59 AM
Posts: 1,530
Thanks: 15796 in 76 Posts
1. Some answers about fire you can find by looking at its code. Find it in objects.package by group 0x7FD0A790 or guid 0x24C95F99.
2. You can use object's main function: the sim notifies the object and sets its attributes through interaction, while the object checks its attributes and acts accordingly.
2. You can use object's main function: the sim notifies the object and sets its attributes through interaction, while the object checks its attributes and acts accordingly.
#12
27th Apr 2018 at 5:06 AM
Posts: 3,775
Thanks: 9625 in 44 Posts
Of course... I need to get back in the habit of trawling objects.package for answers.
Does the main function just loop every so many ticks?
Does the main function just loop every so many ticks?
#13
27th Apr 2018 at 5:22 AM
Posts: 1,530
Thanks: 15796 in 76 Posts
The main function can be used for much more then "just" loop. When you need an object and a sim running simultaneously, but separately, that's what comes to mind.
Who Posted
|