| Search this Thread |
|
|
How to make a list of objects with certain constrain? #1 | ||
|
Cherry92
Original Poster
|
Code:
I'm using the above code to select random object from current lot, but it's a little buggy since plumbbobs and skillmeters are included, also I want to fix the range of objects to the same floor with the actor.. Is there any way to modify the method to get my desired results? I've think of two way to do, but it failed or I can't think of how to do. For selecting objects from the same floor as the actor: 1) Calculate Y-component of position vector by: obj.Y - obj.(height from floor) and compare this with actor.Y, but even allowing an epsilon for error doesn't work, 2) Test if the route is routable before I really route to the object, I've no idea how I could do this, and seems there's no relevant method... or did I overlooked something? And for not selecting plumbbobs and skill meter:
Code:
But unfortunately, this just remove EVERYTHING in mObjects
|
||
|
|
Last edited by Cherry92 : 14th Jun 2012 at 06:19 AM.
Reason: typing mistake
|
|
|
#2 | |
|
Buzzler
1978 gallons of pancake batter
|
Quote:
Or use FindAll and a Predicate: (new List<GameObject>(Sims3.Gameplay.Queries.GetObjects<GameObject>(base.Actor.LotCurrent))).FindAll(obj => !(obj is PlumbBob) && !(obj is SkillMeter)); | |
|
Robot Armed With Down Comforter Levels Apartment Building, Holds Mayor Hostage. |
||
|
|
|
|
|
#3 |
|
MDM
|
Ahhh, the power of Lambda expressions, I'm currently reading about those and they're cool, the problem is trying to include them when I think about solutions but I'll get to it someday
|
|
Nothing's real. Nothing's unreal either. The frontier between true and untrue is a shady fuzzy line. Destiny, or maybe the long flight's time-span, shall decide the issue. |
|
|
|
|
|
|
#4 | |
|
Cherry92
Original Poster
|
Quote:
It's working, thanks. There is too much to learn And the problem of getting objects from the same floor is also solved, getting the value of obj.PositionOnFloor.y would be sufficient
|
|
|
|
Last edited by Cherry92 : 14th Jun 2012 at 05:18 PM.
|
![]() |

Have you made some custom content?


Twitter
del.icio.us
StumbleUpon
Google