Need help to understand the hierarchy of variables

Place to get help with not working mods / modding interface.
bl4st
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Sep 06, 2021 7:52 pm
Contact:

Need help to understand the hierarchy of variables

Post by bl4st »

Hi, i am trying to make a very simple thing : increase the range of the personal laser defense module but after some research and many attempts i am very confused, i must be missing something very important.

I did something very simple and expected it to be enough :

Code: Select all

data.raw["active-defense-equipment"]["personal-laser-defense-equipment"].attack_parameters.range = 50
This increased the range value in the UI, my personal laser defense equipment is properly targeting enemies at a range of 50 but they are not taking any damage unless they are in the vanilla range of 15. So i looked at values of 15 that didn't change by using ctrl-shift-F on the item ingame and i found what i saw very confusing.

Capture.PNG
Capture.PNG (174.51 KiB) Viewed 979 times

I guessed it's probably this "max_length" value from the "beam" property of the "actions" thingy from the "ammo_type" stuff belonging to "attack_parameters" 🤡. But didin't find the syntax to access it.

Sorry for seeking help on what seems to be such an easy thing but it's driving me mad ^^'

Thank you for your time and have a nice day !
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 586
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: Need help to understand the hierarchy of variables

Post by Silari »

You modify it pretty much the same way as the range on the equipment.

Code: Select all

data.raw["active-defense-equipment"]["personal-laser-defense-equipment"].attack_parameters.ammo_type.action.action_delivery.max_length = 50
should do it. Note that it's pretty much exactly what it shows in the prototype browser, except that it's 'action' instead of 'result'.

Somewhere on the wiki in the modding tutorials is a link to data.raw, which is a dump of all the prototypes in the base game as they exist during the data stage. It's really handy to look through to see how they're laid out. See this example which shows the needed steps to get the the max_length property for defense equipment:
dataraw.jpg
dataraw.jpg (75.47 KiB) Viewed 966 times
Between that and the prototype listings on the wiki you've found before it's usually easy enough to cross-reference things and figure out what you need to modify.
bl4st
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Sep 06, 2021 7:52 pm
Contact:

Re: Need help to understand the hierarchy of variables

Post by bl4st »

Thank you very much ! i was actually closer than i thought, those "result" and "actions" instead of "action" were very missleading.

I searched on https://wiki.factorio.com/Data.raw but i found it very tedious to go from links to links. There is all the information you can dream of about everything but it's spread in many directions and it can be a bit overwhelming when you are just getting started.

For anyone else struggling like me, this helped a lot and i wish i found it sooner : https://jackhugh.github.io/factorio-dat ... isualiser/

If there is a better one i missed, let me know !
Post Reply

Return to “Modding help”