Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 7 8 [9] 10 11 ... 44

Author Topic: Putnam's DFHack scripts  (Read 118980 times)

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #120 on: March 24, 2013, 11:35:59 pm »

This readme

Do you mean with raws? Sorry, not yet. Soon. However, you can do this:

item.flags.garbage_collect = true

This works for projectiles, too. Doing that will make the item disappear soon enough.

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #121 on: March 25, 2013, 02:57:26 am »

I meant with LUA.

How would I... write it so that "projectile" has that flag set? As I said I am a total newbie when it comes to lua syntax yet.

Currently I have this:
Code: [Select]
events=require "plugins.eventful"
events.onProjItemCheckImpact.expansion=function(projectile)
if projectile then
local material = getMaterial(projectile.item)
if matExplodesWeb(material) then dfhack.maps.spawnFlow(projectile.cur_pos,8,0,0,50000) end
if matExplodesFire(material) then dfhack.maps.spawnFlow(projectile.cur_pos,7,0,0,50000) end
if matExplodesDragon(material) then dfhack.maps.spawnFlow(projectile.cur_pos,6,0,0,50000) end
if matExplodesSmoke(material) then dfhack.maps.spawnFlow(projectile.cur_pos,5,0,0,50000) end
if matHasScriptAttached(material) then
local script = getScriptFromMaterial(material)
dfhack.run_script(unpack(script))
end
end
end
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #122 on: March 25, 2013, 03:34:27 am »

This readme

Do you mean with raws? Sorry, not yet. Soon. However, you can do this:

item.flags.garbage_collect = true

This works for projectiles, too. Doing that will make the item disappear soon enough.
Better use "dfhack.items.remove(item)". This way it hides it instantly and then game removes it later (it also may or may not include all the logic not to crash the game with missing references...)
@Deon:
Code: [Select]
    if projectile then
<..> stuff here<...>
        dfhack.items.remove(projectile.item) --hopefully this does not crash ;)
    end
Also Putnam you can use "table.unpack" instead of your own.
« Last Edit: March 25, 2013, 03:37:27 am by Warmist »
Logged

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #123 on: March 25, 2013, 03:45:19 am »

Thanks a lot, Warmist! What would we do without you <3.
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #124 on: March 25, 2013, 03:51:51 am »

Code: [Select]
events.onProjItemCheckImpact.expansion=function(projectile)
if projectile then
local material = getMaterial(projectile.item)
if matExplodesWeb(material) then
dfhack.maps.spawnFlow(projectile.cur_pos,8,0,0,50000)
dfhack.items.remove(projectile.item)
end
if matExplodesFire(material) then
dfhack.maps.spawnFlow(projectile.cur_pos,7,0,0,50000)
dfhack.items.remove(projectile.item)
end
if matExplodesDragon(material) then
dfhack.maps.spawnFlow(projectile.cur_pos,6,0,0,50000)
dfhack.items.remove(projectile.item)
end
if matExplodesSmoke(material) then
dfhack.maps.spawnFlow(projectile.cur_pos,5,0,0,50000)
dfhack.items.remove(projectile.item)
end
if matHasScriptAttached(material) then
local script = getScriptFromMaterial(material)
dfhack.run_script(unpack(script))
dfhack.items.remove(projectile.item)
end
end
end
This does not remove the item.
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #125 on: March 25, 2013, 04:12:41 am »

Hmm plan b.
Checked projectile flags. Two thing might work: has_hit_ground and/or to_be_deleted.
Code: [Select]
projectile.flags.has_hit_ground=true --this might be enough...
projectile.flags.to_be_deleted=true --or this or a combination of the two.

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #126 on: March 25, 2013, 04:17:32 am »

It works perfectly, thank you sir!
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #127 on: March 25, 2013, 06:01:13 am »

This is weird.

Code: [Select]
[INORGANIC:IRENE]
[USE_MATERIAL_TEMPLATE:METAL_TEMPLATE]
[STATE_NAME_ADJ:ALL_SOLID:reinforced]
[STATE_NAME_ADJ:LIQUID:molten metal]
[STATE_NAME_ADJ:GAS:boiling metal]
[DISPLAY_COLOR:0:7:1]
[BUILD_COLOR:0:7:1]
[MATERIAL_VALUE:30]
[SPEC_HEAT:500]
[MELTING_POINT:12718]
[BOILING_POINT:14968]
[SOLID_DENSITY:7850]
[LIQUID_DENSITY:6980]
[MOLAR_MASS:55845]
[IMPACT_YIELD:1505000]
[IMPACT_FRACTURE:2520000]
[IMPACT_STRAIN_AT_YIELD:940]
[COMPRESSIVE_YIELD:1505000]
[COMPRESSIVE_FRACTURE:2520000]
[COMPRESSIVE_STRAIN_AT_YIELD:940] 160
[TENSILE_YIELD:430000]
[TENSILE_FRACTURE:720000]
[TENSILE_STRAIN_AT_YIELD:225] 200
[TORSION_YIELD:430000]
[TORSION_FRACTURE:720000]
[TORSION_STRAIN_AT_YIELD:215]
[SHEAR_YIELD:430000]
[SHEAR_FRACTURE:720000]
[SHEAR_STRAIN_AT_YIELD:215] no data, used 200
[BENDING_YIELD:430000]
[BENDING_FRACTURE:720000]
[BENDING_STRAIN_AT_YIELD:215]
[MAX_EDGE:10000]
[ITEMS_HARD]
[ITEMS_METAL]
[SYNDROME]
[SYN_NAME:power armor boost]
[SYN_CLASS:DFHACK_ITEM_SYNDROME]
[SYN_CLASS:DFHACK_ARMOR_ONLY]
[CE_MATERIAL_FORCE_MULTIPLIER:MAT_MULT:NONE:NONE:1:2:START:0:END:200]
[CE_PHYS_ATT_CHANGE:STRENGTH:150:1000:START:0:END:200]
[CE_PHYS_ATT_CHANGE:TOUGHNESS:150:1000:START:0:END:200]
[CE_SPEED_CHANGE:SPEED_PERC:120:START:0:END:200]

I get initial boost when I wear it, but then I cannot repeat it after it wears off.
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #128 on: March 25, 2013, 07:26:56 am »

Yeah, it does not refresh itself. Whenever I wear an armor, it applies the syndrome, but it goes away after a while and is never re-applied, even if I still wear the armor.

P.S. If I type "itemsyndrome force", it reapplies the syndrome. It does not do it normally though.
« Last Edit: March 25, 2013, 07:31:42 am by Deon »
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Maklak

  • Bay Watcher
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #129 on: March 25, 2013, 08:29:00 am »

I'm just wondering if your magma ammunition could have other things to implement balefire egg / mininuke launcher. Useful effects:
* Make the gun shoot the projectile with so much power that it pieces anything - this is easy, just inctease shoot force and max velocity.
* Spawn 1-2 magma in a 3x3 circle around the impact point. This would probably have to check for map boundaries.
* Spawn cave-in dust that pushes things around.
* Fire fire in circular pattern - by making fire cones in all 9 directions
* Spawn a radiation burst cloud, like ghouls. (Material emission with harmful syndromes)
Logged
Quote from: Omnicega
Since you seem to criticize most things harsher than concentrated acid, I'll take that as a compliment.
On mining Organics
Military guide for FoE mod.
Research: Crossbow with axe and shield.
Dropbox referral

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #130 on: March 25, 2013, 09:49:46 am »

Yeah, it does not refresh itself. Whenever I wear an armor, it applies the syndrome, but it goes away after a while and is never re-applied, even if I still wear the armor.

P.S. If I type "itemsyndrome force", it reapplies the syndrome. It does not do it normally though.
Okay, apparently SC_WORLD_LOADED is "false" during adventure mode... Any good idea how to check if the game runs in adv. mode too?
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #131 on: March 25, 2013, 11:34:45 am »

Here're the current issues I have with itemsyndrome so far:

1) With SC_WORLD_LOADED test it works in adventure mode only once (does not update).
2) When adventurer is ambushed, the gap for activation is too big. It would be awesome to trigger "itemsyndrome force" once the ambush happens.
3) When you call itemsyndrome in succession, the syndromes stack which often leads to broken huge numbers. There should be a check if a creature is already affected with the syndrome. Maybe even add a check for SYN_CLASS:DFHACK_CLASS_POWERBOOST etc to make mutually exclusive items possible.
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: Putnam's DFHack modder's utilities(!!)
« Reply #132 on: March 25, 2013, 11:43:30 am »

Isnt SYN_IMMUNE_CLASS respected already? You could add syn_class:unique and syn_immune_class:unique to each mutually exclusive syndrome. Or I am mixing up syndromes and interactions again. ^^
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 :::

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #133 on: March 25, 2013, 12:27:41 pm »

SYN_IMMUNE_CLASS makes creature totally immune to a syndrome, that's not something I need.
And I want it not to stack the SAME syndrome.

Now every time a syndrome is refreshed, it stacks instead of checking if it's already there which leads to weird peaks.
« Last Edit: March 25, 2013, 12:50:24 pm by Deon »
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Putnam's DFHack modder's utilities(!!)
« Reply #134 on: March 25, 2013, 01:24:13 pm »

I've found the problem with SC_WORLD_LOADED.

When you go into Travel mode, it stops counting dfhack.timeout which is supposed to repeatedly call the script, right?
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository
Pages: 1 ... 7 8 [9] 10 11 ... 44