Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 172 173 [174] 175 176 ... 360

Author Topic: DFHack 0.43.03-r1  (Read 1113423 times)

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2595 on: May 10, 2015, 04:51:08 pm »

[Phil Ken Sebben]Ha ha, accidental helpfulness![/Phil Ken Sebben]
Logged

endlessblaze

  • Bay Watcher
  • likes dragons for their fiery breath
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2596 on: May 10, 2015, 06:33:20 pm »

hey....how would I go about creating a dragon?
Logged
Kids make great meat shields.
I nominate endlessblaze as our chief military executive!

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2597 on: May 10, 2015, 08:09:56 pm »

You mean besides trying the spawnunit script?

Well, when a mommy dragon and a daddy dragon...
Logged

Dynastia

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2598 on: May 11, 2015, 01:38:33 am »

Does anybody know how to add bee colonies to a map with no existing colonies at all?

I've tried spawnitem to spawn in some workers, drones and a queen, but they just flew around a bit and then left.
I've tried region-pops incr but anything I think to try is an 'unknown population token'.

I saw a post by Meph mentioning there's already a script command to add colonies, but I've googled everything I can think of and can't find it.

Anyone got any ideas?
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2599 on: May 11, 2015, 07:23:09 pm »

Hi everyone,

I'm back again with my pesky vermin.  I can't seem to get a regional interaction or even a self-targeting interaction to fire reliably.  The syndrome defined within the interaction shows up on the world syndrome list, so that's not the problem.  I tried to capture the interaction, syndrome-trigger and eventful's onSyndrome (though I'm far from sure I did that last one right).  For whatever reason, neither version of the interaction works (or at least works reliably).

Is there a way to fire a script whenever a creature spawns?  Maybe an undocumented hack of Eventful (there was mention of an EventType table that I couldn't find anywhere)?  I'll just check if it's one of my critters in civ -1, apply my Lua if it is, and do nothing if it isn't.  It's perfectly okay if the event only works on naturally spawning critters, since I can always run additional code if I'm spawning one in a script.

Basically I want any of these that pop up on the map to be immediately friendly to the player's civ (ideally, this method wouldn't assume the player is playing dwarves).  I know this code works when I run it manually:

Code: (tesb_domesticate.txt) [Select]
--modifies a specific unit to make it domesticated (and available for pet adoption)
--[=[
    argument
        <UNIT_ID>    The creature to be domesticated, mandatory

    Made by Dirst for use in The Earth Strikes Back mod
Intended use is to automatically domesticate all new instances of specific species.
TO DO:
Find a method to apply this script to all new members of the target species.
--]=]

args = {...}

local critter = df.unit.find(tonumber(args[1]))

if critter.civ_id == -1 then
if df.global.gamemode == df.game_mode.ADVENTURE then
critter.civ_id = df.global.world.units.active[0].civ_id
else   
critter.civ_id = df.global.ui.civ_id
critter.flags2.resident = false;
critter.flags3.body_temp_in_range = true;
critter.population_id = -1
critter.status.current_soul.unit_id = critter.id

critter.animal.population.region_x = -1
critter.animal.population.region_y = -1
critter.animal.population.unk_28 = -1
critter.animal.population.population_idx = -1
critter.animal.population.depth = -1

critter.counters.soldier_mood_countdown = -1
critter.counters.death_cause = -1

critter.enemy.anon_4 = -1
critter.enemy.anon_5 = -1
critter.enemy.anon_6 = -1
end

critter.flags1.tame = true
critter.training_level = 7

-- Verbose for troubleshooting purposes.

print("Critter (unit# "..args[1]..") has been domesticated.")
else
print("Critter (unit# "..args[1]..") is not wild.")
end

In fact the "k" screen updates immediately when I do this, no need to cursor off and come back like with spawn-unit.  I just can't find a way to make it run automatically.

My dwarves still aren't carrying the little guys around either.  I think the wiki might be outdated on that behavior.  However, interaction stuff didn't work any better when these guys were normal animals.

My last resort is to use Putnam's way of cycling thru every unit every N ticks, and apply the changes to any applicable critters.
« Last Edit: May 11, 2015, 07:24:40 pm by Dirst »
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2600 on: May 12, 2015, 01:50:31 am »

So, this script accomplishes what I wanted, but it inefficiently checks every unit every tick.  As Putnam noted a few pages ago, this kind of thing executes pretty quickly, but I wouldn't want to contribute to an animating biome's FPS problems.

Code: (tame-all.txt) [Select]
-- Automatically tames any wild specimens of a specific species
--[=[
    argument
        <CREATURE_TOKEN>    The creature type to be domesticated, mandatory

    Made by Dirst originally for use in The Earth Strikes Back mod

--]=]

args = {...}

local function findRace(name)
    for k,v in pairs(df.global.world.raws.creatures.all) do
        if v.creature_id==name then
            return k
        end
    end
    qerror("Race:"..name.." not found!")
end

critter = findRace(args[1])

function checkForCritter()
    for k,v in ipairs(df.global.world.units.active) do
if v.race == critter then
if v.civ_id == -1 then
if df.global.gamemode == df.game_mode.ADVENTURE then
v.civ_id = df.global.world.units.active[0].civ_id
else   
v.civ_id = df.global.ui.civ_id
v.flags2.resident = false;
v.flags3.body_temp_in_range = true;
v.population_id = -1
v.status.current_soul.unit_id = v.id

v.animal.population.region_x = -1
v.animal.population.region_y = -1
v.animal.population.unk_28 = -1
v.animal.population.population_idx = -1
v.animal.population.depth = -1

v.counters.soldier_mood_countdown = -1
v.counters.death_cause = -1

v.enemy.anon_4 = -1
v.enemy.anon_5 = -1
v.enemy.anon_6 = -1
end

v.flags1.tame = true
v.training_level = 7
end
end
end
end

require('repeat-util').scheduleEvery('onAction',1,'ticks',checkForCritter)

To use, add the line

tame-all FRIENDLY_CRITTER

to your onload.init file.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Boltgun

  • Bay Watcher
  • [UTTERANCES]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2601 on: May 12, 2015, 08:02:03 am »

Does a self targeting syndrome is captured by syndrome trigger? If so it can be used to work around the regional biome or the spawn.
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.40.24-r3
« Reply #2602 on: May 12, 2015, 08:05:50 am »

I used that before, so yes. It definetly worked in 34.11 with the old dfhack.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2603 on: May 12, 2015, 08:18:03 am »

Boltgun and Meph, I'm pretty sure the problem was the self-targeting interaction rather than catching the syndrome.  I've never had much luck with self-targeting interactions for whatever reason.  What surprised me was that a probability 100 regional interaction didn't appear when it was the only option for that biome.  Interactions just hate me.  At least the Lua code works.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.40.24-r3
« Reply #2604 on: May 12, 2015, 09:55:36 am »

My regional interactions did not show up often either. Instead of self-targetted interactions, you can just give dwarves the interaction that targets these creatures. Make it NOT line-of-sight with a range of 500, and any of these creatures that show up should be targetted by your dwarves. :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2605 on: May 12, 2015, 01:21:47 pm »

Boltgun and Meph, I'm pretty sure the problem was the self-targeting interaction rather than catching the syndrome.  I've never had much luck with self-targeting interactions for whatever reason.  What surprised me was that a probability 100 regional interaction didn't appear when it was the only option for that biome.  Interactions just hate me.  At least the Lua code works.

Can you post your interaction?
Logged

Probe1

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2606 on: May 12, 2015, 09:18:30 pm »

Quote
plant

A tool for creating shrubs, growing, or getting rid of them.

Subcommands:

create:   Create a new shrub/sapling.
grow:   Make saplings grow into trees.
extirpate:   Kills trees and shrubs, turning them into ashes instantly.
immolate:   Similar to extirpate, but sets the plants on fire instead. The fires can and will spread ;)

Is plant extirpate and plant immolate depreciated?  I cannot figure out how to use it.
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2607 on: May 12, 2015, 09:30:30 pm »

I never did have much luck getting those ones to work either.

So uh, I was trying to figure out for a while how the heck the reaction "imbue with material" I recall having at one point worked only to realize it was done through a script, apparently it was folded at least partially into another script but I can't figure out how to get one that makes something "Vaci Sunaclotho's skull helm" like the reaction one did, is that the only way to make it keep the name/body part stuff?

I recall playing with it some time back and accidentally making a roc feather dagger and such, was that broken by one of the more recent updates or am I just not looking in the right spot?
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2608 on: May 12, 2015, 10:44:34 pm »

I suspect the problem is that if they enter the map with the syndrome already applied, DFHack doesn't trigger the event. On self interactions should work.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2609 on: May 13, 2015, 01:42:20 am »

Boltgun and Meph, I'm pretty sure the problem was the self-targeting interaction rather than catching the syndrome.  I've never had much luck with self-targeting interactions for whatever reason.  What surprised me was that a probability 100 regional interaction didn't appear when it was the only option for that biome.  Interactions just hate me.  At least the Lua code works.

Can you post your interaction?
It's sort of a moot point now, though I'd like to know if I just plain did the interactions wrong.  These are the two interactions, though they wouldn't both be active at the same time.

Code: (interaction_tesb.txt) [Select]
interaction_tesb

[OBJECT:INTERACTION]

This interaction serves as a hook for a syndrome-trigger.

[INTERACTION:DOMESTICATE PET ROCK]
[I_SOURCE:REGION]
[IS_REGION:ANY]
[IS_FREQUENCY:100]
[I_TARGET:A:CREATURE]
[IT_LOCATION:CONTEXT_CREATURE]
[IT_AFFECTED_CREATURE:PET_ROCK:ALL]
[IT_CANNOT_TARGET_IF_ALREADY_AFFECTED]
[I_EFFECT:ADD_SYNDROME]
[IE_TARGET:A]
[IE_INTERMITTENT:WEEKLY]
[SYNDROME]
[SYN_NAME:Adorable pet rock]
[CE_MENT_ATTR_CHANGE:PATIENCE:200:1000:START:0]

[INTERACTION:GO_DOMESTIC]
[I_SOURCE:CREATURE_ACTION]
[I_TARGET:ME:CREATURE]
[IT_LOCATION:CONTEXT_CREATURE]
[IT_CANNOT_TARGET_IF_ALREADY_AFFECTED]
[I_EFFECT:ADD_SYNDROME]
[IE_TARGET:ME]
[SYNDROME]
[SYN_CLASS:TESB_DOMESTICATE]
[SYN_NAME:Adorable Pet Rock]
[CE_MENT_ATTR_CHANGE:PATIENCE:200:1000:START:0]

And in onload.init:

modtools/syndrome-trigger -syndrome "Adorable pet rock" -command [ tesb-domesticate \\UNIT_ID ]

which I know works when run from the console.  The regional one might have misfired because regional interactions just don't pop up as often as modders would like them to.  The self-interacting one probably misfired because the critter has an [IMMOBILE] tag, which seems to inhibit all interactions.

The whole reason I needed the script in the first place is that immobile wild animals can't get themselves caught in traps, and I really want these guys to be adoptable.  There is also a condition under which they'll be spawn-unit'ed, but those start out tame anyway.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map
Pages: 1 ... 172 173 [174] 175 176 ... 360