Advanced tags for building plugins

Find tutorials, documentation, and resources for creating and using TheoTown plugins.
Previous topicNext topic
User avatar
CommanderABab
AB
Reactions:
Posts: 11269
Joined: 07 Jun 2016, 19:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by CommanderABab »

Akira Maruni wrote: 16 Apr 2019, 14:04 I have an inspiration to make a zone that a bit similar with "Primitive Zone" plugin, but I try to make it with modern building. The purpose is to make the game looks more real with various RCI building in a zone rather than to build the same type building in a zone.

So, rather than I create the new buildings, I choose to create a code spawn some buildings from the game itself. Is it legal if I use in-game building ? What code should I use ?
CommanderABab wrote: 16 Apr 2019, 15:31 Can be done, but it's complicated and the code is long.
:)

First step: collect the ids and sizes of the in-game buildings you wish built in your zone. Remember it's not a good idea to mix polluting industries with residential buildings. :)
my avatar:
L
Lemme Go
Townsman
Reactions:
Posts: 74
Joined: 06 Sep 2017, 11:51
Plugins: Showcase Store

Platform

Re: Advanced tags for building plugins

Post by Lemme Go »

How to spawn the building ? ;)
User avatar
JustAnyone
Honorary Contributor
Reactions:
Posts: 3666
Joined: 23 Jul 2017, 10:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: Advanced tags for building plugins

Post by JustAnyone »

Lobby wrote: 30 May 2017, 22:37 Since version 296 you may let buildings (e.g. decorations) automatically spawn in map creation. To do so, we added an object called "spawn" which contains probability p, main spawn height height and max deviation from it radius.

A small sample plugin that spawns grass in the ocean:

Code: Select all

[
  {
    "id":"$myspawntest00",
    "type":"decoration",
    "width":1,
    "height":1,
    "frames":[{"x":0,"y":0,"w":32,"h":16}],
    "needs water":false,
    "needs land":false,
    "draw ground":true,
    "spawn":
    {
      "p":0.01,
      "height":-600,
      "radius":600
    }
  }
]
To give you some intuition about what height means I measured some height values in this map:
Image
:pickle:
User avatar
CommanderABab
AB
Reactions:
Posts: 11269
Joined: 07 Jun 2016, 19:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by CommanderABab »

JustAnyone wrote: 17 Apr 2019, 18:48 *quoting Lobby*
Thanķs, but that isn't what he is talking about! :)
my avatar:
User avatar
Imran M
Inhabitant of a Country
Reactions:
Posts: 834
Joined: 24 Oct 2018, 11:41
Plugins: Showcase Store

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by Imran M »

CommanderABab wrote: 17 Apr 2019, 21:39
JustAnyone wrote: 17 Apr 2019, 18:48 *quoting Lobby*
Thanķs, but that isn't what he is talking about! :)
You used a different k
I just love the DOPE-amine you get after completing a plugin!
User avatar
CommanderABab
AB
Reactions:
Posts: 11269
Joined: 07 Jun 2016, 19:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by CommanderABab »

Ķoalaguy
my avatar:
User avatar
Imran M
Inhabitant of a Country
Reactions:
Posts: 834
Joined: 24 Oct 2018, 11:41
Plugins: Showcase Store

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by Imran M »

CommanderABab wrote: 18 Apr 2019, 12:28 Ķoalaguy
Stahp it.
I just love the DOPE-amine you get after completing a plugin!
User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 2211
Joined: 07 Jul 2016, 20:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by KINGTUT10101 »

What does chargeable do?
User avatar
Lobby
Inhabitant of a Supercluster
Reactions:
Posts: 3759
Joined: 26 Oct 2008, 10:34
Plugins: Showcase Store

Re: Advanced tags for building plugins

Post by Lobby »

It's an attribute for cars; If you set it to false (e.g. for fire engines) they won't be charged by tollbooths.
User avatar
Lakan Haraya
Metropolitan
Reactions:
Posts: 131
Joined: 28 Mar 2019, 07:34
Location: Philippines
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by Lakan Haraya »

FranchuFranchu wrote: 15 Feb 2019, 19:44 Lua is 5th grade math compared to C, Assembly and other low level languages
Well, please teach us! PLEASE! :D
"ᜀᜃᜓ ᜀᜅ᜔ ᜁᜌᜓᜅ᜔ ᜑᜇᜌ"
CEO of Haráya Motors

“TheoTown Philippines Council”
“Kapulungan Ng Mga Nagkakaisang Lungsod”
User avatar
Kulche
Inhabitant of a Continent
Reactions:
Posts: 1194
Joined: 07 Jun 2017, 18:28
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by Kulche »

You have so much books that you don't need a teacher.
get yoked!!
User avatar
Lobby
Inhabitant of a Supercluster
Reactions:
Posts: 3759
Joined: 26 Oct 2008, 10:34
Plugins: Showcase Store

Re: Advanced tags for building plugins

Post by Lobby »

Or you could use YouTube :)
M
MsgmSgmsG
Small-town resident
Reactions:
Posts: 41
Joined: 05 Aug 2018, 04:06
Location: Planet Earth
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by MsgmSgmsG »

Can i use "frame alignment" in RIC?? I try this tag in my 1×1 house plugin but I have to place residential zone before i place this house...
I'm comeback!!
(Never forget my password anymore..)

Sorry for bad Englishㅠㅠ :fire
User avatar
CommanderABab
AB
Reactions:
Posts: 11269
Joined: 07 Jun 2016, 19:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by CommanderABab »

MsgmSgmsG wrote: 09 Dec 2019, 13:33 Can i use "frame alignment" in RIC?? I try this tag in my 1×1 house plugin but I have to place residential zone before i place this house...

You could also use a frame aligned 1x1 park type that when built removes itself, builds the residential zone, then the frame aligned 1x1 house.
my avatar:
User avatar
CommanderABab
AB
Reactions:
Posts: 11269
Joined: 07 Jun 2016, 19:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by CommanderABab »

I've seen some people use

Code: Select all

"once":true,
in their plugins maybe not knowing what it does. This allows a plugin to only show any notifications once per the lifetime of a building.

If you only want a plugin to be built once, use

Code: Select all

"max count":1,
my avatar:
User avatar
Bevise
Inhabitant of a Conurbation
Reactions:
Posts: 495
Joined: 27 Feb 2020, 13:39
Location: Phu Quoc Island, Vietnam
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by Bevise »

Lobby wrote: 28 Jan 2019, 11:06 See here and here.

There's a simplified syntax that looks like:

Code: Select all

"requirements":[
  {
    "type":"RANK",                 // Requires a specific city rank
    "lvl":2
  },
  {
    "type":"BUILDING",             // Requires a specific building
    "id":"$theidofarequiredbuilding"
  },
  {
    "type":"HABITANT_COUNT",       // Requires a population of at least 1000
    "count":1000
  }
]
I want to build Building A, it requires Building B to be upgraded. How to write codes? Please help me. :?
...OOOOOOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOOOOO OOOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOO

A_Vietnamese_plugin_creator
OOOOOOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOO OOOOO OOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOO
User avatar
Bearbear76
Inhabitant of a Multiverse
Reactions:
Posts: 5701
Joined: 10 Feb 2017, 12:53
Location: L2 cache
Plugins: Showcase Store

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by Bearbear76 »

Bevise wrote: 30 Mar 2020, 12:15 I want to build Building A, it requires Building B to be upgraded. How to write codes? Please help me. :?
I think this should work

Code: Select all

	//building B
	[{
		"id":"buildingB",
	  	other stuff...
	  	"upgrades":[
	  	{
	    		"id":"buildingB_upgrade", //upgraded building B id 
	    		other stuff...
	  	}]
	},
	//building A
	{
		"id":"buildingA",
	  	other stuff...
	  	"requirements":[
	  	{
	  		"type":"BUILDING",
	  		"id":"buildingB_upgrade" //can only upgrade when B is upgraded
	  	}]
	}]
Just my opinion
retired
User avatar
Bevise
Inhabitant of a Conurbation
Reactions:
Posts: 495
Joined: 27 Feb 2020, 13:39
Location: Phu Quoc Island, Vietnam
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by Bevise »

Ølsken wrote: 02 Apr 2020, 11:02
Bevise wrote: 30 Mar 2020, 12:15 I want to build Building A, it requires Building B to be upgraded. How to write codes? Please help me. :?
I think this should work

Code: Select all

	//building B
	[{
		"id":"buildingB",
	  	other stuff...
	  	"upgrades":[
	  	{
	    		"id":"buildingB_upgrade", //upgraded building B id 
	    		other stuff...
	  	}]
	},
	//building A
	{
		"id":"buildingA",
	  	other stuff...
	  	"requirements":[
	  	{
	  		"type":"BUILDING",
	  		"id":"buildingB_upgrade" //can only upgrade when B is upgraded
	  	}]
	}]
It doesnt work... :bb
...OOOOOOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOOOOO OOOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOO

A_Vietnamese_plugin_creator
OOOOOOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOO OOOOO OOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOO
User avatar
CommanderABab
AB
Reactions:
Posts: 11269
Joined: 07 Jun 2016, 19:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by CommanderABab »

Bevise wrote: 02 Apr 2020, 13:10
Ølsken wrote: 02 Apr 2020, 11:02
Bevise wrote: 30 Mar 2020, 12:15 I want to build Building A, it requires Building B to be upgraded. How to write codes? Please help me. :?
I think this should work

Code: Select all

	//building B
	[{
		"id":"buildingB",
	  	other stuff...
	  	"upgrades":[
	  	{
	    		"id":"buildingB_upgrade", //upgraded building B id 
	    		other stuff...
	  	}]
	},//*** add this code to buildingB:
	"fun":[
           {
				"condition": {
					"type": "upgrade",
					"id": "buildingB_upgrade"
				},
				"actions": [{
					"type": "remove"
					},
					//*** builds what you are checking for in place.  :)
					{"type": "build","id": "upgradedbuildingB","x":0,"y":0}
				],"p":100
			}
		]
		
	//building A
	{
		"id":"buildingA",
	  	other stuff...
	  	"requirements":[
	  	{
	  		"type":"BUILDING",
	  		//*** change "buildingB_upgrade" below to "upgradedbuildingB"
	  		"id":"buildingB_upgrade" //can only upgrade when B is upgraded
	  	}]
	}]
It doesnt work... :bb

Code: Select all

{  "id":"upgradedbuildingB",
    "hidden":true,
   //everything else same as buildingB except no upgrade statement
}
my avatar:
User avatar
Bevise
Inhabitant of a Conurbation
Reactions:
Posts: 495
Joined: 27 Feb 2020, 13:39
Location: Phu Quoc Island, Vietnam
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

Post by Bevise »

So, building A and B must be in the same file??
...OOOOOOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOOOOO OOOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOO

A_Vietnamese_plugin_creator
OOOOOOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOO OOOOO OOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOO
Previous topicNext topic