Jump to content
Sign In to follow this  
Taaru

How do I add conditions to a building?

10 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online: A long, long time ago... 
 

I have searched up and down the forum for a simple answer to this question and haven't found it, so could someone please help me out?

All I really want to do is, for example, download a building and make reward conditions for it before it becomes available - like "game.g_population > 30000"

I know I need to add 'Conditional Building = True' in the building exemplar, and that I need to set up a LUA reward script, with pointers to LTEXT files...

I have copied the formats I've seen in other user-made LUA-LTEXT scripts (altered accordingly to fit my new building using Type/Group/Instance ID pointers, etc) 
- yet all I ever get is a greyed-out building in the menu....

AARRGGHH!  Help!

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online: A long, long time ago... 
     

    I'm trying to add conditions to the SimGoober Hospital from the STEX (SG_6x4_GooberGenHospital_50a96908.SC4Lot).

    I looked at the LUA/LTEXT script from the Census Repository (CensusRepository_dd41d65.SC4lot) - and tried to set up a similar arrangement within the SG Hospital Lot file (with new IID's for newly created LUA and LTEXT files).

    For whatever reason, I can't get the conditions to show up when the mouse cursor is hovered over the SG Hospital greyed-out icon in the health menu - even though I am sure I have the LUA script pointers labelled correctly and aimed at the proper LTEXT files.

    I don't know if it matters, but I use DatGen to insert/export files and SC4Tool to edit properties and LTEXT.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online: A long, long time ago... 
     

    Okay, here it is...

    -- This file defines advices for the the REWARDS

    dofile("adv_rewards.lua")

    building_tool_types.GOOBERHOSPITAL = hex2dec('50A96908')

    ------------ Reward record Goober Hospital ----

    a = create_reward_cityplanning('50A96908')

    function

    a.condition()

         if (game.g_population > 30000) then

         return reward_state.AVAILABLE

         else

              return [[text@50A9690A]]

         end

    end

    --a.once = 1

    a.timeout = tuning_constants.ADVICE_TIMEOUT_LONG

    a.title = [[text@50A9690B

    ]]

    a.message = [[text@50A9690C]]

    a.priority = tuning_constants.ADVICE_PRIORITY_URGENT

    a.mood = advice_moods.GREAT_JOB

    a.persist=

    1

    if

    (_sys.config_run == 0)

    then

    advices : run_triggers()

    end

    I don't know if this matters, but :

    LUA Script TGI = 0xCA63E2A3   0x4A5E8EF6   0x50A9690D

    LTEXT TGIs = 0x2026960B   0x6A386D26   0x50A9690 (A...B...C)


    ...Is that enough info?

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online: A long, long time ago... 
     

    .... it's missing

    Do I add the IID of the LUA file into this line???

    ex- 

    --#-package:50A9690D# -- package signature

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online: A long, long time ago... 
     

    OK

    Thanks for your help!

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online: A long, long time ago... 
     

    Hey Daeley

    It turns out there were some funky unknown properties set in the exemplars for the Goober Hospital.

    in the SC4LOT there were entries in both "lot" and "main" exemplars:

    "Unknown - CBE243F7 - UInt32 - 0 - 0x00000001" and "Unknown - CA9B4CA8 - UInt32 - 0 - 0x00000001"

    Deleting these properties from the exemplars, combined with adding the package ID# as you suggested got the reward script working just fine.

    I have no idea what those unknown properties were doing, as the hospital functions just fine with them deleted.

    Just thought you might wanna know

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account

    Sign In to follow this  

    • Recently Browsing   0 members

      No registered users viewing this page.

    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections