Stranded: Alien Dawn

Stranded: Alien Dawn

Stranded: Alien Dawn Workshop
Explore other users workshop creations, upload, download and subscribe to new content
0utlaw 2023 年 11 月 29 日 下午 11:58
Change Property Modifier
Can you add two modifiers to a single change property use/call on a preset? For example I want to change the HitNegation and Modify the temperature low/high to a single piece of armor, but when I use Change property I seem to only be given the option of changing one value per use, I cannot seem to find a way to add an additional change without adding a second change property usage.
最后由 0utlaw 编辑于; 2023 年 11 月 29 日 下午 11:59
< >
正在显示第 1 - 8 条,共 8 条留言
Mnementh 21 2023 年 12 月 1 日 上午 1:04 
Hi, Outlaw!

The "Change Property" element is designed to modify a single property.
0utlaw 2023 年 12 月 1 日 上午 7:13 
Thanks for the follow up! Is there anyway to make a batch change? or like a flat file we can open and do a find/replace in like Notepad ++ or something?
Mnementh 21 2023 年 12 月 2 日 上午 10:15 
If you'd rather avoid having many Change Property elements in your mod, you can directly edit the Resources table that stores all the game's resource presets.

An example of that would be the following code:
Resources["Armor_Hat_Carbon"].HitNegation = { PlaceObj('EquipResourceHitNegation', { 'DamageType', "blunt", 'NegationChance', 10, }), PlaceObj('EquipResourceHitNegation', { 'DamageType', "piercing", 'NegationChance', 10, }), } Resources["Armor_Hat_Carbon"].Modifiers = { PlaceObj('ModifyHuman', { add = 10000, prop = "TemperatureHigh", }), PlaceObj('ModifyHuman', { add = -10000, prop = "TemperatureLow", }), }
最后由 Mnementh 编辑于; 2023 年 12 月 2 日 上午 11:04
0utlaw 2023 年 12 月 2 日 上午 11:32 
Very cool, thank you!
Olleus 1 2023 年 12 月 4 日 下午 3:45 
Is there a way to do that via a loop? For example, if I wanted to double the height of all humans, could I do that without having to manually address each individual one by one?
Mnementh 21 2023 年 12 月 4 日 下午 7:03 
Hi Olleus,

The most common approach to doing this would be:
for _, def in ipairs(CharacterDefs) do -- do something end

CharacterDefs is the global table that contains all character definitions in the game. If you want to modify all spawned characters on the map, replace it with UIPlayer.labels.Survivors. The labels are auto-updating tables that hold references to specific objects present on the map.
Olleus 1 2023 年 12 月 5 日 上午 3:03 
Thanks for all your help Mnementh, but I can't get the iteration to work. Even a simple test like
for i, char in ipairs(CharacterDefs) do print(char.id) end
prints out nothing on the console, while
print(CharacterDefs.Jack.id)
works as intended. It's not special to CharacterDefs either, I have the same issue, eg, with Plants.

EDIT: As always, it's asking a question that solved it. Replace 'ipairs' with 'pairs' works fine. There's clearly something about Lua data structures that I'm not getting yet...
最后由 Olleus 编辑于; 2023 年 12 月 5 日 上午 3:09
Mnementh 21 2023 年 12 月 7 日 上午 12:12 
引用自 Olleus
EDIT: As always, it's asking a question that solved it. Replace 'ipairs' with 'pairs' works fine. There's clearly something about Lua data structures that I'm not getting yet...
I probably used the wrong pairing function for the example. Typically, one will work while the other won't. It depends on the structure of the table.
< >
正在显示第 1 - 8 条,共 8 条留言
每页显示数: 1530 50