Page 1 of 1
[Solved]ArrayOutOfBoundsException
Posted: 01 May 2017, 17:53
by Mayor Jeffrey IX
Problem is as follows:
Plugin Error
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
Posted: 01 May 2017, 18:21
by Lobby
Without code it's difficult to help. You probably didn't provide frames.
Posted: 01 May 2017, 19:55
by Mayor Jeffrey IX
I have all seven frames (wr1, wr2, wr3, wr4, wr5, wr6, basewindmill).
Posted: 01 May 2017, 19:58
by Lobby
It would be a lot more easy if you could paste the code directly into the forum using the
Code: Select all
-tags. Also the error message tells you where it occurred, that might be helpful.
It's most likely that there's a mistake in your image names.
Posted: 01 May 2017, 20:03
by Mayor Jeffrey IX
Code: Select all
[
{
"id": "wind_rotor01",
"type": "animation",
"frames": [
{"bmp": "wr1.png"},
{"bmp": "wr2.png"},
{"bmp": "wr3.png"},
{"bmp": "wr4.png"},
{"bmp": "wr5.png"},
{"bmp": "wr6.png"}
]
},
{
"id":"floatingwindturbine",
"width": 4,
"height": 4,
"frames": [{"bmp":"basewindturbine.png"}],
"type": "energy",
"needs water": true,
"needs land": false,
"power": 1000,
"draw ground":true,
"price": 8000,
"monthly price": 60,
"needs road": false,
"water": 0,
"influence noise": 35,
"animation":[{"id":"wind_rotor01","x":0,"y":-85}],
"requirement": {
"requirements":
[
{
"type": "HABITANT_COUNT",
"data": {
"count": 300
}
}
]
}
}
]
Man I am such a noob
Posted: 02 May 2017, 14:09
by Mayor Jeffrey IX
So do you have an idea of what could be wrong?
Posted: 02 May 2017, 14:20
by BetterBear
Mayor Jeffrey IX wrote:So do you have an idea of what could be wrong?
I think because he wrote
And since its a wind turbine, I should be:
Still not sure
Posted: 02 May 2017, 14:45
by Josh
Or do you mean how many habitants, than instead of
Code: Select all
"type": "HABITANT_COUNT",
"data": {
"count": 300
You need to do
Posted: 02 May 2017, 15:32
by Lobby
It looks as if it doesn't see the contents of your JSON File
Posted: 02 May 2017, 18:26
by Mayor Jeffrey IX
@BetterBear
This
Code: Select all
"requirement": {
"requirements":
[
{
"type":"HABITANT_COUNT",
"data": {
"count": 300
}
}
]
}
is a seperate line of code, and if you look at the top, you'll see
I know this works 'cause I've used this in other plugins.
@Lobby
Hmmm that's odd... not sure what could cause that.
Posted: 02 May 2017, 21:02
by Josh
Do you want a certain amount of habitans to achieve this building?
Posted: 02 May 2017, 21:04
by CommanderABab
I think that he is trying to make it like the regular wind turbine.
Posted: 02 May 2017, 22:14
by Mayor Jeffrey IX
I'd like to get it to get unlocked by rank, but that's not the problem. The problem is the error message (see top).
Posted: 03 May 2017, 19:06
by Mayor Jeffrey IX
All I want to know is what the error message means.
Posted: 03 May 2017, 19:28
by CommanderABab
The width and height of the regular wind turbine is 3x3.
Posted: 03 May 2017, 19:40
by Mayor Jeffrey IX
Ok, I planned it to be 4x4. It's going to be kind of an upgrade to the current one. Not literally.
Posted: 03 May 2017, 21:32
by Lobby
You might consider to send us your current progress to
info@theotown.de so we can have a look at it. The error message alone doesn't tell enough about the issue.
Posted: 17 May 2017, 19:39
by Mayor Jeffrey IX
I figured out the problem!
It turns out I need to put an actual number of frames.
For example:
I need to change this
Code: Select all
[
{
"id": "wind_rotor01",
"type": "animation",
"frames": [
{"bmp": "wr1.png"},
{"bmp": "wr2.png"},
{"bmp": "wr3.png"},
{"bmp": "wr4.png"},
{"bmp": "wr5.png"},
{"bmp": "wr6.png"}
]
},
to this
Code: Select all
[
{
"id": "wind_rotor01",
"type": "animation",
"count": 6,
"frames": [
{"bmp": "wr1.png"},
{"bmp": "wr2.png"},
{"bmp": "wr3.png"},
{"bmp": "wr4.png"},
{"bmp": "wr5.png"},
{"bmp": "wr6.png"}
]
},
That count specifies how many frames there are.
Posted: 17 May 2017, 19:49
by Lobby
That's strange, we don't read a count attribute for animation plugins
Posted: 18 May 2017, 02:44
by Mayor Jeffrey IX
Well, it works now so I'm not gonna complain