World of Banished

MODS Garage => Tips and Help => Topic started by: angainor88 on July 04, 2018, 12:03:02 PM

Title: How do you add happiness to a building?
Post by: angainor88 on July 04, 2018, 12:03:02 PM
I am finishing up a clocktower that I want to add happiness to. I copied the happiness code from the cemetery and added it to the template file. When I Build it, everything runs smoothly, but in game, it crashed whenever I click on the clocktower. What am I missing?

The cemetery code I copied is just:
Code: [Select]
HappinessDescription happiness
{
HappinessType _happinessType = Spirit;
int _idleRange = 1;
}
Title: Re: How do you add happiness to a building?
Post by: Tom Sawyer on July 04, 2018, 01:45:07 PM
Maybe the radius section is missed. You should also add the radius part to the UI section, so it can be seen in game. Can be copied from vanilla market. :)
Title: Re: How do you add happiness to a building?
Post by: RedKetchup on July 04, 2018, 01:52:08 PM
happiness function work with radius function.

and you need to call them in the header of your file: (Description _descriptions)

      "happiness",
      "radius",

then explain the functions:

HappinessDescription happiness
{
   HappinessType _happinessType = Spirit;
   int _idleRange = 3;
}

RadiusDescription radius
{
   int _radius = 35;
}
Title: Re: How do you add happiness to a building?
Post by: angainor88 on July 04, 2018, 04:56:48 PM
Ah, ok! Thank you so much!
Title: Re: How do you add happiness to a building?
Post by: angainor88 on July 04, 2018, 05:58:52 PM
Oh no, now I get a different error message...

Assert: index >= 0 && index < GetLocationCount(type) Error, index out of range!

Component\InteractComponent.cpp(140)

I... have no idea what this means haha
Title: Re: How do you add happiness to a building?
Post by: RedKetchup on July 04, 2018, 06:10:31 PM
 ;D neither !! LOL
Title: Re: How do you add happiness to a building?
Post by: Discrepancy on July 05, 2018, 07:02:57 AM
do you have interact points with it? If you are using the spirit happiness code I think it needs to have a use_ point... i think. if you already do, then could you send me your template file to review?
Title: Re: How do you add happiness to a building?
Post by: angainor88 on July 05, 2018, 06:09:44 PM
Ah, that was the missing part of the puzzle! I have build points, but no use points.

Thank you, it works fine now :D
Title: Re: How do you add happiness to a building?
Post by: RedKetchup on July 05, 2018, 07:10:24 PM
well thats great Disc pinpointed it :)
dont forget when you will make some consume produced shops... another dummy you will need to know and add is : create_001 ... create_002 ... create_003 ... etc
they set where the recource should drop on the floor
Title: Re: How do you add happiness to a building?
Post by: angainor88 on July 06, 2018, 06:00:16 AM
Yeah the problem was that since it's a building with no workers, I thought I didn't need any points besides build. Whoops haha