multirocketshot

Place to get help with not working mods / modding interface.
Post Reply
kingarthur
Smart Inserter
Smart Inserter
Posts: 1459
Joined: Sun Jun 15, 2014 11:39 am
Contact:

multirocketshot

Post 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
Attachments
multishotrocket_0.0.1.zip
modded rocket
(1.21 KiB) Downloaded 89 times
error.jpg
error.jpg (24.58 KiB) Viewed 7615 times

User avatar
Kayanor
Global Moderator
Global Moderator
Posts: 565
Joined: Sat May 10, 2014 7:20 am
Contact:

Re: multirocketshot

Post 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 ).
Former moderator.

kingarthur
Smart Inserter
Smart Inserter
Posts: 1459
Joined: Sun Jun 15, 2014 11:39 am
Contact:

Re: multirocketshot

Post 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 7592 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

User avatar
Kayanor
Global Moderator
Global Moderator
Posts: 565
Joined: Sat May 10, 2014 7:20 am
Contact:

Re: multirocketshot

Post 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 
    }
})
Former moderator.

kingarthur
Smart Inserter
Smart Inserter
Posts: 1459
Joined: Sun Jun 15, 2014 11:39 am
Contact:

Re: multirocketshot

Post by kingarthur »

ya i tried that already. it goes back to giving the original error about a table being expected

User avatar
Kayanor
Global Moderator
Global Moderator
Posts: 565
Joined: Sat May 10, 2014 7:20 am
Contact:

Re: multirocketshot

Post 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.
Former moderator.

keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: multirocketshot

Post 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
  }
 })
Waste of bytes : P

User avatar
Kayanor
Global Moderator
Global Moderator
Posts: 565
Joined: Sat May 10, 2014 7:20 am
Contact:

Re: multirocketshot

Post by Kayanor »

keyboardhack wrote:you used data.extend instead of data:extend.
Nope, that's not true. :P
Former moderator.

keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: multirocketshot

Post 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.
Waste of bytes : P

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: multirocketshot

Post 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.
quick links: log file | graphical issues | wiki

kingarthur
Smart Inserter
Smart Inserter
Posts: 1459
Joined: Sun Jun 15, 2014 11:39 am
Contact:

Re: multirocketshot

Post 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.

kingarthur
Smart Inserter
Smart Inserter
Posts: 1459
Joined: Sun Jun 15, 2014 11:39 am
Contact:

Re: multirocketshot

Post 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.
Attachments
multishotrocket_0.0.1.zip
all files
(2.7 KiB) Downloaded 99 times

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: multirocketshot

Post 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

kingarthur
Smart Inserter
Smart Inserter
Posts: 1459
Joined: Sun Jun 15, 2014 11:39 am
Contact:

Re: multirocketshot

Post 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.

Post Reply

Return to “Modding help”