If I write
game.players[1].surface.create_entity{name = "grenade", position = {0,0}, target=game.players[1]}
inside my code, I get an error info. It says that the speed is not in ROOT. But what is the speed? surface.create_entity function doesn't receive a parameter named speed. Does it have anything to do with the prototype inside the data.lua?
Or, is it possible to create "grenade" entity?
When I throw a grenade, the surface.find_entities returns me a table with some entity named grenade. When I tried to create it from code, even if I specified the target, it still refused to work. The error info pointed out that a speed field is not specified, but I found no clue about it.
Any idea? How can I create a grenade entity?
[1.1.1] Error info doesn't provide useful info when I create "grenade" entity.
-
- Fast Inserter
- Posts: 152
- Joined: Sun Jun 16, 2019 4:04 pm
- Contact:
Re: [1.1.1] Error info doesn't provide useful info when I create "grenade" entity.
Yes, it's about prototype data. According to the wiki (see the specs on the right side), grenades are instances of the projectile prototype. Hope that helps!yagaodirac wrote: ↑Sun Nov 29, 2020 7:47 am If I write
game.players[1].surface.create_entity{name = "grenade", position = {0,0}, target=game.players[1]}
inside my code, I get an error info. It says that the speed is not in ROOT. But what is the speed? surface.create_entity function doesn't receive a parameter named speed. Does it have anything to do with the prototype inside the data.lua?
Or, is it possible to create "grenade" entity?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: [1.1.1] Error info doesn't provide useful info when I create "grenade" entity.
the 'ROOT' is the table you have given to the create_entity: `{name = "grenade", position = {0,0}, target=game.players[1]}`yagaodirac wrote: ↑Sun Nov 29, 2020 7:47 am If I write
game.players[1].surface.create_entity{name = "grenade", position = {0,0}, target=game.players[1]}
inside my code, I get an error info. It says that the speed is not in ROOT. But what is the speed? surface.create_entity function doesn't receive a parameter named speed. Does it have anything to do with the prototype inside the data.lua?
Or, is it possible to create "grenade" entity?
When I throw a grenade, the surface.find_entities returns me a table with some entity named grenade. When I tried to create it from code, even if I specified the target, it still refused to work. The error info pointed out that a speed field is not specified, but I found no clue about it.
Any idea? How can I create a grenade entity?
It is missing speed, which is how fast it should move
It is listed in the create entity docs under 'Additional entity-specific parameters'
https://lua-api.factorio.com/latest/Lua ... ate_entity
-
- Fast Inserter
- Posts: 152
- Joined: Sun Jun 16, 2019 4:04 pm
- Contact:
Re: [1.1.1] Error info doesn't provide useful info when I create "grenade" entity.
Thank you very much. Very helpful. One more suggestion. The create_entity function is literally too complex. I suggest more example and more detail explained with the examples including this one.Klonan wrote: ↑Sun Nov 29, 2020 9:30 amthe 'ROOT' is the table you have given to the create_entity: `{name = "grenade", position = {0,0}, target=game.players[1]}`yagaodirac wrote: ↑Sun Nov 29, 2020 7:47 am If I write
game.players[1].surface.create_entity{name = "grenade", position = {0,0}, target=game.players[1]}
inside my code, I get an error info. It says that the speed is not in ROOT. But what is the speed? surface.create_entity function doesn't receive a parameter named speed. Does it have anything to do with the prototype inside the data.lua?
Or, is it possible to create "grenade" entity?
When I throw a grenade, the surface.find_entities returns me a table with some entity named grenade. When I tried to create it from code, even if I specified the target, it still refused to work. The error info pointed out that a speed field is not specified, but I found no clue about it.
Any idea? How can I create a grenade entity?
It is missing speed, which is how fast it should move
It is listed in the create entity docs under 'Additional entity-specific parameters'
https://lua-api.factorio.com/latest/Lua ... ate_entity
-
- Fast Inserter
- Posts: 152
- Joined: Sun Jun 16, 2019 4:04 pm
- Contact:
Re: [1.1.1] Error info doesn't provide useful info when I create "grenade" entity.
Very glad to see you again. With answers from both of you, I already know what to do next. Thanks.Pi-C wrote: ↑Sun Nov 29, 2020 8:34 amYes, it's about prototype data. According to the wiki (see the specs on the right side), grenades are instances of the projectile prototype. Hope that helps!yagaodirac wrote: ↑Sun Nov 29, 2020 7:47 am If I write
game.players[1].surface.create_entity{name = "grenade", position = {0,0}, target=game.players[1]}
inside my code, I get an error info. It says that the speed is not in ROOT. But what is the speed? surface.create_entity function doesn't receive a parameter named speed. Does it have anything to do with the prototype inside the data.lua?
Or, is it possible to create "grenade" entity?
-
- Fast Inserter
- Posts: 152
- Joined: Sun Jun 16, 2019 4:04 pm
- Contact:
Re: [1.1.1] Error info doesn't provide useful info when I create "grenade" entity.
Thank you for helping. Here's the final result.
local simple_grenade =
{
acceleration = 0.005,
action = {
{
action_delivery = {
target_effects = {
{
damage = {
amount = 35,
type = "explosion"
},
type = "damage"
},
},
type = "instant"
},
radius = 6.5,
type = "area"
}
},
name = "simple-grenade",
type = "projectile"
}
I didn't test what the acceleration value does. This already works.
local simple_grenade =
{
acceleration = 0.005,
action = {
{
action_delivery = {
target_effects = {
{
damage = {
amount = 35,
type = "explosion"
},
type = "damage"
},
},
type = "instant"
},
radius = 6.5,
type = "area"
}
},
name = "simple-grenade",
type = "projectile"
}
I didn't test what the acceleration value does. This already works.