Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 15 16 [17]

Author Topic: [DROW] Discussion and Suggestions (v0.9)  (Read 20723 times)

IndigoFenix

  • Bay Watcher
  • All things die, but nothing dies forever.
    • View Profile
    • Boundworlds: A Browser-Based Multiverse Creation and Exploration Game
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #240 on: January 13, 2014, 03:05:36 am »

This is cool.

How easy is it to incorporate new DFhack scripts into MDF?  Also, do updates tend to break scripts, or just the DFhack program itself?  Because I'm thinking of learning how to write scripts myself, but I don't want to have to worry about rewriting them later.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #241 on: January 13, 2014, 03:30:20 am »

It depends on the scripts, but usually all of them can be called by Autosyndrome and Syndrometrigger. First uses reactions, the second uses interactions. I have probably done most with the first one, and Roses is currently working on a magic-spell system that uses syndrometrigger a lot.

Updating the mod or even saves with scripts is not a problem, but a new DF version would need an update for dfhack. But I dont think the scripts would need to be rewritten, its more the main program that needs to be adjusted to the new .exe. But I am no expert on the matter. Best to ask in the dfhack thread, or Peterix directly.
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 :::

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #242 on: January 19, 2014, 12:58:57 am »

I tried the shapechange script. I got an error message at first, from the ..NEWLINE.., but after I changed some text in the script it works. No problems.

Is there any way to restrict the creatures to a shorter list? Something I can put in manually in the script? I would really like to add a list of 20-30 or so creature-ids in the script, instead of looking through a list of 1300 creatures, with all those fake-creatures, crazed ones, uber-powerfull, immobile ones. It would make the script a lot more balanced. :)
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 :::

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #243 on: January 19, 2014, 01:10:01 am »

There are arguments, two of which are filters: body size (0 being equal to "no filter") and string (which filters by creature ID).

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #244 on: January 19, 2014, 01:21:52 am »

I saw the body size one, but it doesnt help much with the fake creatures.

How does the one with the string work? Can you just give an example with "cat, dog, horse", something simple I can use as a template?

Creature does interaction => you can chose between cat, dog or horse from the list.
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 :::

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #245 on: January 19, 2014, 01:25:14 am »

If you have TRANSFORM as a filter (using IIRC the fifth arg), it'll only allow creatures that have something like TRANSFORM_SOMETHING. I guess it would be better to have classes.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #246 on: January 19, 2014, 01:29:24 am »

So it checks the creature ids for that string, and as long as it is part of the id, its fine, BUT it can only be one argument. If I want cat, dog and horse, I have to redo their creature files into:

Code: [Select]
CREATURE:EXAMPLE_DOG

CREATURE:EXAMPLE_CAT

CREATURE:EXAMPLE_HORSE

And then add the SYN_CLASS:EXAMPLE to the interaction.

Thats indeed a bit clunky, because changing creature id might muck up any number of other transformations or syn-affected-creature, things like that. Is it a lot of work to change it to look for CREATURE_CLASS:EXAMPLE ?

Edit: Maybe I can use it with FORGOTTEN or TITAN to get access to the procedually generated content?
Edit2: Mh... I tried FORGOTTEN as string, it didnt find anything. So I guess it cant read from the world.dat, and only from the raws.
Edit3: Doesnt seem to work at all. Or I misunderstood you. I tried WERE and BLOOD, and I certainly have several creatures with these words in their ids.

Just in case the syntax is wrong:
[SYN_CLASS:\COMMAND]
[SYN_CLASS:shapechange] => I added the script directly into the hack/scripts folder
[SYN_CLASS:\UNIT_ID]
[SYN_CLASS:33600] => one month
[SYN_CLASS:99999999] => lol, dont know how to skip the size argument
[SYN_CLASS:BLOOD] => creature id. I hope.
« Last Edit: January 19, 2014, 01:55:26 am by Meph »
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 :::

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #247 on: January 19, 2014, 01:54:25 am »

Which one? It's a very specific argument and you have to fill in all the ones in between if you want to make it work.

unitID tickamount maxsize namefilter

Which is immutable. You may want \UNIT 0 0 WERE for that.

I can write up a version with class recognition real quick.

EDIT: Apparently the filter was for name and not ID, which is even odder. Class is better.
« Last Edit: January 19, 2014, 01:58:29 am by Putnam »
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #248 on: January 19, 2014, 01:58:39 am »

See the edit above. I think creature classes are better.

And its correct that it cant do procedually generated ones? Because real DF werebeasts or titans would be awesome. That would make it a lot more interesting for the player, since it changes every world :)
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 :::

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #249 on: January 19, 2014, 02:01:12 am »

Here:

Code: [Select]
-- transforms unit (by number) into another creature, choice given to user. Syntax is: unitID tickamount maxsize namefilter. A size of 0 is ignored. A length of 0 is also ignored. If no filter, all units will be sorted. A filter of ALL will also work with all units.

local dialog = require('gui.dialogs')
local script = require('gui.script')
function transform(target,race,caste,length)
    if target==nil then
        qerror("Not a valid target")
    end
    local defaultRace = target.enemy.normal_race
    local defaultCaste = target.enemy.normal_caste
    target.enemy.normal_race = race --that's it???
    target.enemy.normal_caste = caste; --that's it!
    if length>0 then dfhack.timeout(length,'ticks',function() target.enemy.normal_race = defaultRace target.enemy.normal_caste = defaultCaste end) end
end

function compareCreatureClass(str,unit)
for k,v in ipairs(df.creature_raw.find(unit.race).caste[unit.caste].creature_class) do
if str:find(v.value) then return true end
end
return false
end

function getBodySize(caste)
    return caste.body_size_1[#caste.body_size_1-1]
end

function selectCreature(unitID,length,size,filter) --taken straight from here, but edited so I can understand it better: https://gist.github.com/warmist/4061959/... again. Also edited for syndromeTrigger, but in a completely different way.
    size = size or 0
    filter = filter or "all"
    length = length or 2400
    local creatures=df.global.world.raws.creatures.all
    local tbl={}
    local tunit=df.unit.find(unitID)
    for cr_k,creature in ipairs(creatures) do
        for ca_k,caste in ipairs(creature.caste) do
            local name=caste.caste_name[0]
            if name=="" then name="?" end
            if (not filter or compareCreatureClass(filter,tunit) or string.lower(filter)=="all") and (not size or size>getBodySize(caste) or size<1 and not creature.flags.DOES_NOT_EXIST) then table.insert(tbl,{name,nil,cr_k,ca_k}) end
        end
    end
    table.sort(tbl,function(a,b) return a[1]<b[1] end)
    local f=function(name,C)
        transform(tunit,C[3],C[4],length)
    end
    script.start(function()
        local ok =
            script.showYesNoPrompt(
                "Just checking","Do you want "
                .. dfhack.TranslateName(dfhack.units.getVisibleName(tunit)) ..
                " to transform into a creature of size below " ..NEWLINE..
                .. (not not size and size>1 and size or "infinity") ..
                " ("
                .. size/(getBodySize(df.creature_raw.find(tunit.race).caste[tunit.caste]))*100 ..
                "% of current size) for "
                ..length..
                " ticks ("
                ..length/1200 ..
                " days, ~"
                ..length/df.global.enabler.fps..
                " seconds)?",
                COLOR_LIGHTRED)
        if ok then dialog.showListPrompt("Creature Selection","Choose creature:",COLOR_WHITE,tbl,f) end
    end)
end

local args = {...}
selectCreature(tonumber(args[1]),tonumber(args[2]),tonumber(args[3]),args[4])

And I definitely don't see any reason why it shouldn't be able to do procedural ones. In fact, I'm fairly sure it most certainly does allow that. I guess the main problem is because it's sorted alphabetically.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #250 on: January 19, 2014, 02:16:43 am »

I dont know. I tried the new version. First test showed no creatures in the list.
[SYN_CLASS:shapechange][SYN_CLASS:\UNIT_ID][SYN_CLASS:33600][SYN_CLASS:0][SYN_CLASS:MEGABEAST]

Second test showed all creatures in the list. Even those that have nothing to do with EVIL. (I checked one file to make sure, in the entire .txt the word evil doesnt even exist.
[SYN_CLASS:shapechange][SYN_CLASS:\UNIT_ID][SYN_CLASS:33600][SYN_CLASS:0][SYN_CLASS:EVIL]

But this list will all creatures also shows the procedual werebeasts. Forgotten beasts are in there as well, all with the same name "Forgotten Beast".

I will give you some time to... I dont know. If it would only show werebeasts or forgotten beasts, that would be grand. Picking from a list is an optional bonus. The werebeasts are what I would love to use it for. :) They dont have any special creature-classes, so I guess the unit-id with WERE in it would work best. But it didnt work when I first tried it.
« Last Edit: January 19, 2014, 02:20:29 am by Meph »
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 :::

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #251 on: January 19, 2014, 02:52:00 am »

It's classes only, not tokens. I guess I could also search by token.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #252 on: January 19, 2014, 03:16:55 am »

If you have TRANSFORM as a filter (using IIRC the fifth arg), it'll only allow creatures that have something like TRANSFORM_SOMETHING. I guess it would be better to have classes.
I thought this searches for ID?

Anyway, I am too tired to make much sense of this now.

What I tried with classes was for classes: [CREATURE_CLASS:EVIL]. I added this to all evil creatures in the mod. (and GOOD, and SUBTERRANEAN and MEGABEAST, etc) to  make it easier for specific poisons or materials to affect only one group. So the SYN_CLASS:EVIL should have only listed these CREATURE_CLASS:EVIL creatures... but it didnt. For example all armored pets were in it, and the werebeasts and forgotten beasts, and dwarves... And much much more. It did not only list the evil ones.
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 :::

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #253 on: January 19, 2014, 03:18:06 am »

I posted a new version with classes last page.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DROW] Discussion and Suggestions (v0.9)
« Reply #254 on: January 19, 2014, 03:41:57 am »

Yes, I tried it. With MEGABEAST and EVIL. It didnt work.
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 :::
Pages: 1 ... 15 16 [17]