(1) How can I find the tile of a certain building using Script.EVENT_PLACED and using Tile.getBuildingDraft(x,y), I used all of it, I put the id back but still can't find it.
if event == SCRIPT.EVENT_PLACED and Tile.getBuildingDraft(x,y):getDraft() == "$galleon00" then
if gllg < 100 then
Builder.remove(x,y)
end
end
--rjroldan1
(2) How can I create or trigger a new map that will save in Single Cities, something like the DSA's moon map, and back to the origin city. How variable works between those maps? Can I have a sample lua script for it, if available
"ᜀᜃᜓ ᜀᜅ᜔ ᜁᜌᜓᜅ᜔ ᜑᜇᜌ" CEO of Haráya Motors “TheoTown Philippines Council” “Kapulungan Ng Mga Nagkakaisang Lungsod”
City.load(file location [str], overwrite the map with same name or not [bool], is available in single cities selection or not [bool], target city name [str])
In DSA's case, it loads an empty map and then other scripts take care of generation.
So think of Tile.getBuildingDraft() as getting the code above. Now can you see why it's not the same as the id?
Now if you want to match ids you would have to add :getId() to get the Id of the draft that was returned by Tile.getBuildingDraft()
How to use City.countBuildingsOfType(type[,level])? That's always show me an errors 'call nil'. I see the returns is number and level, then i set 2 variables, but it's still doesn't work.
_20200704_205106.JPG
You do not have the required permissions to view the files attached to this post.
Can i get an explanation about budgetItem and getCurrency(name)? Are there different functions and types of drafts? How can I make them and show in financial information?
Last edited by ian` on 23 Jul 2020, 10:22, edited 1 time in total.
function script:event(zeroX, zeroY, level, event)
if event == Script.EVENT_PLACED and Tile.getBuildingDraft(zeroX, zeroY):getId() == "<id> then
buildZoneC(zeroX, zeroY, "$zonecommercial", 2)
end
end
Result of build:
Ahotee_20-06-26_23.12.47.png
It also places zone under that building, btw
Wait how to used that <id> cause i test it and nothings happened i think it missed the "getId() = <id>" there .
Also you didn't used variable:"zoneId" from your buildZone function
@KINGTUT10101 version 1.9.09 will introduce an extra parameter happinessType for City.getHappiness that will allow you to get more specific happiness values.
@distian The discrepancy that you've discovered is caused by the fact that the budget view shows the amount of all jobs that are created by buildings of a specific level. Your job numbers differ from that slightly in that even poor commercial places create a few higher level jobs (e.g. the boss of a facility is usually richer than his employees).
Dang, I was hoping it was just a simple command. I actually had the same idea to make rounded corners that way, but I thought I would ask you about it first.
local tree
local treeFrame
function script:earlyTap(x,y)
if Tile.isTree(x,y) then -- condition if any trees in position
tree = Tile.getTreeDraft(x,y) -- get tree draft
treeFrame = Tile.getTreeFrame(x,y) -- get tree frame
Builder.buildGround('$asphalt00',x,y)
Builder.buildTree(tree,x,y,treeFrame) -- build tree after build ground
else -- condition if no tree in position
Builder.buildGround('$asphalt00',x,y)
end
return false
end