Bay 12 Games Forum

Dwarf Fortress => DF Modding => Topic started by: rico6822 on June 29, 2021, 02:33:19 am

Title: Two Tokens Fighting Eachother
Post by: rico6822 on June 29, 2021, 02:33:19 am
I'm planning to add 2 tokens about CLUSTER_NUMBER into a single creature variation. I'm using this for my randomizer mod, where CV_REMOVE_TAG:CLUSTER:NUMBER is above CV_ADD_TAG:CLUSTER:NUMBER:1:5.

Would that generate error or remove already present CLUSTER_NUMBER and replace it with random amount of spawned creatures from 1 to 5? Does Dwarf Fortress apply all tags at once or goes from above to below, making tags below override same but with different values tags as above?
Title: Re: Two Tokens Fighting Eachother
Post by: Putnam on June 29, 2021, 03:18:06 am
It goes from top to bottom. This is why there are [GO_TO_END], [GO_TO_START] and [GO_TO_TAG:tag] tokens.
Title: Re: Two Tokens Fighting Eachother
Post by: rico6822 on June 29, 2021, 03:52:51 am
It goes from top to bottom. This is why there are [GO_TO_END], [GO_TO_START] and [GO_TO_TAG:tag] tokens.

Ok. So [GO_TO_END] makes it so it's read from bottom to top at some point?
Title: Re: Two Tokens Fighting Eachother
Post by: Putnam on June 29, 2021, 04:24:43 am
No, it just puts all the following tokens at the very end of the current creature definition.
Title: Re: Two Tokens Fighting Eachother
Post by: rico6822 on July 01, 2021, 09:13:41 pm
No, it just puts all the following tokens at the very end of the current creature definition.

Holy crap, you helped me a lot. You are going to be in credits of my randomizer. Now I know why everyone spawns so rarely.

I will slightly have to do everything over again.
Title: Re: Two Tokens Fighting Eachother
Post by: rico6822 on July 01, 2021, 09:37:20 pm
No, it just puts all the following tokens at the very end of the current creature definition.

Nevermind, it did not broke anything but simply made my coding look less professional and just amateurish. You saved me from embarrasment.

I used to insert at the very end [GO_TO_END], than a creature variation and after a creature variation [GO_TO_START].
Title: Re: Two Tokens Fighting Eachother
Post by: Quietust on July 01, 2021, 10:36:47 pm
If you want to see what the "composite" raws for a creature variant actually look like, the following DFHack script should work:

Code: [Select]
lua "for _,c in pairs(df.global.world.raws.creatures.all) do if (c.creature_id=='CREATURE_ID_GOES_HERE') then for _,r in pairs(c.raws) do print(r.value) end end end"
Just replace CREATURE_ID_GOES_HERE with your desired creature ID, then copy/paste the entire line into the DFHack console and press Enter.
Unfortunately, the output won't have any indentation, so it might be a bit difficult to read.
Title: Re: Two Tokens Fighting Eachother
Post by: rico6822 on July 02, 2021, 01:00:31 am
If you want to see what the "composite" raws for a creature variant actually look like, the following DFHack script should work:

Code: [Select]
lua "for _,c in pairs(df.global.world.raws.creatures.all) do if (c.creature_id=='CREATURE_ID_GOES_HERE') then for _,r in pairs(c.raws) do print(r.value) end end end"
Just replace CREATURE_ID_GOES_HERE with your desired creature ID, then copy/paste the entire line into the DFHack console and press Enter.
Unfortunately, the output won't have any indentation, so it might be a bit difficult to read.

Holy crap! Thank you but wouldn't it mean that every time a new world is created the player would have to apply randomization to all generated creatures?
Title: Re: Two Tokens Fighting Eachother
Post by: Quietust on July 03, 2021, 06:58:24 am
If you want to see what the "composite" raws for a creature variant actually look like, the following DFHack script should work:

Code: [Select]
lua "for _,c in pairs(df.global.world.raws.creatures.all) do if (c.creature_id=='CREATURE_ID_GOES_HERE') then for _,r in pairs(c.raws) do print(r.value) end end end"
Just replace CREATURE_ID_GOES_HERE with your desired creature ID, then copy/paste the entire line into the DFHack console and press Enter.
Unfortunately, the output won't have any indentation, so it might be a bit difficult to read.

Holy crap! Thank you but wouldn't it mean that every time a new world is created the player would have to apply randomization to all generated creatures?
Er, I'm not sure I follow - I was just providing you with a means of visualizing the actual effect of "CV_ADD_TAG:CLUSTER:NUMBER:1:5".
Title: Re: Two Tokens Fighting Eachother
Post by: rico6822 on July 03, 2021, 01:44:35 pm
If you want to see what the "composite" raws for a creature variant actually look like, the following DFHack script should work:

Code: [Select]
lua "for _,c in pairs(df.global.world.raws.creatures.all) do if (c.creature_id=='CREATURE_ID_GOES_HERE') then for _,r in pairs(c.raws) do print(r.value) end end end"
Just replace CREATURE_ID_GOES_HERE with your desired creature ID, then copy/paste the entire line into the DFHack console and press Enter.
Unfortunately, the output won't have any indentation, so it might be a bit difficult to read.

Holy crap! Thank you but wouldn't it mean that every time a new world is created the player would have to apply randomization to all generated creatures?
Er, I'm not sure I follow - I was just providing you with a means of visualizing the actual effect of "CV_ADD_TAG:CLUSTER:NUMBER:1:5".

Ok.