Page 1 of 1

need a german mod creator

Posted: Wed Jul 26, 2017 7:35 pm
by unfunf22
as the title say´s, i need a german mod creator because my english is not the best. i have many questions about some lua code syntaxes or lua things.


ich suche einen deutschen mod Ersteller der mir ein Parr Sachen erklären kann was lua angeht und vielleicht den einen oder anderen Fehler mit mir durchgeht (Fehlerkorrektur) macht.
Leider kann ich englische Sätze nicht so gut schreiben, englisch an sich verstehe ich ganz ok.
ich habe auch schon gesucht ob es ähnliche posts gibt aber die gibt es nicht.

mfg unfunf22

Re: need a german mod creator

Posted: Wed Jul 26, 2017 7:58 pm
by darkfrei
Ich kann dir etwas helfen.

Re: need a german mod creator

Posted: Wed Jul 26, 2017 9:25 pm
by unfunf22
ah das ist nice.
was müsste ich schreiben damit bei meinem mod wooden walls die walls auch als Brennmaterial zulässig sind? https://mods.factorio.com/mods/unfunf22 ... Walls%20V1
wie kann ich eigne sounds in meinem mod abspielen lassen wenn ich in sagen wir mal als beispiel in einem Panzer (Fahrzeug) sitze, ich möchte aber nicht die base sounds nutzen ich habe eigne sounds. https://mods.factorio.com/mods/unfunf22 ... dings%20V1
weitere fragen kommen noch sofern ich eins nach dem anderen fertig habe.

Re: need a german mod creator

Posted: Wed Jul 26, 2017 9:57 pm
by darkfrei
unfunf22 wrote:ah das ist nice.
was müsste ich schreiben damit bei meinem mod wooden walls die walls auch als Brennmaterial zulässig sind? https://mods.factorio.com/mods/unfunf22 ... Walls%20V1
Also, wenn du englisch verstehen kannst, let me speak from my heart in English.

In the vanilla only trees can burn (it was hardcoded in C++), all another entities can burn only by scripting of it. You must make the file "control.lua" and write there some code, which will be started on some events. Only the event "on_tick" will be started 60 times at second.

You can catch that your entity was died with this event:

Code: Select all

script.on_event(defines.events.on_entity_died, function(event)
	-- some code here
end)
If you need flame, just create it with surface command:
surface.create_entity{name=…, position=…, direction=…, force=…, target=…, source=…, fast_replace=…, player=…, spill=…}

Code: Select all

surface.create_entity{name = "fire-flame", position = position}
Here surface is one of surfaces (parallel worlds), the default one can be defined as

Code: Select all

local surface = game.surfaces[1]
or if you have more then one:

Code: Select all

local surface = entity.surface
Position is a table with two elements:

Code: Select all

local pos = {x=10, y=20}
Just read tons of mods with scripting for better understanding. And lua-api.factorio.com, it is very useful.

Re: need a german mod creator

Posted: Wed Jul 26, 2017 10:12 pm
by darkfrei
unfunf22 wrote:wie kann ich eigne sounds in meinem mod abspielen lassen wenn ich in sagen wir mal als beispiel in einem Panzer (Fahrzeug) sitze, ich möchte aber nicht die base sounds nutzen ich habe eigne sounds. https://mods.factorio.com/mods/unfunf22 ... dings%20V1
The game has a global table, that names "raw".
You can open this file Factorio\data\base\prototypes\entity\entities.lua and find here and find here line #1776 (just use notepad++).
Here example of this code:
tank code
Please don't change it! Yes, if you change it, it will works, but you can forget about updates or multiplayer.

What you need, just change this elements with your mod. Just create data.lua and write it like this:

Code: Select all

raw.car.tank.working_sound.sound.filename = "__base__/sound/fight/tank-engine.ogg"
You can change it to "__yourmodename__/sound/new-sound-of-engine.ogg", then make folder "sound" and put there new sound file.

Re: need a german mod creator

Posted: Wed Jul 26, 2017 10:53 pm
by unfunf22
ok danke schon mal dafür, ich werde viel testen müssen aber ich verstehe jetzt schon ein wenig mehr als vor her.
wenn ich mal so fragen darf, wo her kommst du darkfrei?

Re: need a german mod creator

Posted: Thu Jul 27, 2017 7:58 am
by bobingabout
darkfrei wrote:

Code: Select all

raw.car.tank.working_sound.sound.filename = "__base__/sound/fight/tank-engine.ogg"
shouldn't it be data.raw?

Code: Select all

data.raw.car.tank.working_sound.sound.filename = "__base__/sound/fight/tank-engine.ogg"

Re: need a german mod creator

Posted: Thu Jul 27, 2017 10:15 am
by darkfrei
bobingabout wrote:
darkfrei wrote:

Code: Select all

raw.car.tank.working_sound.sound.filename = "__base__/sound/fight/tank-engine.ogg"
shouldn't it be data.raw?

Code: Select all

data.raw.car.tank.working_sound.sound.filename = "__base__/sound/fight/tank-engine.ogg"
Yes you are right. I think it was wrong copied.

Re: need a german mod creator

Posted: Thu Jul 27, 2017 11:43 am
by unfunf22
ok gut das ich noch nicht den code versucht habe. danke bobingabout für die Korrektur.
mal so neben bei gefragt, war es schwer bobs mods zu machen weil du hast ja denke ich auch mal klein angefangen oder konntest du lua schon vor her?

Re: need a german mod creator

Posted: Sat Sep 02, 2017 9:12 pm
by unfunf22
Is it possible to determine by mod that certain items can only be produced in assembly machine 3, but only 2 items are needed?
What would I have to write, because unfortunately it is not available in the lua api documentation or I just can't find it.

Re: need a german mod creator

Posted: Sat Sep 02, 2017 9:27 pm
by darkfrei
unfunf22 wrote:Is it possible to determine by mod that certain items can only be produced in assembly machine 3, but only 2 items are needed?
What would I have to write, because unfortunately it is not available in the lua api documentation or I just can't find it.
See kovarex enrichment process. You are need new special recipe category for it.

Example for "assembling-machine-1":

Code: Select all

data.raw["assembling-machine"]["assembling-machine-1"].crafting_categories[2] = "my-recipe-category-one"
data.raw["assembling-machine"]["assembling-machine-1"].crafting_categories[3] = "my-recipe-category-two"
You can't do this recipe by "assembling-machine-2", in "assembling-machine-1" only.
You must define this category:

Code: Select all

data:extend(
{
  {
    type = "recipe-category",
    name = "my-recipe-category-one"
  },
  {
    type = "recipe-category",
    name = "my-recipe-category-two"
  }
})

Re: need a german mod creator

Posted: Sat Sep 02, 2017 11:35 pm
by Arch666Angel
darkfrei wrote:
unfunf22 wrote:Is it possible to determine by mod that certain items can only be produced in assembly machine 3, but only 2 items are needed?
What would I have to write, because unfortunately it is not available in the lua api documentation or I just can't find it.
See kovarex enrichment process. You are need new special recipe category for it.

Example for "assembling-machine-1":

Code: Select all

data.raw["assembling-machine"]["assembling-machine-1"].crafting_categories[2] = "my-recipe-category-one"
data.raw["assembling-machine"]["assembling-machine-1"].crafting_categories[3] = "my-recipe-category-two"
You can't do this recipe by "assembling-machine-2", in "assembling-machine-1" only.
You must define this category:

Code: Select all

data:extend(
{
  {
    type = "recipe-category",
    name = "my-recipe-category-one"
  },
  {
    type = "recipe-category",
    name = "my-recipe-category-two"
  }
})
If you want to add a statement to an existing table and you dont care about it's position it's better and less prone to errors to use the table.insert()

Re: need a german mod creator

Posted: Sun Sep 10, 2017 9:15 pm
by eradicator
(For the sake of readability for other ppl i'll answer in english too.)
Arch666Angel wrote:If you want to add a statement to an existing table and you dont care about it's position it's better and less prone to errors to use the table.insert()
This couldn't be truer. I'd go even further and say you should _never_ use any kind of numeric index (i.e. [1] [2]) access anywhere unless it's a table that is created and soley used by your own mod. If you think you need a numeric index then in 90% of all cases you're doing something wrong (=buggy).

Concerning fuel-usage of items you can look at the wooden power pole:

Code: Select all

  {
    type = "item",
    name = "small-electric-pole",
    icon = "__base__/graphics/icons/small-electric-pole.png",
    flags = {"goes-to-quickbar"},
    subgroup = "energy-pipe-distribution",
    order = "a[energy]-a[small-electric-pole]",
    place_result = "small-electric-pole",
    fuel_category = "chemical",
    fuel_value = "4MJ",
    stack_size = 50
  },
Also i'm not bob so i can't answer for him ofc, but usually it's not "difficult" as such to make a large mod (i.e. there's no super complex math involved or something like that). It just takes very large amounts of time and patience - think: a lot more time than you're going to spend playing the game with those mods.