need a german mod creator

Place to get help with not working mods / modding interface.
User avatar
unfunf22
Inserter
Inserter
Posts: 31
Joined: Fri May 20, 2016 9:00 pm
Contact:

need a german mod creator

Post 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

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: need a german mod creator

Post by darkfrei »

Ich kann dir etwas helfen.

User avatar
unfunf22
Inserter
Inserter
Posts: 31
Joined: Fri May 20, 2016 9:00 pm
Contact:

Re: need a german mod creator

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

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: need a german mod creator

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

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: need a german mod creator

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

User avatar
unfunf22
Inserter
Inserter
Posts: 31
Joined: Fri May 20, 2016 9:00 pm
Contact:

Re: need a german mod creator

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

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: need a german mod creator

Post 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"
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: need a german mod creator

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

User avatar
unfunf22
Inserter
Inserter
Posts: 31
Joined: Fri May 20, 2016 9:00 pm
Contact:

Re: need a german mod creator

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

User avatar
unfunf22
Inserter
Inserter
Posts: 31
Joined: Fri May 20, 2016 9:00 pm
Contact:

Re: need a german mod creator

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

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: need a german mod creator

Post 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"
  }
})

User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: need a german mod creator

Post 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()

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: need a german mod creator

Post 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.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Modding help”