Re: Upgrades

Learn here how to create and use plugins.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Reactions:
Posts: 3127
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Upgrades

Post by Lobby » Wed Jun 21, 2017 21:08

.. wrote: โ†‘
Sat Jun 16, 2018 17:22
Upgrades

In this topic, I'll show you how to add upgrades to your plugin. (Example: Waterslide upgrade for pool)

This is how an upgrade may look in a plugin:

Code: Select all

[{
	"id": "$sample.plugin.unique.id.park00",
	"type": "park",
	"author": "Lobby & theotheoderich",
	"width": 1,
	"height": 1,
	"frames": [{
		"bmp": "sample_bmp.png"
	}],
	"influence park": 40,
	"upgrades": [{
		"id": "$sample.plugin.unique.id.park01",
		"frames": [{
			"bmp": "someupgrade_bmp"
		}],
		"price": 2000,
		"monthly price": 20,
		"influence park": 20
	}]
}]
This will add "$sample.plugin.unique.id.park01" to our park. Upgrades can use same functions like normal buildings. Upgrade frame should have same resolution as their building, but height can be different.

Functions
"upgrades" - defines upgrades for the building

I hope this helped you, have fun with your upgrading!
Tutorial is by .former member.


Thank you :)

Some additional notes:
  • price, monthly price, water, power and influences will be added to corresponding values of the building when the upgrade is applied
  • You can also provide animations as for regular buildings, but no smoke
  • You can set "only one":true in an upgrade to state that no other upgrade may be active at the same time. We use this for example for the radio station were you can have selected only one program at the same time.
Last edited by CommanderABab on Sat Jun 16, 2018 18:58, edited 1 time in total.
Reason: Added quote of original deleted post
...Have a nice stay

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6372
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Upgrades (for buildings)

Post by CommanderABab » Wed Jun 21, 2017 22:25

Something new learned everyday!
517517Currently using beta 517. 517 What's new? :)
Lua!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6372
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Upgrades (for buildings)

Post by CommanderABab » Wed Jun 21, 2017 22:27

Is there anything that upgrade won't work upon?
517517Currently using beta 517. 517 What's new? :)
Lua!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

User avatar
Lobby
Developer
Reactions:
Posts: 3127
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Upgrades (for buildings)

Post by Lobby » Wed Jun 21, 2017 22:49

They should work on any building. Have you tried something specific?
...Have a nice stay

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6372
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Upgrades (for buildings)

Post by CommanderABab » Wed Jun 21, 2017 22:50

No, just asking. :)
517517Currently using beta 517. 517 What's new? :)
Lua!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6372
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Upgrades (for buildings)

Post by CommanderABab » Wed Jun 21, 2017 23:29

Does the upgrade require a frame?
517517Currently using beta 517. 517 What's new? :)
Lua!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

User avatar
Lobby
Developer
Reactions:
Posts: 3127
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Upgrades (for buildings)

Post by Lobby » Thu Jun 22, 2017 0:09

Actually not, you may write

Code: Select all

"frames":[]
...Have a nice stay

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6372
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Upgrades (for buildings)

Post by CommanderABab » Thu Jun 22, 2017 7:18

Lobby wrote: โ†‘
Wed Jun 21, 2017 22:49
They should work on any building. Have you tried something specific?
I have now!

It does indeed work with influences, price, monthly price.

It does not work with provide aspect.
517517Currently using beta 517. 517 What's new? :)
Lua!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 1764
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Phone model: Moto Z Force Droid

Re: Upgrades (for buildings)

Post by KINGTUT10101 » Mon Jun 26, 2017 21:49

So if the values in the upgrade add onto the other values will negative numbers subtract from it?

User avatar
Lobby
Developer
Reactions:
Posts: 3127
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Upgrades (for buildings)

Post by Lobby » Mon Jun 26, 2017 23:18

Yes, that's how math works :bc
...Have a nice stay

User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 1764
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Phone model: Moto Z Force Droid

Re: Upgrades (for buildings)

Post by KINGTUT10101 » Mon Jun 26, 2017 23:58

Just wondering if the game supported that.

User avatar
JustAnyone
Feature manager
Reactions:
Posts: 2296
Joined: Sun Jul 23, 2017 12:45
Location: Pickle Jar
Plugins: Show
Version: Beta
Phone model: Picklephone XP 5

Re: Upgrades (for buildings)

Post by JustAnyone » Mon Aug 28, 2017 11:05

Hello,
I have A question to give:
"How to make add a little part of frame on full frame using upgrade?"
Example: Stadium/Main fire station.

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6372
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Upgrades (for buildings)

Post by CommanderABab » Mon Aug 28, 2017 17:13

Animation.
517517Currently using beta 517. 517 What's new? :)
Lua!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

User avatar
JustAnyone
Feature manager
Reactions:
Posts: 2296
Joined: Sun Jul 23, 2017 12:45
Location: Pickle Jar
Plugins: Show
Version: Beta
Phone model: Picklephone XP 5

Re: Upgrades (for buildings)

Post by JustAnyone » Tue Aug 29, 2017 16:27

CommanderABab wrote: โ†‘
Mon Aug 28, 2017 17:13
Animation.
Gimme code example.

User avatar
Lobby
Developer
Reactions:
Posts: 3127
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Upgrades (for buildings)

Post by Lobby » Mon Jan 08, 2018 18:20

True, thank you :bc
About ordinal for upgrades, it doesn't really matter as the order in which you define them will be used and you have access to change it.
...Have a nice stay

User avatar
khadafi laidi
Inhabitant of a Continent
Reactions:
Posts: 1287
Joined: Fri Dec 16, 2016 13:11
Location: ternate,indonesia
Plugins: Show
Version: Beta
Phone model: Oppo neo 5

Re: Upgrades (for buildings)

Post by khadafi laidi » Tue Jan 09, 2018 0:13

Upgrade can use coordinate X and Y?
Fact about me:
-President of FINDONEZIA
-Plugin illustrator
-Motivator
-Comedian B)
-Indonesian translator (Stoped)
-I hate soccer :x
-Now i am the Wiki Editor

User avatar
cesareborgia94
Inhabitant of a Country
Reactions:
Posts: 985
Joined: Sun Nov 12, 2017 9:23
Location: The Kingdom of Babilandia
Plugins: Show
Version: Beta
Phone model: Samsung Galaxy 360H

Re: Upgrades (for buildings)

Post by cesareborgia94 » Sat Jan 27, 2018 13:29

Hello,
I have a question.
Can you upgrade for a building which is type:decoration to any RCI building, in this case the building will be upgraded into an industrial type.
Here is the json code:

Code: Select all

[{"build time":0,"draw ground":true,"frames":[{"bmp":"goldorespawn.png"}],"height":1,"id":"$goldore.cesare","influence noise":0,"influence park":0,"influence pollution":0,"needs road":false,"power":0,"spawn":{"height":200,"p":0.003,"radius":800},"text":"A gold ore that is left unmined","title":"Gold ore","type":"decoration","upgrades":[{"frames":[{"bmp":"goldminei.png"}],"height":1,"id":"goldmineind01","influence noise":1,"influence pollution":0,"price":500,"text":"Convert your gold ore into gold mines","title":"Gold Mine","type":"industry","width":1}],"water":0,"width":1}]
IF you are wondering... Yes, on the plans to do a small ore based mining for rural villages. Just curious ;)
I rarely make plugins now, but I still make them in spare time.
Disclaimer Please no request, I'm busy with real life stuff, I hope you understand ;)
You can find me here only. Discord is sh**, sorry JA :(

User avatar
Lobby
Developer
Reactions:
Posts: 3127
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Upgrades (for buildings)

Post by Lobby » Sat Jan 27, 2018 13:31

No, you cannot change the type of the building. However, you might use fun to replace it with a whole new building of another type.
...Have a nice stay

User avatar
cesareborgia94
Inhabitant of a Country
Reactions:
Posts: 985
Joined: Sun Nov 12, 2017 9:23
Location: The Kingdom of Babilandia
Plugins: Show
Version: Beta
Phone model: Samsung Galaxy 360H

Re: Upgrades (for buildings)

Post by cesareborgia94 » Sat Jan 27, 2018 13:38

Lobby wrote: โ†‘
Sat Jan 27, 2018 13:31
No, you cannot change the type of the building. However, you might use fun to replace it with a whole new building of another type.
I have a question. How to use fun to replace the one building to another without upgrading it?
I rarely make plugins now, but I still make them in spare time.
Disclaimer Please no request, I'm busy with real life stuff, I hope you understand ;)
You can find me here only. Discord is sh**, sorry JA :(

User avatar
Lobby
Developer
Reactions:
Posts: 3127
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Upgrades (for buildings)

Post by Lobby » Sat Jan 27, 2018 13:50

Something like

Code: Select all

"fun":[{
  "actions":[{"type":"remove"},{"type":"build","id":"newBuildingId"}]
}]
...Have a nice stay

User avatar
cesareborgia94
Inhabitant of a Country
Reactions:
Posts: 985
Joined: Sun Nov 12, 2017 9:23
Location: The Kingdom of Babilandia
Plugins: Show
Version: Beta
Phone model: Samsung Galaxy 360H

Re: Upgrades (for buildings)

Post by cesareborgia94 » Sat Jan 27, 2018 13:53

Thanks Lobby
I rarely make plugins now, but I still make them in spare time.
Disclaimer Please no request, I'm busy with real life stuff, I hope you understand ;)
You can find me here only. Discord is sh**, sorry JA :(

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6372
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Upgrades (for buildings)

Post by CommanderABab » Sat Jan 27, 2018 17:05

cesareborgia94 wrote: โ†‘
Sat Jan 27, 2018 13:29
Hello,
I have a question.
Can you upgrade for a building which is type:decoration to any RCI building, in this case the building will be upgraded into an industrial type.
Here is the json code:

Code: Select all

[{"build time":0,"draw ground":true,"frames":[{"bmp":"goldorespawn.png"}],"height":1,"id":"$goldore.cesare","influence noise":0,"influence park":0,"influence pollution":0,"needs road":false,"power":0,"spawn":{"height":200,"p":0.003,"radius":800},"text":"A gold ore that is left unmined","title":"Gold ore","type":"decoration","upgrades":[{"frames":[{"bmp":"goldminei.png"}],"height":1,"id":"goldmineind01","influence noise":1,"influence pollution":0,"price":500,"text":"Convert your gold ore into gold mines","title":"Gold Mine","type":"industry","width":1}],"water":0,"width":1}]
IF you are wondering... Yes, on the plans to do a small ore based mining for rural villages. Just curious ;)
Nice idea! Sort of like mining an ore deposit discovered in Civilization!
517517Currently using beta 517. 517 What's new? :)
Lua!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

User avatar
cesareborgia94
Inhabitant of a Country
Reactions:
Posts: 985
Joined: Sun Nov 12, 2017 9:23
Location: The Kingdom of Babilandia
Plugins: Show
Version: Beta
Phone model: Samsung Galaxy 360H

Re: Upgrades (for buildings)

Post by cesareborgia94 » Sat Jan 27, 2018 20:07

I got this error when I tried to implement the fun condition:

/storage/emulated/0/TheoTown/plugins/Goldspawntest/goldorespawn01.json:

org.json.JSONException: End of input at character 408 of

Code: Select all

[{"build time":0,
"draw ground":true,
"frames":[{"bmp":"goldorespawn.png"}],
"height":1,"id":"$goldore.cesare",
"influence noise":0,
"influence park":0,
"influence pollution":0,
"needs road":false,
"power":0,
"spawn":{"height":200,"p":0.003,"radius":800},
"text":"A gold ore that is left unmined",
"fun":[
        {
            "actions":[{"type":"remove"},{"type":"build","id":"$goldmineind01"}], 
        
I rarely make plugins now, but I still make them in spare time.
Disclaimer Please no request, I'm busy with real life stuff, I hope you understand ;)
You can find me here only. Discord is sh**, sorry JA :(

User avatar
Lobby
Developer
Reactions:
Posts: 3127
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Upgrades (for buildings)

Post by Lobby » Sat Jan 27, 2018 20:57

JSONLint is all you need :)
...Have a nice stay

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 6372
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Upgrades (for buildings)

Post by CommanderABab » Sat Jan 27, 2018 21:01

You might want to use

Code: Select all

"on click fun"
to change the building.
517517Currently using beta 517. 517 What's new? :)
Lua!
:)

Telegram - t.me/
๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธCommander๐Ÿ†Ž๏ธ๐Ÿ†Ž๏ธ

Post Reply Previous topicNext topic

Return to โ€œTutorials and Documentationโ€

Who is online

Users browsing this forum: No registered users and 2 guests

๏ปฟ