custom prototype?
custom prototype?
its possible to make a own prototype? i dont mean verious of existing, i mean a complete new type like errr you know something dont like to place my idea here.
so there is no base prototype in the game that i can use it for so i have to make a own but dont know if its possible or how i can do it
so there is no base prototype in the game that i can use it for so i have to make a own but dont know if its possible or how i can do it
Mining Drill Operator
Re: custom prototype?
No it is not possible to create a completely new prototype because they are all coded in C++, the best that can be done is use the control.lua and whatever prototype(s) is most like what you need..
Re: custom prototype?
ok *sniff*
then its not possible to make different types of robots and i can foget my idea with a roverport,
i testet so much things and nothing works... no electric fence becouse its not possible to add energy source to walls, no spotlight lamp becouse lamps arent rotatable ... etc etc etc
then its not possible to make different types of robots and i can foget my idea with a roverport,
i testet so much things and nothing works... no electric fence becouse its not possible to add energy source to walls, no spotlight lamp becouse lamps arent rotatable ... etc etc etc
Mining Drill Operator
Re: custom prototype?
Not sure what you mean by 'roverport' but if you mean one that moves you can use a control.lua script to teleport a regular roboport around, and if you want it to move smoother then you could use an invisible unit type since it can be given commands (like gotolocation) and teleport the roboport to the unit's position as it moves.
for electric fences you could use an invisible entity that requires power and use the control.lua to spawn in the proper wall depending on if that invisible entity has power (a wall with an electric damage when it does have power, and one without the electric damage when it's out of power), or make the electric entity visible and use invisible walls (with a slightly larger collision box so they get hit before the electric entity does)... no idea for the spotlight though, sorry, but as you can see there are several ways to do things, it's just not as easy as if creating custom types were possible, so it depends on you really being willing to do the work of figuring out how it's possible
for electric fences you could use an invisible entity that requires power and use the control.lua to spawn in the proper wall depending on if that invisible entity has power (a wall with an electric damage when it does have power, and one without the electric damage when it's out of power), or make the electric entity visible and use invisible walls (with a slightly larger collision box so they get hit before the electric entity does)... no idea for the spotlight though, sorry, but as you can see there are several ways to do things, it's just not as easy as if creating custom types were possible, so it depends on you really being willing to do the work of figuring out how it's possible

Re: custom prototype?
interesting, diddnt know that that works, i will seek a control.lua tutorial and test things
Mining Drill Operator
Re: custom prototype?
I've got a fairly basic one on the wiki here (though it's really not that good lol), for the most part though control scripting is looking at the properties/methods available to different 'objects' (game, game.player, entities, etc.) on the wiki here and the events that allow you to know when to do things here. Oh, and knowing lua obviously, the first edition of the Programming in Lua book can be found online here. One thing that isn't obvious when first starting is that data that is not stored in the glob table will not be saved/loaded with save games.Shaymes wrote:i will seek a control.lua tutorial and test things
Other than that, I and others have posted several code snippets here in the modding help subforum in response to questions so you can look at those (and of course look at the control.lua code other mods are using), and if you have any specific questions feel free to make another post asking

<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me
Or drop into #factorio on irc.esper.net
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me

Or drop into #factorio on irc.esper.net
Re: custom prototype?
Sorry about that, I've no real experience at writing tutorials and to be honest when I originally wrote it I didn't fully understand too much lol. I should probably try to create a proper control tutorial, but I'm not sure how to go about making one that covers the majority of what's needed without making it too bloated or specific...Shaymes wrote:i read your tutrial weeks ago but err not ery helpfull
-
- Filter Inserter
- Posts: 402
- Joined: Fri May 23, 2014 8:54 am
- Contact:
Re: custom prototype?
You just need to use your imagination
Use a turret not a wall. give it an projectile distance of 1, make it look like a wall.Shaymes wrote:no electric fence
But players are. You can use a new player instead of a light and set its rotation.Shaymes wrote:no spotlight lamp becouse lamps arent rotatable
There are a lot of very good lua tutorials out there already so linking to them and maybe a page discussing the workarounds to common issues. A lot of us have probably come up with the same solutions to problems, we really should document them in the wiki. Also, there was a utilities library that popped up, probably worth getting a few heads together and updating it to include the most commonly used invisible entities.FreeER wrote:I should probably try to create a proper control tutorial, but I'm not sure how to go about making one that covers the majority of what's needed without making it too bloated or specific...
Re: custom prototype?
Hm, I didn't even think of using a turret, because I know that walls can have an 'attack reaction' (the base game even has an example commented out) that would more closely resemble how an electric fence works than a turret firing a projectile (while if the projectile was invisible the player wouldn't see much difference, the wall prototype 'obviously' approximates the desired effect better imo)JamesOFarrell wrote:Use a turret not a wall. give it an projectile distance of 1, make it look like a wall.Shaymes wrote:no electric fence
Oh! that would workYou can use a new player instead of a light and set its rotation.

Possible, but I'd want to (try to) show people without programming experience how to get started with modding factorio rather than just saying 'go learn lua and figure out the basics yourself' using these other guides that are greatThere are a lot of very good lua tutorials out there already so linking to them

Sounds like a good ideaA lot of us have probably come up with the same solutions to problems, we really should document them in the wiki.
? I don't suppose you mean the Mo Logic Core by Ludsoe...if so I really don't know much about it. (edit: just took a quick look and there's probably a couple things I'd want to change if I was using it...of course: "your free to use this withen your mods aslong as you dont modify the code" lol) Of course if you meant something else then point me to it so I knowAlso, there was a utilities library that popped up, probably worth getting a few heads together and updating it to include the most commonly used invisible entities.

Re: custom prototype?
a turret can realy work as electric fence, very smart 
i testet yesturday a little bit, but i dont find a way errr how i can merge 2 prototypes, i need the placable turret, but the feature of wall becouse corners up down left right etc.
and thx for all the help here i want to make so many things becouse factorio is the 2snd in my top 10 of cool games

i testet yesturday a little bit, but i dont find a way errr how i can merge 2 prototypes, i need the placable turret, but the feature of wall becouse corners up down left right etc.
and thx for all the help here i want to make so many things becouse factorio is the 2snd in my top 10 of cool games

Mining Drill Operator
Re: custom prototype?
That's because it's not possibleShaymes wrote:i dont find a way errr how i can merge 2 prototypes

something like this
Code: Select all
require "defines"
-- pass an anonymous (unnamed) function to the game.oninit function which is run when the mod is first loaded
game.oninit(function()
glob.walls = {} -- setup a table named walls within the glob table
end)
-- pass an anonymous (unnamed) function to the game.onload function which is run when a save with the mod is loaded
game.onload(function()
-- when a save is loaded make sure the walls table exists, if it doesn't then create it (mostly a safety check here)
if not glob.walls then glob.walls = {}
end)
-- call game.onevent, tell it we want to do something when an entity is built, and give another anonymous function that will contain the code to actually do stuff
game.onevent(defines.events.onbuiltentity, function(event)
if event.createdentity.name == "the-wall" then -- if the entity that the player built was a wall
-- insert into glob.walls, a table with a 'key' of wall that is the wall entity, and a key of turret that is a new turret entity at the same position
table.insert(glob.walls, {wall=event.createdentity, turret=game.createentity{name="the-turret", position=event.createdentity.position}})
end
end)
game.onevent(defines.events.ontick, function(event) -- a tick is 60 times per second
-- there's probably no need to check 60 times per second so only check when the tick count is a multiple of 60 (aka once per second)
-- if you are doing alot of different things you can check equality with any number between 0-59, 1 would be a multiple of 60+1 rather than +0
-- which would spread the work over several ticks rather than all of them running on the same tick and theoretically slowing down Factorio
if event.tick % 60 == 0 then
for index, thetable in ipairs(glob.walls) do -- loop through the glob.walls table
-- if the player built wall no longer exists
if not thetable.wall.valid then
-- just a safety check to avoid destroying a turret that was somehow already destroyed (unlikely to happen but...)
if thetable.turret.valid then
thetable.turret.destroy() -- destroy the turret
table.remove(glob.walls, index) -- remove the current table (wall and turret) from the glob.walls table.
end
end
end
end
end)

Re: custom prototype?
pew hard syntax but i think i understand the basics,
i start to desing the wall parts and i tested something that the fence are 'underground connected' with power so that only one point at the fence have to connected to the powergrid and i think it will work, for the turret i think about a new damage-type = electric, dont know if it will be balanced becouse nothing have resist against electric.
i start to desing the wall parts and i tested something that the fence are 'underground connected' with power so that only one point at the fence have to connected to the powergrid and i think it will work, for the turret i think about a new damage-type = electric, dont know if it will be balanced becouse nothing have resist against electric.
Mining Drill Operator
-
- Filter Inserter
- Posts: 402
- Joined: Fri May 23, 2014 8:54 am
- Contact:
Re: custom prototype?
That is useful to know, thanks =)FreeER wrote:I know that walls can have an 'attack reaction' (the base game even has an example commented out)
Fair enough, i guess it is worth doing considering how simple it is to use luaI'd want to (try to) show people without programming experience how to get started with modding factorio .
I think that was the one, i have read a lot of threads and example code recently, it is all starting to get mixed up =) If you can't modify it it is of no use sadly.I don't suppose you mean the Mo Logic Core by Ludsoe...if so I really don't know much about it. (edit: just took a quick look and there's probably a couple things I'd want to change if I was using it...of course: "your free to use this withen your mods aslong as you dont modify the code" lol) Of course if you meant something else then point me to it so I know
Re: custom prototype?
Entirely welcomeJamesOFarrell wrote:That is useful to know, thanks =)

How well I know! Even more so when you're one of the people creating a lot of example codeJamesOFarrell wrote:i have read a lot of threads and example code recently, it is all starting to get mixed up =)

