Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 60 61 [62] 63 64 ... 120

Author Topic: [MODDING] 0.44.x GENERAL MODDING QUESTIONS THREAD - NOW IN ALLCAPS EDITION  (Read 176568 times)

TomiTapio

  • Bay Watcher
  • OldGenesis since 2012
    • View Profile
    • My Flickr animal photos
Re: [MODDING] 0.44.x questions thread
« Reply #915 on: November 25, 2018, 12:50:02 pm »

Hey, about plugin_onupdate, how often is it run? I though it was every game tick, but for some reason it appears to be run even while the game is paused.
*searches*
frame counter and on_interval may be relevant.
here's a code snippet from fix-unit-occupancy: https://github.com/DFHack/dfhack/blob/master/plugins/fix-unit-occupancy.cpp
Code: [Select]
DFhackCExport command_result plugin_onupdate (color_ostream &out)
{
    if (is_enabled && World::isFortressMode() && Maps::IsValid())
    {
        if (world->frame_counter % run_interval == 0 && !World::ReadPauseState())
        {
            fix_unit_occupancy(out);
        }
    }
    return CR_OK;
}
Logged
==OldGenesis mod== by Deon & TomiTapio. Five wood classes, four leather classes. Nine enemy civs. So much fine-tuning.
47.05e release: http://dffd.bay12games.com/who.php?id=1538
OldGenesis screenshots: https://twitter.com/hashtag/OldGenesis?src=hashtag_click&f=image
My Finnish language file: http://dffd.bay12games.com/file.php?id=14884

bloop_bleep

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #916 on: November 25, 2018, 04:18:36 pm »

Sorry, I fixed it already. I thought plugin_onupdate was run every world tick (thus only when the game is unpaused), but I was wrong. I just added a check for pause_state.

About the run-when-building-is-completed thing, I just decided to loop through all the buildings, every 5th tick, and mark off buildings which I had already looked at with a custom flag (though of course any method of doing it without looping through all buildings would still be greatly appreciated!)

However, I also wanted to run a certain function whenever a construction was created from a building_constructionst that has a certain other custom flag set. I can’t hook df::construction’s constructor OR df::building_constructionst’s destructor, because C++ for some mysterious reason prohibits taking the address of either. Any workaround would be appreciated.
« Last Edit: November 25, 2018, 04:24:42 pm by bloop_bleep »
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

Hetsin

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #917 on: November 27, 2018, 05:46:38 pm »

I've made a generic creature variation that applies a dental formula to creatures (I really wanted accurate-ish teeth counts). Some creatures don't have certain teeth, for example cattle don't have upper incisors or canines, so when I defined that body detail I left it blank and continued to the next one, as such:

Code: [Select]
[BODY:TEETH_0UI]

[BODY:TEETH_1UI]
[BP:TOOTHUI1:first upper right incisor:STP][CON:SKULL][CATEGORY:TOOTH][SOCKET][SMALL][EMBEDDED][INTERNAL]
[DEFAULT_RELSIZE:1]
[BP:TOOTHUI2:first upper left incisor:STP][CON:SKULL][CATEGORY:TOOTH][SOCKET][SMALL][EMBEDDED][INTERNAL]
[DEFAULT_RELSIZE:1]

...

The variation works, except for those 0 counts where I'm getting an error:

Code: [Select]
COW:Body Token Recognized But Could Not Connect: TEETH_0UI
Is there a more elegant way to create a blank body token, so it doesn't throw an error?

Apologies if this isn't the right thread.
Logged

YomToxic

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #918 on: December 01, 2018, 01:52:52 am »

Code: [Select]
Color Mod Ending With (WHITE,1) Was Not Used
How do I avoid getting this error?
Logged

Eric Blank

  • Bay Watcher
  • *Remain calm*
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #919 on: December 01, 2018, 07:51:45 pm »

Check that, in whichever color mod that refers to, youve selected the correct body part and material, and that the body part and material themselves is implemented correctly. If theres a typo or the body part or any of its materials or tissues didnt initialize properly, then the game cant apply color to it correctly either.
Logged
I make Spellcrafts!
I have no idea where anything is. I have no idea what anything does. This is not merely a madhouse designed by a madman, but a madhouse designed by many madmen, each with an intense hatred for the previous madman's unique flavour of madness.

Dunmeris

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #920 on: December 01, 2018, 10:47:23 pm »

I'm adding kermes flies, and likewise kermes dye. Will generated civs actually use dye made from a creature (or rather, a vermin if we're being technical)?
Logged

Eric Blank

  • Bay Watcher
  • *Remain calm*
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #921 on: December 02, 2018, 04:50:02 pm »

They should if its available in a nearby biome, yeah. Theyll bring honeybee venom and stuff without domesticating bees.
Logged
I make Spellcrafts!
I have no idea where anything is. I have no idea what anything does. This is not merely a madhouse designed by a madman, but a madhouse designed by many madmen, each with an intense hatred for the previous madman's unique flavour of madness.

Dunmeris

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #922 on: December 02, 2018, 09:52:19 pm »

Thanks!

Is there a way to restrict reactions to certain castes? I can try to do it with DFHack if that's necessary.
Logged

TheRedwolf

  • Bay Watcher
  • Pagan Desert Bitch (she/they)
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #923 on: December 03, 2018, 09:37:29 am »

Is how do you create a new creature class? I am currently working on a The Elder Scrolls mod, and would like to have mechanical creatures in dwemer ruins.
Logged

thefriendlyhacker

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #924 on: December 03, 2018, 10:43:31 am »

By creature class, you mean things like GENERAL_POISON, right?  You just declare a creature class in each mechanical creature's raws (something like [CREATURE_CLASS:DWEMER_MECH]).  Nothing special is needed beyond that.

EDIT:
Is there a way to restrict reactions to certain castes? I can try to do it with DFHack if that's necessary.
tldr - it isn't possible in a nice way.

The only thing that can come close to what you want is writing a dfhack script, and the options there aren't pretty.  You would have to do thing something like run the script when the reaction happens and either create the products and/or manually reverse the reaction as appropriate to the worker's caste.  Alternatively, you could scan through the jobs your creatures have and cancel them if they are inappropriate for that creature's caste.  Both of these approaches technically work, but they aren't so much restricting creatures from a reaction as much as they are effectively preventing them from carrying the reaction out.  Not to mention that it will be decidedly non-trivial to code up the scripts, and it will be micro-management intensive from the point of view of the player.
« Last Edit: December 03, 2018, 10:56:22 am by thefriendlyhacker »
Logged
Fallout Equestria Redux - that's right, it's back

Klisz

  • Bay Watcher
  • Dabbling Modder
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #925 on: December 03, 2018, 06:18:13 pm »

Thanks!

Is there a way to restrict reactions to certain castes? I can try to do it with DFHack if that's necessary.

Although outright restrictions are difficult at best as explained by thefriendlyhacker, you could give the caste a low SKILL_LEARN_RATE and a high SKILL_RUST_RATE for the relevant skill so that members of the caste never get good at the reaction, and Dwarf Therapist and similar programs will thus rarely assign the relevant labor.
Logged

Dunmeris

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #926 on: December 04, 2018, 07:48:52 am »

I see...
Logged

bloop_bleep

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #927 on: December 04, 2018, 07:20:25 pm »

Alternatively, if all the reactions within a specific building are made to be available to the same set of castes, you could add restrictions to the buildings so that only certain units are allowed to work there (through DFHack.)
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

Dunmeris

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #928 on: December 04, 2018, 07:48:11 pm »

That would be perfect actually.
Logged

bloop_bleep

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.44.x questions thread
« Reply #929 on: December 04, 2018, 08:41:28 pm »

There is a job_claim_suppress member variable in df::building. I haven’t done much with it, but it is probably possible to mess around with it.
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.
Pages: 1 ... 60 61 [62] 63 64 ... 120