Wiki tutorial by FreeER
- WovenCookie
- Inserter
- Posts: 23
- Joined: Wed Jun 25, 2014 5:23 pm
- Contact:
Wiki tutorial by FreeER
i was doing the tutorial and typing it but then a error came up, so i decided i will just copy paste but the error still came up
it said
Factorio\mods\Solar-Plus|data.lua:21:' } ' expected (to close ' { ' at line 1) near ' { '
and its the same code from the wiki, i didnt change anything yet.
im using notepad++ if that makes a difference...
it said
Factorio\mods\Solar-Plus|data.lua:21:' } ' expected (to close ' { ' at line 1) near ' { '
and its the same code from the wiki, i didnt change anything yet.
im using notepad++ if that makes a difference...
Re: Wiki tutorial by FreeER
Hm, without actually seeing the code then I can't really point out the problem any better than the error message does, which is that Factorio expected a table that started on line 1 to end on line 21 with a '}' but it didn't (notepad++ shows ')'s and 'end's as equivalent to '}' but they truly aren't, they must match what opened them). It could be that a '{' was typed accidentally instead of a '}', or it could also be that it shouldn't be ending on line 21 but does because it's missing a ',' which is what it looks for to tell when a table 'should' end... It is entirely possible that the wiki has a mistake, it is also possible that the mistake is a bit higher up in your code than where you copied from the wiki... I just can't tell without seeing the code
- WovenCookie
- Inserter
- Posts: 23
- Joined: Wed Jun 25, 2014 5:23 pm
- Contact:
Re: Wiki tutorial by FreeER
Sorry for the miss understanding, i didn't put in my code yet, i just wanted to see an example its the same exact code from the wiki. I added the commas and that helped but it now says
Error while loading prototype"bomber": Energy amount has to be specified in W or J (Watts or Joules)
so, yeah i tried to find the energy input in the code but i couldn't find it, so I'm just clueless.
i only went to chapter 6 btw, could that be the problem?
Error while loading prototype"bomber": Energy amount has to be specified in W or J (Watts or Joules)
so, yeah i tried to find the energy input in the code but i couldn't find it, so I'm just clueless.
i only went to chapter 6 btw, could that be the problem?
Re: Wiki tutorial by FreeER
no, no that one actually is a problem with the wiki code Not a 'direct' problem, as in I did it wrong mind you (but it hasn't been updated in awhile) Factorio now requires the 'consumption' property of the car to be a string of "_number_measurement", meaning something like "600kw" (that's what the base game has for the car). So change consumption from 0.1 to "6kW" with the quotes (I believe that would be the appropriate conversion...it used to be per tick which is 60 times per second so a multiplication of 60 and tacking on the kw should be right). When encountering any issues loading prototypes ("x has to be specified in y", "could not load x", "x missing for y", etc.) it's best and easiest to check how that type is defined in the base game (Factorio\data\base\prototypes) since the base will always be up to date I see a few things that are also 'new' to the car prototype, but mostly sound related (so I don't think those will be required for the bomber...)WovenCookie wrote:so, yeah i tried to find the energy input in the code but i couldn't find it, so I'm just clueless.
i only went to chapter 6 btw, could that be the problem?
A tip when using Notepad++ is that you can right click a tab and select 'move to other view' and you can see two tabs at once (and if you have the 'compare' plugin installed, I think it is by default, you can click plugins->compare->compare or press alt+d, and ctrl+alt+d to clear the results. Clearing the results seems to 'reset' the the language selection though so you have to go to the top of the file and make any change to 'fix' it).
btw, sorry for the delay in responding.. I got distracted playing the Son of Nor beta
- WovenCookie
- Inserter
- Posts: 23
- Joined: Wed Jun 25, 2014 5:23 pm
- Contact:
Re: Wiki tutorial by FreeER
Wow, i don't know what it is, every time i fix one error another comes up, do you think at this point i should just go from scratch? any way here is the error, this error looks simple but i am just a beginner and only has a slightest clue of what I'm doing
EntityPrototype Unknown key:"entity-name.bomber" doesn't have an order string.
oh and thanks for your patience this stuff is helping me out more than you might think.
EntityPrototype Unknown key:"entity-name.bomber" doesn't have an order string.
oh and thanks for your patience this stuff is helping me out more than you might think.
Re: Wiki tutorial by FreeER
ah, another change since I made the tutorial... add [order = "something"] to the bomber, like was given to the items, it can even be the same string (without the '[]', I just needed a way to deliminate it since I was already using quotes). It's used to determine the order of items in the inventory (alphabetically).WovenCookie wrote:entityPrototype Unknown key:"entity-name.bomber" doesn't have an order string.
No problem, I enjoy helping, plus it's sort of my fault for not updating the tutorialWovenCookie wrote:oh and thanks for your patience this stuff is helping me out more than you might think.
- WovenCookie
- Inserter
- Posts: 23
- Joined: Wed Jun 25, 2014 5:23 pm
- Contact:
Re: Wiki tutorial by FreeER
did you literally mean "something" or just put something there either or it still showed the same error when i did it.add[order = "something"]
edit: Nevermind i fixed it,i didnt add
place_result = "bomber",
well i think thats it... i just need some pics and im good to go
Last edited by WovenCookie on Fri Jun 27, 2014 2:05 pm, edited 1 time in total.
Re: Wiki tutorial by FreeER
Something is whatever you want. Here is the order string used by the big biters:
Also note that if the entity you created can be placed by an item, it does not need an order string of its own because it inherits the one in the item prototype.
Code: Select all
order="b-b-c"
Re: Wiki tutorial by FreeER
I followed this guide step by step but the mod doesn't work. When I start factorio an error pop up telling : "Error while loading entity prototype "bomber" (car): No such noce (animation).
Re: Wiki tutorial by FreeER
When ever i try launching my game with my mod in, it keeps giving me this error " Error while loading entity prototype "bomber" (car): No such node (animation) " i have only done chapters 1-4, but i have not gotten to open my game up to test the bomber because of this, i have followed exactly, copy and paste, i am running factorio 11.3 thanks great tutorial, very easy to follow, seems to be a decent amount of support, and i can see this helping people make some great mods
Re: Wiki tutorial by FreeER
This guide is for version 0.10.3, can edit car entity with base-game car
Re: Wiki tutorial by FreeER
L0771 wrote:This guide is for version 0.10.3, can edit car entity with base-game car
An updated version of this tutorial would be very much appreciated, then. That, or an explanation of what you mean with this?
Re: Wiki tutorial by FreeER
An updated version is on the way, I just haven't managed to take the time to rework the graphics for the bomber into the new manner used by the car entity. by "edit car entity with base-game car" L0771 meant that you can overwrite the bomber entity in the tutorial (which is based off of the car entity type) with the car entity in the base game which is in the /data/base/prototypes/entity/entities.lua file (search for "car"). Here's a partial update (with that change, might even work in MP), obviously no nice bomber graphics in game.JJosh wrote:An updated version of this tutorial would be very much appreciated, then. That, or an explanation of what you mean with this?L0771 wrote:This guide is for version 0.10.3, can edit car entity with base-game car
edit: as for the tutorial itself I've made a few notes for updating it (rough and near useless for learning as they are but might as well share them as well)
notes
Re: Wiki tutorial by FreeER
I see what was meant now, and I appreciate the update. Thank you.
Re: Wiki tutorial by FreeER
May someone help me?
I followed the current tutorial, this was done through copy/pasting and TextWrangler. However, when I load Factorio (in version 0.11.15 since 0.10 is broken for macs) it says:
Unexpected error occurred. You can help us to solve the problem by posting the contents of the log file on the Factorio forums.
Thank you in advance!
The log file is:
21454.463667 Info Logger.cpp:152: 2015-02-06 17:23:18; Factorio 0.11.15 (Build 13276, mac)
21454.463738 Info Logger.cpp:156: Operating system: Mac OS X 10.10.1
21454.463751 Info Paths.cpp:202: Read data path: /Applications/factorio.app/Contents/data
21454.463761 Info Paths.cpp:203: Write data path: /Users/nicolas/Library/Application Support/factorio
21454.463771 Info Paths.cpp:204: Binaries path: /
21456.845513 Info ModManager.cpp:205: Loading mod core 0.0.0 (data.lua)
21456.870797 Info ModManager.cpp:205: Loading mod base 0.11.15 (data.lua)
21457.372118 Info ModManager.cpp:205: Loading mod BomberTutorial 0.1.1 (data.lua)
0 factorio 0x0000000100354cae _ZN6Logger13logStacktraceEv + 62
1 factorio 0x0000000100351467 _ZN12CrashHandler13SignalHandlerEi + 39
2 libsystem_platform.dylib 0x00007fff91363f1a _sigtramp + 26
3 ??? 0x203e3d3d20297325 0x0 + 2323361790511641381
4 factorio 0x00000001002bd61a _ZN9LuaHelper13packageDofileEP9lua_StateRK11PackagePathRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEi + 666
5 factorio 0x000000010007e81f _ZN13LuaDataLoader8loadDataERK11PackagePathP5Paths + 815
6 factorio 0x000000010007e04d _ZN10ModManager7loadModE5ModIDR13LuaDataLoaderRK11PackagePathPKc + 413
7 factorio 0x000000010007e1e2 _ZN10ModManager13loadModsPhaseER13LuaDataLoaderPKc + 162
8 factorio 0x000000010007d956 _ZN10ModManager8loadDataEbP14LocaleProvider + 1494
9 factorio 0x000000010018b3b2 _ZN13GlobalContext4initEbRKN5boost10filesystem4pathE + 3138
10 factorio 0x00000001002771d6 _ZN8MainLoop3runERKN5boost10filesystem4pathES4_b + 166
11 factorio 0x000000010027650a _al_mangled_main + 6698
12 factorio 0x00000001006a4a87 +[AllegroAppDelegate app_main:] + 23
13 Foundation 0x00007fff848edb7a __NSThread__main__ + 1345
14 libsystem_pthread.dylib 0x00007fff87a9e2fc _pthread_body + 131
15 libsystem_pthread.dylib 0x00007fff87a9e279 _pthread_body + 0
16 libsystem_pthread.dylib 0x00007fff87a9c4b1 thread_start + 13
21457.391282 Error Util.cpp:43: Unexpected error occurred. You can help us to solve the problem by posting the contents of the log file on the Factorio forums.
I followed the current tutorial, this was done through copy/pasting and TextWrangler. However, when I load Factorio (in version 0.11.15 since 0.10 is broken for macs) it says:
Unexpected error occurred. You can help us to solve the problem by posting the contents of the log file on the Factorio forums.
Thank you in advance!
The log file is:
21454.463667 Info Logger.cpp:152: 2015-02-06 17:23:18; Factorio 0.11.15 (Build 13276, mac)
21454.463738 Info Logger.cpp:156: Operating system: Mac OS X 10.10.1
21454.463751 Info Paths.cpp:202: Read data path: /Applications/factorio.app/Contents/data
21454.463761 Info Paths.cpp:203: Write data path: /Users/nicolas/Library/Application Support/factorio
21454.463771 Info Paths.cpp:204: Binaries path: /
21456.845513 Info ModManager.cpp:205: Loading mod core 0.0.0 (data.lua)
21456.870797 Info ModManager.cpp:205: Loading mod base 0.11.15 (data.lua)
21457.372118 Info ModManager.cpp:205: Loading mod BomberTutorial 0.1.1 (data.lua)
0 factorio 0x0000000100354cae _ZN6Logger13logStacktraceEv + 62
1 factorio 0x0000000100351467 _ZN12CrashHandler13SignalHandlerEi + 39
2 libsystem_platform.dylib 0x00007fff91363f1a _sigtramp + 26
3 ??? 0x203e3d3d20297325 0x0 + 2323361790511641381
4 factorio 0x00000001002bd61a _ZN9LuaHelper13packageDofileEP9lua_StateRK11PackagePathRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEi + 666
5 factorio 0x000000010007e81f _ZN13LuaDataLoader8loadDataERK11PackagePathP5Paths + 815
6 factorio 0x000000010007e04d _ZN10ModManager7loadModE5ModIDR13LuaDataLoaderRK11PackagePathPKc + 413
7 factorio 0x000000010007e1e2 _ZN10ModManager13loadModsPhaseER13LuaDataLoaderPKc + 162
8 factorio 0x000000010007d956 _ZN10ModManager8loadDataEbP14LocaleProvider + 1494
9 factorio 0x000000010018b3b2 _ZN13GlobalContext4initEbRKN5boost10filesystem4pathE + 3138
10 factorio 0x00000001002771d6 _ZN8MainLoop3runERKN5boost10filesystem4pathES4_b + 166
11 factorio 0x000000010027650a _al_mangled_main + 6698
12 factorio 0x00000001006a4a87 +[AllegroAppDelegate app_main:] + 23
13 Foundation 0x00007fff848edb7a __NSThread__main__ + 1345
14 libsystem_pthread.dylib 0x00007fff87a9e2fc _pthread_body + 131
15 libsystem_pthread.dylib 0x00007fff87a9e279 _pthread_body + 0
16 libsystem_pthread.dylib 0x00007fff87a9c4b1 thread_start + 13
21457.391282 Error Util.cpp:43: Unexpected error occurred. You can help us to solve the problem by posting the contents of the log file on the Factorio forums.
No, I'm not a piece of cheese!
Re: Wiki tutorial by FreeER
First the tutorial isn't quite updated to 11 yet (mainly the car prototype used by the bomber has changed), look a couple posts up and you'll see a zip of the partial update (graphics haven't been redone yet). Second, what you posted would indicate an issue with Factorio itself not, exactly, the mod. So the log should be posted in the Bug Reports section with the relevant info (it could be related to the mod if 11.15 works without it so feel free to upload your version with the post).Gouada wrote:May someone help me?
Re: Wiki tutorial by FreeER
I've got a mostly-working bomber (it flies, at least) by wholesale lifting of the actual car prototype code. But I'm having a weird problem where it occasionally goes entirely invisible while moving around. Can anybody please advise?
Oh, I'm attaching the modified bomber pic. Maybe it can save you some effort when updating your guide
Edit: Is there anything like an API for the code? Or do we need to dissect the base mod to try and figure out what's available?
Oh, I'm attaching the modified bomber pic. Maybe it can save you some effort when updating your guide
Edit: Is there anything like an API for the code? Or do we need to dissect the base mod to try and figure out what's available?
Code: Select all
data:extend({
{
type = "car",
name = "bomber",
icon = "__BomberTutorial__/graphics/icon_bomber.png",
flags = {"placeable-player", "player-creation", "placeable-off-grid", "not-on-map"},
collision_box = {{0, 0}, {0, 0}},
minable = {mining_time = 1, result = "bomber"},
max_health = 2000,
corpse = "medium-remnants",
collision_mask = {},
dying_explosion = "huge-explosion",
energy_per_hit_point = 1,
selection_box = {{-0.7, -1}, {0.7, 1}},
effectivity = 0.5,
braking_power = "200kW",
burner =
{
effectivity = 0.6,
fuel_inventory_size = 1,
smoke =
{
{
name = "smoke",
deviation = {0.25, 0.25},
frequency = 50,
position = {0, 1.5},
slow_down_factor = 0.9,
starting_frame = 3,
starting_frame_deviation = 5,
starting_frame_speed = 0,
starting_frame_speed_deviation = 5
}
}
},
consumption = "150kW",
friction = 2e-3,
light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -14},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
filename = "__BomberTutorial__/graphics/sheet_bomber.png",
line_length = 8,
width = 211,
height = 211,
frame_count = 1,
axially_symmetrical = false,
direction_count = 16,
shift = {0, -0.1875},
animation_speed = 8,
}
}
},
turret_rotation_speed = 0.35 / 60,
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.2;
working_sound =
{
sound =
{
filename = "__base__/sound/car-engine.ogg",
volume = 0.6
},
activate_sound =
{
filename = "__base__/sound/car-engine-start.ogg",
volume = 0.6
},
deactivate_sound =
{
filename = "__base__/sound/car-engine-stop.ogg",
volume = 0.6
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
rotation_speed = 0.015,
weight = 700,
guns = { "submachine-gun" },
inventory_size = 80
}
})
- Attachments
-
- sheet_bomber.png (699 KiB) Viewed 18559 times
-
- Manual Inserter
- Posts: 3
- Joined: Wed Jul 15, 2015 6:30 pm
- Contact:
Re: Wiki tutorial by FreeER
Hello Can You Help Me ???
I Creating My 3rd Mod
How so it give me all I need Scripts to create chest's with enlarged number of slots
I Creating My 3rd Mod
How so it give me all I need Scripts to create chest's with enlarged number of slots
Re: Wiki tutorial by FreeER
Hi! I'm still relatively new to the game and was curious to how the modding scene is. After a lot of wiki and forum reading, I found your tutorial. Kicking and screaming didn't seem to get things working at all, and then I found your partial update.
I've been wrestling these lua errors for about an hour now, slowly editing the control.lua each time.
Eventually I managed to get the mod working, it flies and it bombs appropriately. (really wouldn't mind extending this )
Anyways this is what my resulting control.lua file looks like now, for anyone interested:
Again for those interested, the following changes (mainly) were made:
Which was great because it got me a step in the right direction! However, there were still a bunch of errors showing up D:FreeER wrote: Here's a partial update
I've been wrestling these lua errors for about an hour now, slowly editing the control.lua each time.
Eventually I managed to get the mod working, it flies and it bombs appropriately. (really wouldn't mind extending this )
Anyways this is what my resulting control.lua file looks like now, for anyone interested:
Code: Select all
require "util"
require "defines"
-- The code for FreeER's Step By Step Guide to Modding Factorio
-- (Created for Factorio 0.3.x Updated to 0.11.x) AKA Bomber Mod
function init() -- ran when the mod is first loaded
global.bomber = 0 -- time placeholder
global.version = "0.1.2"
end
game.on_init(init)
game.on_load(function() if not global.bomber then init() end end)
game.on_event(defines.events.on_tick, function(event) -- ran ~60 times per second
-- if there are players in the game
if #game.players > 0 then
-- then loop through all of them and...
for _, player in ipairs(game.players) do
-- if this player has a character (as opposed to being in a sandbox game)
-- and that character is in a vehicle and that vehicle is our bomber
-- and that bomber has at least 1 bomb item in it's inventory
-- and it's been more than 180 ticks (3 seconds) since the last bombing
if player.character and player.character.vehicle
and player.character.vehicle.name == "bomber"
and player.character.vehicle.get_inventory(2).get_item_count("bomb") >= 1
and event.tick-global.bomber >= 180 then -- delay of 3 seconds per drop
local bomber = player.character.vehicle -- reference to bomber
local bombArea = game.surfaces["nauvis"].find_entities{ -- area to 'bomb'
{ -- rectangular area to search by specifying bottomleft and topright xy
bomber.position.x-5,
bomber.position.y-5
},
{
bomber.position.x+5,
bomber.position.y+5
}
}
local drop = false -- boolean determining whether we should 'drop' a bomb
local enemyCount = 0 -- number of biters in bombArea
for index, enemy in pairs(bombArea) do -- loop over entities in bombArea
if enemy.force.name == 'enemy' then -- if it actually is an enemy
if enemy.type == 'spawner' then -- count spawners as a priority
drop = true
break; -- stop looping now that we know we will drop a bomb
elseif enemy.type == 'unit' or enemy.type == 'turret' then
enemyCount = enemyCount + 1 -- count units and worms as 1 'enemy'
if enemyCount > 5 then -- if five or more will be killed then drop
drop = true
break; -- stop looping
end
end
end
end
if drop then -- if we decided to drop a bomb
global.bomber = event.tick -- store the time we dropped a bomb
for index, entity in pairs(bombArea) do
if entity.force.name == 'enemy' then
if entity.health then -- if it has health
entity.die() -- make it die
else -- no health, so no die method to call
entity.destroy() -- use destroy
end
end
end
-- now remove the 'dropped' bomb from the bomber's inventory
bomber.get_inventory(2).remove{name="bomb", count=1}
end
end
end
end
end)
- Changing all instances of glob to global.
All game functions had to be changed to include underscores between names. eg. game.oninit was changed to game.on_init
The game.find_entities function had to be called from game.surfaces instead ("nauvis" seems to be the base surface type, so that the script will search all tiles in the area indiscriminately)
There doesn't seem to be an equals function for the force table, so I compared the force name to "enemy" instead.
- TechedZombie
- Manual Inserter
- Posts: 2
- Joined: Mon Oct 19, 2015 11:01 pm
- Contact:
Re: Wiki tutorial by FreeER
Hey I was trying to make a mod similar to "Too many items mod" for minecraft (Idk if one exists or not but either way this is my first factorio mod I need the practice) and I as wondering why my current code will not work... My overall goal is too make everything cost one stone or make everything cost nothing (if that is possible)... I tried to make a recipe that costs one stone and yields one iron plate however i cannot seem to figure out why it does not work. Factorio Does not give me an error on start but the recipe does not show up anywhere (*Should be in weapons tab I think)
Also can I add a new tab for making cheat items.... Or just make a menu that you can click n something in and receive it???
Also can I add a new tab for making cheat items.... Or just make a menu that you can click n something in and receive it???
Code: Select all
data:extend({
{
type = "recipe",
name = "Iron",
enabled = "true",
ingredients =
{
{"stone", 1}
},
result = "iron-plate"
subgroup="ammo"
})
--TechedZombie--
Modder, Scrub, Midget
Modder, Scrub, Midget
Srsly I am a midget