1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

WorldBuilder functions not working

Discussion in 'Mod Creation Help' started by Geekob, May 18, 2017.

  1. Geekob

    Geekob Chieftain

    Joined:
    Apr 30, 2017
    Messages:
    20
    Gender:
    Male
    I found some useful functions in worldbuilder lua files but it seems im not able to use them. Its kind of weird since I can run those commands in runtime through firetuner. Lua doesnt throw any error, it just doesnt execute them. Im using ImprovementBuilder also, and it works even outside debug environment. I want to add plot to city, so it can be workable so I used
    Code:
    WorldBuilder.CityManager():SetPlotOwner(plot, city);
    but lua just ignores it. Is there any way to make it working? Or does anyone know any alternative function for setting plot to be owned by some city?
     
  2. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,464
    Location:
    France
    I call it with those arguments
    Code:
    WorldBuilder.CityManager():SetPlotOwner( x, y, playerID, cityID ) 
     
  3. Infixo

    Infixo Deity

    Joined:
    Jan 9, 2016
    Messages:
    3,701
    Gender:
    Male
    Location:
    Warsaw
    WorldBuilder functions can take various form of parameters. E.g. the one you want:
    SetPlotOwner (iX, iY, false)
    SetPlotOwner (pPlot, false)
    SetPlotOwner (pPlot, pCity)
    SetPlotOwner (pPlot, ePlayer, iCity)
    SetPlotOwner (iX, iY, ePlayer, iCity)
     
  4. Geekob

    Geekob Chieftain

    Joined:
    Apr 30, 2017
    Messages:
    20
    Gender:
    Male
  5. Geekob

    Geekob Chieftain

    Joined:
    Apr 30, 2017
    Messages:
    20
    Gender:
    Male
    Ok nevermind, i found them :D Im just blind. But I still have problem with many functions that I dont know what arguments they take. And lua will tell me just that there is problem with calling that function, nothing like "function requires arguments string, int instead of int int".
     
  6. Infixo

    Infixo Deity

    Joined:
    Jan 9, 2016
    Messages:
    3,701
    Gender:
    Male
    Location:
    Warsaw
    I use the spreadsheet, too. I also scan Lua objects for functions (since they are tables) and use TableBrowser from FireTuner to check what functions are available in a context. But the parameters is trial & error case. Just use logic, and some testing in FT.
     
  7. Geekob

    Geekob Chieftain

    Joined:
    Apr 30, 2017
    Messages:
    20
    Gender:
    Male
    Oh, okay then. I still dont understand why Firaxis didnt release any API reference. I wonder if they ever will.
     

Share This Page