[MOD 1.0] Alien walls [0.9.5]
Re: [WIP] Alien walls [0.1.2]
Rather than stating expressly in the control what the max health is, can't we get that from the entity? Basically do something like if HP < Max_Health then
Would that be able to handle entities with different max health?
Would that be able to handle entities with different max health?
Re: [WIP] Alien walls [0.1.2]
I dont think so, only health seems to be in the prototypevedrit wrote:Rather than stating expressly in the control what the max health is, can't we get that from the entity? Basically do something like if HP < Max_Health then
Would that be able to handle entities with different max health?
Re: [WIP] Alien walls [0.1.2]
Hmm...that seems rather silly... But I tested my theory in-game and got an error, so you're probably right.
Is there a way to put in descriptions for tech? I see we can get away with not having any effects for the tech, but other than being able to create our own effect to be listed (I don't see any mention of that being possible) I can't find a way to describe what the tech does.
Is there a way to put in descriptions for tech? I see we can get away with not having any effects for the tech, but other than being able to create our own effect to be listed (I don't see any mention of that being possible) I can't find a way to describe what the tech does.
Re: [WIP] Alien walls [0.1.2]
Klonan, the script you posted for having research increase regen rate doesn't seem to work. It's like the research event isn't triggering or changing anything.
Re: [WIP] Alien walls [0.1.2]
Quite possibly due to this:vedrit wrote:Klonan, the script you posted for having research increase regen rate doesn't seem to work. It's like the research event isn't triggering or changing anything.
Code: Select all
if HP < 1750 then
-- Should be: HP = HP + glob.monsterregen
HP = HP + glob.regenrate --Hp per second determined by global value
monsterwall.health = HP
end
Another issue, I added the second line:
Code: Select all
game.onevent(defines.events.onresearchfinished, function(event) --when research is finished
local research = event.research -- Added this line.
if research == "monster-wall-upgrade" then
Code: Select all
game.entityprototypes["monsterwall"].maxhealth
My mods: Red Alert Harvesters - Clean Pipes - Filtered Splitters
Re: [WIP] Alien walls [0.1.2]
Haha my bad, thats what i get for changing the entity code as i was posting it. Thanks for fixing it upThis is the only place where glob.regenrate is referenced. The rest is glob.monsterregen.
Re: [WIP] Alien walls [0.1.2]
I had fixed within my script, but I think it's because research wasn't pulling the research name from the event. I have a feeling that the script you put up, Pear, will fix it.ThaPear wrote:This is the only place where glob.regenrate is referenced. The rest is glob.monsterregen.
I saw that maxhealth property before, I just wasn't using it correctly apparently. Too bad it's a read only value
Re: [WIP] Alien walls [0.1.4]
Thanks again for the help guys. Is there a way to read a variable stored in another lua file?
Re: [WIP] Alien walls [0.1.4]
vedrit wrote:Thanks again for the help guys. Is there a way to read a variable stored in another lua file?
I think if you require in a lua file you can call values from it.
Also i notices in the control.lua for 0.1.4 you have 2 different values for the regen for robot built and player built
Code: Select all
game.onevent(defines.events.onrobotbuiltentity , function(event)
if event.createdentity.name == "hybrid-wall" then
if glob.alienwall == nil then
glob.alienwall = {}
end
local alienwall = event.createdentity
table.insert(glob.alienwall, alienwall)
elseif event.createdentity.name == "hybrid-gate" then
if glob.alienwall == nil then
glob.alienwall = {}
end
local alienwall = event.createdentity
table.insert(glob.alienwall, alienwall)
end
if glob.alienregen == nil then
if glob.alienregen == 0 then
glob.alienregen = 5
end
end
end)
game.onevent(defines.events.onbuiltentity, function(event)
if event.createdentity.name == "hybrid-wall" then
if glob.alienwall == nil then
glob.alienwall = {}
end
local alienwall = event.createdentity
table.insert(glob.alienwall, alienwall)
elseif event.createdentity.name == "hybrid-gate" then
if glob.alienwall == nil then
glob.alienwall = {}
end
local alienwall = event.createdentity
table.insert(glob.alienwall, alienwall)
end
if glob.alienregen == nil then
if glob.alienregen == 0 then
glob.alienregen = 1
end
end
end)
Re: [WIP] Alien walls [0.1.4]
I just browsed through the current version and it'd be a lot neater if instead of checking for the existence of certain variables on each event you simply ensure they're there in your oninit() function.
This allows you to simplify the onbuiltentity to:
Instead of the 19 lines it is currently.
It would even allow you to do away with a lot of duplicate code, by using the same function for player and robot placement:
Code: Select all
function init() --Initialises the global value
if glob.alienwall == nil then
glob.alienwall = {}
end
if glob.alienregen == nil or glob.alienregen == 0 then
glob.alienregen = 1
end
end
Code: Select all
game.onevent(defines.events.onbuiltentity, function(event)
if event.createdentity.name == "hybrid-wall" or event.createdentity.name == "hybrid-gate" then
local alienwall = event.createdentity
table.insert(glob.alienwall, alienwall)
end
end)
It would even allow you to do away with a lot of duplicate code, by using the same function for player and robot placement:
Code: Select all
game.onevent(defines.events.onrobotbuiltentity, function(event) onbuilt(event.createdentity) end)
game.onevent(defines.events.onbuiltentity, function(event) onbuilt(event.createdentity) end)
function onbuilt(entity)
if entity.name == "hybrid-wall" or entity.name == "hybrid-gate" then
local alienwall = event.createdentity
table.insert(glob.alienwall, alienwall)
end
end
My mods: Red Alert Harvesters - Clean Pipes - Filtered Splitters
Re: [WIP] Alien walls [0.1.4]
There is a fair bit of redundant code, mostly because I was having issues getting certain parts of the code working. I had included checking for the variables in the createdetevent because sometimes I'd get a nil value in arithmetic when the wall or gate gets damaged. Just wanted to make sure the game had a variable when starting regen.
Re: [WIP] Alien walls [0.1.4]
Indeed you are right with the checking codevedrit wrote:There is a fair bit of redundant code, mostly because I was having issues getting certain parts of the code working. I had included checking for the variables in the createdetevent because sometimes I'd get a nil value in arithmetic when the wall or gate gets damaged. Just wanted to make sure the game had a variable when starting regen.
I do to some degree have the same problem with my Pneumatic Transporter mod, though i've as of writing this, finished all of the functions(except power usage) and the code is totalling at 466 lines! :O!
But i'm sure il get that number down soon, and so i'm sure you can too !
Logo
Noticed the told change in FFF #111 so il continue to use my signature ^_^Thanks for listening to our suggestions, devs !
I would jump of joy if we could specify which tiles spawned in a surfaces
Re: [WIP] Alien walls [0.1.4]
I've cut out some of the redundant coding, and I can get my entities max HP to read from my variable file, but I can't seem to get my control file to write to variable file to change the max HP. Or is the game unable to change max hp after the entity file has been loaded?
Re: [WIP] Alien walls [0.1.4]
You cannot alter entity prototypes after the game's startup. You'd have to replace all wall/gate sections with a new entity.vedrit wrote:I've cut out some of the redundant coding, and I can get my entities max HP to read from my variable file, but I can't seem to get my control file to write to variable file to change the max HP. Or is the game unable to change max hp after the entity file has been loaded?
My mods: Red Alert Harvesters - Clean Pipes - Filtered Splitters
Re: [WIP] Alien walls [0.1.5]
sounds interesting - I might try it soon.
Will you continue to develop it in version 0.12 ?
Will you continue to develop it in version 0.12 ?
Re: [WIP] Alien walls [0.1.5]
I will, though as it is it is currently an add-on to another mod, as mentioned. If something in the new release causes the mod to break and the author doesn't fix it, then I might look into making this a stand-alone.jockeril wrote:sounds interesting - I might try it soon.
Will you continue to develop it in version 0.12 ?
Also, to note, the Alien Walls folder is still named 0.1.4, though the version is 0.1.5. I'm out of town and not feeling like correcting it :p
Re: [WIP] [0.12.0] Alien walls [0.2.0]
After creating an unofficial patch to the parent mod, I was able to test Alien Walls in Factorio 0.12.0. I fixed a few issues, and it now works.
Re: [WIP] [0.12.0] Alien walls [0.2.1]
Topic moved to Mods for 0.12 ‹ New Items, Entities, Extensions (0.12)
Koub - Please consider English is not my native language.
-
- Manual Inserter
- Posts: 2
- Joined: Fri Jul 24, 2015 12:57 am
- Contact:
Re: [WIP] [0.12.0] Alien walls [0.2.1]
Bringin this over from the shadow pack thread
Error while running the event handler: __AlienWall__/control.lua:19: attempt to index field 'create_dentity' (a nil valUe)
Appears when getting construction robots to place a blueprint (blueprint is a pair of assembler mk 2s, a passive provider chest, a requester chest, a medium electric pole, and 4 smart inserters), as soon as the first assembler is placed it gives me that error and crashes to desktop
Line 19 should read:instead of:Code: Select all
if event.created_entity.name == "hybrid-wall" or event.created_entity.name == "hybrid-gate" then
had to move the d aroundCode: Select all
if event.created_entity.name == "hybrid-wall" or event.create_dentity.name == "hybrid-gate" then