Replies: 11 (Who?), Viewed: 2909 times.
Test Subject
Original Poster
#1 Old 24th Nov 2010 at 1:48 PM Last edited by ShortYute : 4th Dec 2010 at 9:43 PM.
Package File which deals with Plants dying on Community lots
I've been looking in gameplay.package file looking for the specific package that deals with allowing plants to die on community lots but I've searched and I can't find it ( can someone tell me were it is)
Note: I want the sims to plant off one of the lands that buy bought (like a farm like) and not on their home lot but I want it to be realistic so I want the plants to die...
Thanks in advance...
Advertisement
Inventor
#2 Old 24th Nov 2010 at 7:40 PM
I've done a quick check of the code and the reason for plants only dying on the lot of the active household seems to be in the function

Sims3.Gameplay.Objects.Gardening.HarvestPlant.CreateHarvestablesLoop(int yield, ref List<Slot> emptyContainmentSlots)

There is the following bit of code:

Code:
        if (!PlantHelper.IsLotAutoPlantGrow(base.LotCurrent))
        {
            this.mLifetimeHarvestablesYielded++;
        }
Plants die when the maximum number of lifetime harvest is reached. However for lots that are AutoPlantGrow lots the number of harvestables is never increased. (Every lot that is not the lot of the active household is an AutoPlantGrow lot.)

A kGrewHarvestable Event is sent for each person who helped grow the plant and each harvestable, however I don't think you can get the plant info from that. So the best workaround might be to write a script mod that will increase the mLifetimeHarvestablesYielded for all plants for all lots that you want your plants to die on.

(For a core mod, you'd simply have to remove the check for IsLotAutoPlantGrow.)
Test Subject
Original Poster
#3 Old 24th Nov 2010 at 8:23 PM
Quote:
Originally Posted by velocitygrass
I've done a quick check of the code and the reason for plants only dying on the lot of the active household seems to be in the function

Sims3.Gameplay.Objects.Gardening.HarvestPlant.CreateHarvestablesLoop(int yield, ref List<Slot> emptyContainmentSlots)


Thanks I look into that

Quote:
Originally Posted by velocitygrass

There is the following bit of code:

Code:
        if (!PlantHelper.IsLotAutoPlantGrow(base.LotCurrent))
        {
            this.mLifetimeHarvestablesYielded++;
        }
Plants die when the maximum number of lifetime harvest is reached. However for lots that are AutoPlantGrow lots the number of harvestables is never increased. (Every lot that is not the lot of the active household is an AutoPlantGrow lot.)

Oh so this is what is happening to the active household

Quote:
Originally Posted by velocitygrass

A kGrewHarvestable Event is sent for each person who helped grow the plant and each harvestable, however I don't think you can get the plant info from that. So the best workaround might be to write a script mod that will increase the mLifetimeHarvestablesYielded for all plants for all lots that you want your plants to die on.

(For a core mod, you'd simply have to remove the check for IsLotAutoPlantGrow.)

Ok, i'm thinking about running a script mod to increase the mLifetimeHarvestablesYielded and i'm going to look into seeing if i can make it operate as if the plant was on the home lot (eg. weeds and such) but i'll just look for making the script mod though so i'll look to the wiki ( my first mod attempt but i have experience in coding C and C++ command line) . however I run the Extended game core so I'm thinking I could just locate the package in the object package extract it and change the value to false?
Inventor
#4 Old 24th Nov 2010 at 9:16 PM
If you run a core mod, you could just try to make changes there, e.g. by changing

Sims3.Gameplay.Objects.Gardening.PlantHelper.IsLotAutoPlantGrow(Lot lot)

to always return false.

Btw, I skimmed over the feature list of the mod you linked and saw "Natural plant growth". Does this maybe cover what you wanted? (I'm not sure which of the features have to be turned on in tuning.)
Test Subject
Original Poster
#5 Old 24th Nov 2010 at 9:50 PM
Oh no that's different that's allows the plants to 'grow' gradually instead of at one set time per day...
this is the description i found in the package file 'Plants will no longer grow from one state to the next but daily equally'
Test Subject
Original Poster
#6 Old 4th Dec 2010 at 1:26 PM Last edited by ShortYute : 7th Dec 2010 at 1:38 AM.
Default Features I'm planning to implement
EP required: Ambitions ( For real estate option )
Features I'm looking to implement:
-> Allow planting on community lot but only on community lots that are owned by you (real estate).
a. This could be handled by
1. A script mod that adds an interaction to the real estate (eg. Purchase: 54,908. But when bought; real estate: Change to Farm able Lot)

2. Or I could just use a cloned object with those interactions

-> Allow EGC support?
(Anyone who knows how I could implement this please reply, if I made it compatible with it then i would not need to change community gardening from being on)
This mod will try to emulate what happens to plants on the active lot to other community lots.


EDIT:

I'm looking into this and this is the code I see (Sims3.Gameplay.RealEstate.PropertyData.Venue)
Code:

Code:
public Venue(Lot lot, RealEstateManager owner) : base(3, owner, 0)
      {
        this.mVenueLevel = -1;
        this.mLotId = lot.LotId;
        base.mWorld = GameUtils.GetCurrentWorld();
        this.mLotType = lot.CommercialLotSubType;
        base.mStoredValue = RealEstateData.GetVenueBaseCost(lot);
        this.mLotCost = lot.Cost;
        this.mVenueLevel = RealEstateData.CalulateVenueLotLevel(lot);
      }

1. I think I need to know how to add an interaction to a purchased Lot (I think that is script modding) (not a object interaction, I know there is a tutorial for that)
2. How to make sims able to plant on the current bought community Lot (park) [core mod]
So essentially I need to know that the lot is purchased by the active household then I need to add an interaction that allows the lot to be farmed in the real estate menu.
Thanks in advance.
Test Subject
Original Poster
#7 Old 7th Dec 2010 at 10:10 AM Last edited by ShortYute : 7th Dec 2010 at 10:40 AM.
anyone?
Code:
public static bool IsLotAutoPlantGrow(Lot lot)
    {
      if ((lot != null) && (lot.Household != null))
      {
        Household activeHousehold = Household.ActiveHousehold;
        if ((activeHousehold != null) && (lot.Household == activeHousehold)) || // (the lot is owned by them)
        {
          return false;
        }
      }
      return true;
    }

Which variable should I use to know that a lot is owned by the active household?
1978 gallons of pancake batter
#8 Old 7th Dec 2010 at 6:41 PM
Like this:
Code:
public static bool IsLotAutoPlantGrow(Lot lot)
    {
      if ((lot != null) && (lot.Household != null))
      {
        Household activeHousehold = Household.ActiveHousehold;
        PropertyData data = activeHousehold.RealEstateManager.FindProperty(lot);
        if ((activeHousehold != null) && (lot.Household == activeHousehold)) || (data != null))
        {
          return false;
        }
      }
      return true;
    }

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Test Subject
Original Poster
#9 Old 7th Dec 2010 at 8:36 PM Last edited by ShortYute : 7th Dec 2010 at 9:00 PM.
Thanks I really appreciate that...
So the FindProperty member function shows the property owned for the active household.
Thanks again.
ok one more question.

How do you allow gardening on community lots?
[I'm not seeing any function for that in Lots.cs,Plants.cs or PlantHelper.cs] ( I know that there are other mods for this but as you know this is a core mod and their can only be one). Also I checked out the EGC core mod and checked the 'community garden' package. It's just a xml enabling it and I can't find the functionality in the dll I exported to view in MSVC++.
(Also how are blocks of code tunable in a core mod? Because I saw in EGC were you could just have he base core package then add packages to add functionality [would i need to add [tunable] to the start of the function?] )
Thanks in advance.
1978 gallons of pancake batter
#10 Old 7th Dec 2010 at 9:11 PM
Quote:
Originally Posted by ShortYute
So the FindProperty member function shows the property for the active household.
Every Household has its RealEstateManager that has a List<PropertyData>. FindProperty() goes through that list and returns a match if it finds one. You could still check the PropertyData if Owner.OwnerHousehold matches the Household in question or if the Household is FullOwner. That seems really redundant in this case, though, and FullOwner AFAIK only applies to RabbitHoles.

That is a terrible implementation of course, because it allows real estate to be fully owned by multiple households. Dreadful.

Quote:
How do you allow gardening on community lots?
The plant interactions call Sims3.Gameplay.Objects.Gardening.Plant.GardenInteractionLotValidityTest() in their definitions' Test() method. You need to clone these interactions, alter the Test() to call a custom method and add your cloned interactions to the plant.

The planting interaction is Sims3.Gameplay.ObjectComponents.PlantObject, i.e. the interactions derived from it. You need to clone all that stuff to stop it from calling PlantingLotTest() and add it to all objects that have a PlantableComponent.

Additionally, you'll need to add your plant interactions when the planting is done, and listen to the collecting of seeds and harvesting of plants to add the planting interactions to these.

Quote:
(Also how are blocks of code tunable in a core mod? Because I saw in EGC were you could just have he base core package then add packages to add functionality [would i need to add [tunable] to the start of the function?] )
The functionality must already be there in the core mod. The tunable values are only used to check whether the functionality should be available. You add the [Tunable] attribute to actually tunable fields. If you have a corresponding XML resource, the game will assign the values from the XML resource to the fields on startup. That's really all you can do with tunable values.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Test Subject
Original Poster
#11 Old 7th Dec 2010 at 10:09 PM
Quote:
Originally Posted by Buzzler

Every Household has its RealEstateManager that has a List<PropertyData>. FindProperty() goes through that list and returns a match if it finds one. You could still check the PropertyData if Owner.OwnerHousehold matches the Household in question or if the Household is FullOwner. That seems really redundant in this case, though, and FullOwner AFAIK only applies to RabbitHoles.

That is a terrible implementation of course, because it allows real estate to be fully owned by multiple households. Dreadful.


Thanks, really good to know all that information but as you said what you showed me seems to be enough for non-rabbit hole lots.

Quote:
Originally Posted by Buzzler

The planting interaction is Sims3.Gameplay.ObjectComponents.PlantObject, i.e. the interactions derived from it. You need to clone all that stuff to stop it from calling PlantingLotTest() and add it to all objects that have a PlantableComponent.

Code:
protected static bool PlantingLotTest(Lot lotTryingToPlantingOn, Sim simTryingToPlant)
    {
      return (Configuration.CommunityGardens.Active || ((lotTryingToPlantingOn == simTryingToPlant.LotHome) && (lotTryingToPlantingOn.LotType != 1)));
    }

The maker off EGC seems to have
allowed that function to basically always return TRUE (allows planting) as Configuration.CommunityGardens.Active is a tunable value in a xml package.
I haven't looked at all the planting interactions but what you are explaining to me seems beyond what I can do right now ( I only have knowledge of C and C++ ) so I'll just have to work off a modified core of EGC.

Lastly, I understand what you are saying with the tuning value but if/when I need help with that i'll ask.

Ok, I'm now off to IL and making the
Code:
if ((activeHousehold != null) && (lot.Household == activeHousehold)) || (data != null))

Change you told me about before, I'll see if I can assign a tunable value to it
Test Subject
Original Poster
#12 Old 8th Jun 2011 at 12:26 AM
Quote:
Originally Posted by Buzzler
Every Household has its RealEstateManager that has a List<PropertyData>. FindProperty() goes through that list and returns a match if it finds one. You could still check the PropertyData if Owner.OwnerHousehold matches the Household in question or if the Household is FullOwner. That seems really redundant in this case, though, and FullOwner AFAIK only applies to RabbitHoles.

That is a terrible implementation of course, because it allows real estate to be fully owned by multiple households. Dreadful.

The plant interactions call Sims3.Gameplay.Objects.Gardening.Plant.GardenInteractionLotValidityTest() in their definitions' Test() method. You need to clone these interactions, alter the Test() to call a custom method and add your cloned interactions to the plant.

The planting interaction is Sims3.Gameplay.ObjectComponents.PlantObject, i.e. the interactions derived from it. You need to clone all that stuff to stop it from calling PlantingLotTest() and add it to all objects that have a PlantableComponent.

Additionally, you'll need to add your plant interactions when the planting is done, and listen to the collecting of seeds and harvesting of plants to add the planting interactions to these.

The functionality must already be there in the core mod. The tunable values are only used to check whether the functionality should be available. You add the [Tunable] attribute to actually tunable fields. If you have a corresponding XML resource, the game will assign the values from the XML resource to the fields on startup. That's really all you can do with tunable values.


Thank you so much for this...
I know it is a long time since I have started this project but i would be glad if you can help me again...

Here is my code so far
Code:
 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sims3.SimIFace;
using Sims3.SimIFace;
using Sims3.Gameplay.ObjectComponents.PlantObject;
using Sims3.Gameplay.Objects.Miscellaneous;
using Sims3.Gameplay.Interactions;
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.Autonomy;
using Sims3.UI;


namespace Sims3.Gameplay.ObjectComponents.PlantObject.ShortYuteTm
// Copied directly from Sims3.Gameplay.ObjectComponents.PlantObject
{
    public class PlantObject : ImmediateInteraction<Sim, GameObject> // ETC....
}

However, I keep getting various errors
Code:
Error	5	The name 'eEditTypeHandTool' does not exist in the current context	C:\Users\Shane\Desktop\Sims3ProjectMods\PlantOnAnyLot.Sims3Game.Test\PlantOnAnyLot.Sims3Game.Test\Class1.cs	131	52	PlantOnAnyLot.Sims3Game.Test
Error	3	The name 'Localization' does not exist in the current context	C:\Users\Shane\Desktop\Sims3ProjectMods\PlantOnAnyLot.Sims3Game.Test\PlantOnAnyLot.Sims3Game.Test\Class1.cs	121	20	PlantOnAnyLot.Sims3Game.Test
Error	1	The type or namespace name 'Definition' could not be found (are you missing a using directive or an assembly reference?)	C:\Users\Shane\Desktop\Sims3ProjectMods\PlantOnAnyLot.Sims3Game.Test\PlantOnAnyLot.Sims3Game.Test\Class1.cs	37	41	PlantOnAnyLot.Sims3Game.Test
Error	4	The type or namespace name 'eEditTypeHandTool' could not be found (are you missing a using directive or an assembly reference?)	C:\Users\Shane\Desktop\Sims3ProjectMods\PlantOnAnyLot.Sims3Game.Test\PlantOnAnyLot.Sims3Game.Test\Class1.cs	131	13	PlantOnAnyLot.Sims3Game.Test
Error	6	The type or namespace name 'PlantableNonIngredient' could not be found (are you missing a using directive or an assembly reference?)	C:\Users\Shane\Desktop\Sims3ProjectMods\PlantOnAnyLot.Sims3Game.Test\PlantOnAnyLot.Sims3Game.Test\Class1.cs	178	13	PlantOnAnyLot.Sims3Game.Test
Error	7	The type or namespace name 'PlantableNonIngredient' could not be found (are you missing a using directive or an assembly reference?)	C:\Users\Shane\Desktop\Sims3ProjectMods\PlantOnAnyLot.Sims3Game.Test\PlantOnAnyLot.Sims3Game.Test\Class1.cs	178	78	PlantOnAnyLot.Sims3Game.Test
Warning	2	The variable 'flag' is assigned but its value is never used	C:\Users\Shane\Desktop\Sims3ProjectMods\PlantOnAnyLot.Sims3Game.Test\PlantOnAnyLot.Sims3Game.Test\Class1.cs	98	18	PlantOnAnyLot.Sims3Game.Test
 

So basically what i'm going to do is stop all functions from calling GardenInteractionLotValidityTest() then i'll see where i can go from there...
Thanks in advance...
Back to top