Page 1 of 1

multirocketshot

Posted: Sun Sep 20, 2015 9:12 am
by kingarthur
im trying to create modded explosive rockets that fire multiple rockets with one shot and i keep getting an error when i try to load it up about dataloader.lua looking for a table that doesn't exist.
The attachment error.jpg is no longer available
im not sure what the issue is to fix it

Re: multirocketshot

Posted: Sun Sep 20, 2015 9:38 am
by Kayanor
In your ammo.lua are two typos.
After the data:extend only a normal bracket ( is needed, no curly bracket {. The same at the very end of the file: you only need a ).

Re: multirocketshot

Posted: Sun Sep 20, 2015 11:01 am
by kingarthur
thanks that got that error to go away. now its coming up with this.
error 2
error 2
error2.jpg (22.57 KiB) Viewed 7802 times
all my brackets seem to be closed.

Code: Select all

data.extend(

    type = "ammo",
    name = "explosive-rocket",
    icon = "__base__/graphics/icons/explosive-rocket.png",
    flags = {"goes-to-main-inventory"},
    ammo_type =
    {
      category = "rocket",
      action =
      {
        type = "direct",
		repeat_count = 12,
        action_delivery =
        {
          type = "projectile",
          projectile = "explosive-rocket",
          starting_speed = 0.1,
		  direction_deviation = 0.3,
            range_deviation = 0.3,
          source_effects =
          {
            type = "create-entity",
            entity_name = "explosion-hit"
          }
        }
      }
    },
	magazine_size = 10,
    subgroup = "ammo",
    order = "d[rocket-launcher]-b[explosive]",
    stack_size = 100 
	
)
i appericate any help in getting this to work. all im trying to do is get it to fire 2 or missile at the same time

Re: multirocketshot

Posted: Sun Sep 20, 2015 11:17 am
by Kayanor
I fixed it. Code below.

Code: Select all

data:extend(
{
    {
        type = "ammo",
        name = "explosive-rocket",
        icon = "__base__/graphics/icons/explosive-rocket.png",
        flags = {"goes-to-main-inventory"},
        ammo_type =
        {
            category = "rocket",
            action =
            {
                type = "direct",
                repeat_count = 12,
                action_delivery =
                {
                    type = "projectile",
                    projectile = "explosive-rocket",
                    starting_speed = 0.1,
                    direction_deviation = 0.3,
                    range_deviation = 0.3,
                    source_effects =
                    {
                        type = "create-entity",
                        entity_name = "explosion-hit"
                    }
                }
            }
        },
        magazine_size = 10,
        subgroup = "ammo",
        order = "d[rocket-launcher]-b[explosive]",
        stack_size = 100 
    }
})

Re: multirocketshot

Posted: Sun Sep 20, 2015 11:42 am
by kingarthur
ya i tried that already. it goes back to giving the original error about a table being expected

Re: multirocketshot

Posted: Sun Sep 20, 2015 11:55 am
by Kayanor
I see I still have Factorio 0.12.7, I need to update.
This can take a while since the factorio.com servers seem down.

Re: multirocketshot

Posted: Sun Sep 20, 2015 12:25 pm
by keyboardhack
you used data.extend instead of data:extend.
fixed it for you in the code below

Code: Select all

data:extend(
{
	{
		type = "ammo",
		name = "explosive-rocket",
		icon = "__base__/graphics/icons/explosive-rocket.png",
		flags = {"goes-to-main-inventory"},
		ammo_type =
		{
			category = "rocket",
			action =
			{
				type = "direct",
				repeat_count = 12,
				action_delivery =
				{
					type = "projectile",
					projectile = "explosive-rocket",
					starting_speed = 0.1,
					direction_deviation = 0.3,
					range_deviation = 0.3,
					source_effects =
					{
						type = "create-entity",
						entity_name = "explosion-hit"
					}
				}
			}
		},
    subgroup = "ammo",
    order = "d[rocket-launcher]-b[explosive]",
    stack_size = 100
  }
 })

Re: multirocketshot

Posted: Sun Sep 20, 2015 1:39 pm
by Kayanor
keyboardhack wrote:you used data.extend instead of data:extend.
Nope, that's not true. :P

Re: multirocketshot

Posted: Sun Sep 20, 2015 8:10 pm
by keyboardhack
Kajanor wrote:
keyboardhack wrote:you used data.extend instead of data:extend.
Nope, that's not true. :P
i downloaded the mod he uploaded and in there he uses data.extend. The mod loads with the code i posted.

Re: multirocketshot

Posted: Sun Sep 20, 2015 8:27 pm
by daniel34
You both posted the exact same code, except that keyboardhack removed the line "magazine_size = 10," from the code.
keyboardhack wrote:
Kajanor wrote:
keyboardhack wrote:you used data.extend instead of data:extend.
Nope, that's not true. :P
i downloaded the mod he uploaded and in there he uses data.extend. The mod loads with the code i posted.
keyboardhack was talking about the original code post, Kajanor fixed the same issue in his code.

Re: multirocketshot

Posted: Sun Sep 20, 2015 9:38 pm
by kingarthur
thanks guys for the help. after i corrected the data:extend issue the way Kajanor posted it loads now and rockets now have magazines to them. just got to get the multi rocket part to work but should be easier to figure out now that i have slept.

Re: multirocketshot

Posted: Mon Sep 21, 2015 4:53 am
by kingarthur
another small issue. ive got the recipes created and items created for the ammo. i cant figure out how to update the rocketry tech to add my items recipes to be unlocked by it.

Code: Select all

data.raw.technology["rocketry"].effects,{type = "unlock-recipe", recipe = "mini-rocket"}, {type = "unlock-recipe", recipe = "rocket-shotgun-ammo" }
. the items work fine they just cant be researched yet. i attached the files with the rest of the info in case its needed.

Re: multirocketshot

Posted: Mon Sep 21, 2015 6:45 am
by Choumiko
Use

Code: Select all

table.insert(data.raw.technology["rocketry"].effects, {type = "unlock-recipe", recipe = "mini-rocket"})
table.insert(data.raw.technology["rocketry"].effects, {type = "unlock-recipe", recipe = "rocket-shotgun-ammo" })
For existing saves you need to add a migration file, containing sth. like

Code: Select all

for _, force in pairs(game.forces) do
  force.reset_recipes()
  force.reset_technologies()
end

Re: multirocketshot

Posted: Mon Sep 21, 2015 7:42 am
by kingarthur
ah, i didn't realize i needed the table.insert for that. and thanks for the script it was my next task and you saved me a lot of time trying to reverse engineer it from something. the mods is updated with tech and recipes now if anybody wants to play with it. https://forums.factorio.com/forum/vie ... 28#p109028. feedback would be appreciated.