Hi
First Question:I've made an assembling machine type entity with idle_animation and animations both have the same animation count and everything
but when the entity start working it disappears, any idea why?
Second Question :I was trying to make starting items for the players,but that worked only in map editing mode,so how to make it affects any mode?
Third Question:This out of curiosity more than actual question ;i'm planning to add brand new belts and enemies,but i've not seen many mods that do that
it just re-tinting them,why is that?
Seeking recommendations from those who made mods :what is the best way to optimize mod structure(if that affects loading),is there something i should add in mod folder to ease mod compatibility?
Thanks in Advance.
Couple of Questions And Seeking Recommendations
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Couple of Questions And Seeking Recommendations
1. Post your code. Don't make people guess what you've done.
2. See viewtopic.php?p=531991#p531991 .
3. Making new sprites and animations from scratch is time-consuming even if you have any talent for it; with belts and units ("enemies"), you picked two of the most difficult entities in the game. Belts are incredibly unforgiving and have a bizarrely distorted perspective compared to almost everything else. Units ideally would have several different animations for different states (moving, idling, attacking etc.) so you'd need to be good with rigging as well as design. You could easily spend a week on the former and more on the latter if you wanted.
4. I don't fully understand your last request but I think the answer is "no".
2. See viewtopic.php?p=531991#p531991 .
3. Making new sprites and animations from scratch is time-consuming even if you have any talent for it; with belts and units ("enemies"), you picked two of the most difficult entities in the game. Belts are incredibly unforgiving and have a bizarrely distorted perspective compared to almost everything else. Units ideally would have several different animations for different states (moving, idling, attacking etc.) so you'd need to be good with rigging as well as design. You could easily spend a week on the former and more on the latter if you wanted.
4. I don't fully understand your last request but I think the answer is "no".
Re: Couple of Questions And Seeking Recommendations
So i put that code in the control.lua and now there's no items at all in other mode than map editing modeDeadlock989 wrote: ↑Wed Apr 21, 2021 10:39 pm1. Post your code. Don't make people guess what you've done.
2. See viewtopic.php?p=531991#p531991 .
3. Making new sprites and animations from scratch is time-consuming even if you have any talent for it; with belts and units ("enemies"), you picked two of the most difficult entities in the game. Belts are incredibly unforgiving and have a bizarrely distorted perspective compared to almost everything else. Units ideally would have several different animations for different states (moving, idling, attacking etc.) so you'd need to be good with rigging as well as design. You could easily spend a week on the former and more on the latter if you wanted.
4. I don't fully understand your last request but I think the answer is "no".
Code: Select all
script.on_init(onModInit)
function initPlayer(player)
if player.character == nil then return end
if global == nil then
global = {}
end
if global.donePlayers == nil then
global.donePlayers = {}
end
if global.donePlayers[player] ~= nil then return end
global.donePlayers[player] = true
player.get_inventory(defines.inventory.character_main).clear()
player.get_inventory(defines.inventory.character_armor).clear()
player.get_inventory(defines.inventory.character_guns).clear()
player.get_inventory(defines.inventory.character_ammo).clear()
local items = {
{"item", 1},
{"item", 1},
{"item", 1},
{"item", 1},
{"item", 1},
}
for _, v in pairs(items) do
player.insert{name = v[1], count = v[2]}
end
end
function onPlayerJoined(event)
local player = game.players[event.player_index]
initPlayer(player)
end
script.on_event({defines.events.on_player_joined_game, defines.events.on_player_created}, onPlayerJoined)
function onModInit()
if remote.interfaces["freeplay"] then
remote.call("freeplay", "set_skip_intro", false)
remote.call("freeplay", "set_disable_crashsite", false)
remote.call("freeplay", "set_respawn_items", {"item", 1,"item", 1,"item", 1,"item", 1,"item", 1})
remote.call("freeplay", "set_created_items", {"item", 1,"item", 1,"item", 1,"item", 1,"item", 1})
end
--for _, v in pairs(items) do
--player.insert{name = v[1], count = v[2]}
--end
end
script.on_init(onModInit)
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Couple of Questions And Seeking Recommendations
Follow the link I gave and then scroll down a few posts to jamiechi1's answer. The table of items is given as key/value pairs where the key is the item name and the value is the number of items to be given, e.g.
Code: Select all
{
["iron-plate"] = 100,
["copper-plate"] = 200,
}
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Couple of Questions And Seeking Recommendations
My tutorial also talks about the freeplay starting items interface. If you use set_* without get_* you overwrite items added by other 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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Couple of Questions And Seeking Recommendations
i've used another code and it worked in every mode ,but apparently there's no console command to remove a starting item from the player?https://wiki.factorio.com/Console because now i have vanilla items in additional of custom items and using thisDeadlock989 wrote: ↑Thu Apr 22, 2021 10:12 amFollow the link I gave and then scroll down a few posts to jamiechi1's answer. The table of items is given as key/value pairs where the key is the item name and the value is the number of items to be given, e.g.
Code: Select all
{ ["iron-plate"] = 100, ["copper-plate"] = 200, }
Code: Select all
player.get_inventory(defines.inventory.character_ammo).clear()
Re: Couple of Questions And Seeking Recommendations
Ok problem solved ; for anyone who wants to code this the "noobish" way here's the code:
Code: Select all
script.on_init(function()
if not remote.interfaces["freeplay"] then return end
local created_items = remote.call("freeplay", "get_created_items")
created_items["item"] = 1 --to add it as starting item
created_items["burner-mining-drill"] = nil--remove vanilla items like this
created_items["pistol"] = nil
created_items["firearm-magazine"] = nil
created_items["stone-furnace"] = nil
created_items["wood"] = nil
created_items["iron-plate"] = nil
remote.call("freeplay", "set_created_items", created_items)
end)