Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 24 25 [26] 27 28 ... 42

Author Topic: [DFHack] Roses' Script Collection Updated 5/4/15  (Read 119017 times)

expwnent

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #375 on: November 07, 2014, 02:34:21 pm »

I did tweak EventManager stuff a little but I assumed it didn't make a difference. I tested it on the develop branch. It should work in the next release.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #376 on: November 07, 2014, 02:56:27 pm »

Well I am also still using the 0.34 special release, so it might have changed more than just a little.

EDIT: I have a feeling my onLoad.init is going to become a very large file...
Code: [Select]
# Spells
## Elemental
# Elemental spell strengths are based on Willpower
### Pure Elements
#### Fire
# Fire spells specialize in area damage effects and damage over time
# Fire spells are strong against Ice creatures and weak against Water creatures
# Attack spells lower the Toughness and Endurance of Ice creatures
# Attack spells remove Ice Ward
# Attack spells remove Soaked
# Attack spells add Burning
# Buff spells increase Strength and Agility
##### Level 1
###### Burn
modtools/interaction-trigger -onAttackStr "casts burn" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome BURN ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_1 FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] ]
modtools/interaction-trigger -onAttackStr "casts burn" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ unit/attribute-change -unit !TARGET -physical [ ENDURANCE TOUGHNESS ] -fixed [ !VALUE !VALUE ] -dur 1200 ] -value self:willpower:-5:0 -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_1 FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] -aclass [ ICE_1 ICE_2 ICE_3 ICE_4 ] ]
modtools/interaction-trigger -onAttackStr "casts burn" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome ICE_WARD -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_1 FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] -asyndrome [ ICE_WARD ] ]
modtools/interaction-trigger -onAttackStr "casts burn" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome SOAKED -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_1 FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] -asyndrome [ SOAKED ] ]
modtools/interaction-trigger -onAttackStr "casts burn" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -counter FIRE_CAST -increment 1 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts burn" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -unit !SOURCE -counter FIRE_CAST -increment 1 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts burn" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ classes/add-experience -unit !SOURCE -amount 10 ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
###### Flame Weapon
modtools/interaction-trigger -onAttackStr "casts flame weapon" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ item/imbue -unit !SOURCE -weapon -mat DFHACK_IMBUE_FIRE -dur 1200 ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts flame weapon" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ unit/attribute-change -unit !SOURCE -physical [ STRENGTH AGILITY ] -fixed [ !VALUE !VALUE ] -dur 1200 ] -value self:willpower:5:0 -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts flame weapon" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -counter FIRE_CAST -increment 1 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts flame weapon" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -unit !SOURCE -counter FIRE_CAST -increment 1 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts flame weapon" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ classes/add-experience -unit !SOURCE -amount 5 ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
##### Level 2
###### Fire Armor
modtools/interaction-trigger -onAttackStr "casts fire armor" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !SOURCE -syndrome FIRE_ARMOR ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -isyndrome [ MAGIC_ARMOR ] ]
modtools/interaction-trigger -onAttackStr "casts fire armor" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ unit/attribute-change -unit !SOURCE -physical [ STRENGTH AGILITY ] -fixed [ !VALUE !VALUE ] -dur 1800 ] -value self:willpower:7:0 -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts fire armor" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -counter FIRE_CAST -increment 2 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts fire armor" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -unit !SOURCE -counter FIRE_CAST -increment 2 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts fire armor" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ classes/add-experience -unit !SOURCE -amount 10 ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
###### Fire Jet
modtools/interaction-trigger -onAttackStr "casts fire jet" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/spawnflow -unit !TARGET -flow firebreath -size !VALUE ] -value self:willpower:1:0 -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] ]
modtools/interaction-trigger -onAttackStr "casts fire jet" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ unit/attribute-change -unit !TARGET -physical [ ENDURANCE TOUGHNESS ] -fixed [ !VALUE !VALUE ] -dur 1800 ] -value self:willpower:-7:0 -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] -aclass [ ICE_1 ICE_2 ICE_3 ICE_4 ] ]
modtools/interaction-trigger -onAttackStr "casts fire jet" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome ICE_WARD -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] -asyndrome [ ICE_WARD ] ]
modtools/interaction-trigger -onAttackStr "casts fire jet" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome SOAKED -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] -asyndrome [ SOAKED ] ]
modtools/interaction-trigger -onAttackStr "casts fire jet" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -counter FIRE_CAST -increment 2 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts fire jet" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -unit !SOURCE -counter FIRE_CAST -increment 2 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts fire jet" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ classes/add-experience -unit !SOURCE -amount 20 ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
###### Flame Blast
modtools/interaction-trigger -onAttackStr "casts flame blast" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome FLAME_BLAST ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] ]
modtools/interaction-trigger -onAttackStr "casts flame blast" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/propel -unit_source !SOURCE -unit_target !TARGET -velocity 2,2,0 -relative ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] ]
modtools/interaction-trigger -onAttackStr "casts flame blast" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ unit/attribute-change -unit !TARGET -physical [ ENDURANCE TOUGHNESS ] -fixed [ !VALUE !VALUE ] -dur 1800 ] -value self:willpower:-7:0 -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] -aclass [ ICE_1 ICE_2 ICE_3 ICE_4 ] ]
modtools/interaction-trigger -onAttackStr "casts flame blast" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome ICE_WARD -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] -asyndrome [ ICE_WARD ] ]
modtools/interaction-trigger -onAttackStr "casts flame blast" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome SOAKED -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] -asyndrome [ SOAKED ] ]
modtools/interaction-trigger -onAttackStr "casts flame blast" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -counter FIRE_CAST -increment 2 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts flame blast" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -unit !SOURCE -counter FIRE_CAST -increment 2 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts flame blast" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ classes/add-experience -unit !SOURCE -amount 20 ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
##### Level 3
###### Fire Ball
modtools/interaction-trigger -onAttackStr "casts fireball" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/spawnflow -unit !TARGET -flow firebreath -size !VALUE -radius 5 ] -value self:willpower:1:10 -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_3 FIRE_4 MAGIC_IMMUNE] -isyndrome [ FIRE_WARD IMMUNE_MAGIC ] ]
modtools/interaction-trigger -onAttackStr "casts fireball" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ unit/attribute-change -unit !TARGET -physical [ ENDURANCE TOUGHNESS ] -fixed [ !VALUE !VALUE ] -dur 2400 ] -value self:willpower:-10:0 -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_3 FIRE_4 MAGIC_IMMUNE ] -isyndrome [ FIRE_WARD IMMUNE_MAGIC ] -aclass [ ICE_1 ICE_2 ICE_3 ICE_4 ] ]
modtools/interaction-trigger -onAttackStr "casts fireball" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome ICE_WARD -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_3 FIRE_4 MAGIC_IMMUNE ] -isyndrome [ FIRE_WARD IMMUNE_MAGIC ] -asyndrome [ ICE_WARD ] ]
modtools/interaction-trigger -onAttackStr "casts fireball" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome SOAKED -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_3 FIRE_4 MAGIC_IMMUNE ] -isyndrome [ FIRE_WARD IMMUNE_MAGIC ] -asyndrome [ SOAKED ] ]
modtools/interaction-trigger -onAttackStr "casts fireball" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -counter FIRE_CAST -increment 3 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts fireball" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -unit !SOURCE -counter FIRE_CAST -increment 3 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts fireball" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ classes/add-experience -unit !SOURCE -amount 30 ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
###### Fire Elemental
modtools/interaction-trigger -onAttackStr "summons fire elemental" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_3 FIRE_4 MAGIC_IMMUNE] -isyndrome [ FIRE_WARD IMMUNE_MAGIC ] ]
modtools/interaction-trigger -onAttackStr "summons fire elemental" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -counter FIRE_CAST -increment 3 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "summons fire elemental" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -counter SUMMON -increment 1 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "summons fire elemental" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -unit !SOURCE -counter FIRE_CAST -increment 3 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "summons fire elemental" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ classes/add-experience -unit !SOURCE -amount 15 ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
###### Incinerate
modtools/interaction-trigger -onAttackStr "casts incinerate" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ unit/body-change -unit !TARGET -all -temperature fire -dur !VALUE ] -value self:willpower:100:0 -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_3 FIRE_4 MAGIC_IMMUNE] -isyndrome [ FIRE_WARD IMMUNE_MAGIC ] ]
modtools/interaction-trigger -onAttackStr "casts incinerate" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ unit/attribute-change -unit !TARGET -physical [ ENDURANCE TOUGHNESS ] -fixed [ !VALUE !VALUE ] -dur 2400 ] -value self:willpower:-10:0 -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_3 FIRE_4 MAGIC_IMMUNE ] -isyndrome [ FIRE_WARD IMMUNE_MAGIC ] -aclass [ ICE_1 ICE_2 ICE_3 ICE_4 ] ]
modtools/interaction-trigger -onAttackStr "casts incinerate" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome ICE_WARD -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_3 FIRE_4 MAGIC_IMMUNE ] -isyndrome [ FIRE_WARD IMMUNE_MAGIC ] -asyndrome [ ICE_WARD ] ]
modtools/interaction-trigger -onAttackStr "casts incinerate" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome SOAKED -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_3 FIRE_4 MAGIC_IMMUNE ] -isyndrome [ FIRE_WARD IMMUNE_MAGIC ] -asyndrome [ SOAKED ] ]
modtools/interaction-trigger -onAttackStr "casts incinerate" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -counter FIRE_CAST -increment 3 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts incinerate" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -unit !SOURCE -counter FIRE_CAST -increment 3 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts incinerate" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ classes/add-experience -unit !SOURCE -amount 30 ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
##### Level 4
###### Dragon Breath
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/spawnflow -unit !TARGET -flow dragonfire -size !VALUE ] -value self:willpower:2:0 -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_4 MAGIC_IMMUNE] -isyndrome [ IMMUNE_MAGIC ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ unit/attribute-change -unit !TARGET -physical [ ENDURANCE TOUGHNESS ] -fixed [ !VALUE !VALUE ] -dur 3000 ] -value self:willpower:-12:0 -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_4 MAGIC_IMMUNE ] -isyndrome [ IMMUNE_MAGIC ] -aclass [ ICE_1 ICE_2 ICE_3 ICE_4 ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome ICE_WARD -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_4 MAGIC_IMMUNE ] -isyndrome [ IMMUNE_MAGIC ] -asyndrome [ ICE_WARD ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome SOAKED -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_4 MAGIC_IMMUNE ] -isyndrome [ IMMUNE_MAGIC ] -asyndrome [ SOAKED ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -counter FIRE_CAST -increment 4 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -unit !SOURCE -counter FIRE_CAST -increment 4 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ classes/add-experience -unit !SOURCE -amount 40 ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
###### Meteor Storm
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/falling -unit !TARGET -item BOULDER -mat DFHACK_FALLING_METEOR -height 10 -number 5 ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_4 MAGIC_IMMUNE] -isyndrome [ IMMUNE_MAGIC ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ unit/attribute-change -unit !TARGET -physical [ ENDURANCE TOUGHNESS ] -fixed [ !VALUE !VALUE ] -dur 3000 ] -value self:willpower:-12:0 -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_4 MAGIC_IMMUNE ] -isyndrome [ IMMUNE_MAGIC ] -aclass [ ICE_1 ICE_2 ICE_3 ICE_4 ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome ICE_WARD -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_4 MAGIC_IMMUNE ] -isyndrome [ IMMUNE_MAGIC ] -asyndrome [ ICE_WARD ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome SOAKED -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_4 MAGIC_IMMUNE ] -isyndrome [ IMMUNE_MAGIC ] -asyndrome [ SOAKED ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -counter FIRE_CAST -increment 4 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -unit !SOURCE -counter FIRE_CAST -increment 4 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ classes/add-experience -unit !SOURCE -amount 40 ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
###### Volcano
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/eruption -unit !TARGET -magma -radius 5,5,0 ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_4 MAGIC_IMMUNE] -isyndrome [ IMMUNE_MAGIC ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ unit/attribute-change -unit !TARGET -physical [ ENDURANCE TOUGHNESS ] -fixed [ !VALUE !VALUE ] -dur 3000 ] -value self:willpower:-12:0 -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_4 MAGIC_IMMUNE ] -isyndrome [ IMMUNE_MAGIC ] -aclass [ ICE_1 ICE_2 ICE_3 ICE_4 ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome ICE_WARD -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_4 MAGIC_IMMUNE ] -isyndrome [ IMMUNE_MAGIC ] -asyndrome [ ICE_WARD ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome SOAKED -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_4 MAGIC_IMMUNE ] -isyndrome [ IMMUNE_MAGIC ] -asyndrome [ SOAKED ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -counter FIRE_CAST -increment 4 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ special/counters -unit !SOURCE -counter FIRE_CAST -increment 4 -script [ ] ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
modtools/interaction-trigger -onAttackStr "casts dragon breath" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ classes/add-experience -unit !SOURCE -amount 40 ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] ]
« Last Edit: November 07, 2014, 02:58:42 pm by Roses »
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #377 on: November 07, 2014, 03:08:27 pm »

What do the exclamation points mean?

I might look into enabling multiline commands to make reading the onLoad.init easier.

Something like

Code: [Select]
{
modtools/interaction-trigger
 -onAttackStr "casts burn"
 -command [
   blah
  ]
}
Logged

Roses

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #378 on: November 07, 2014, 04:51:28 pm »

Exclamation points just tell the wrapper script that there is something to replace. It's how it was set up before you went to the double \\. I should probably switch that over to match up with the syntax of the rest of DFHack. Multiline commands would be pretty nice, I could then use multi-cmd and put it all in a single interaction-trigger instead of having a bunch of interaction triggers for one spell (which I am doing now only so that it is easier to read)
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #379 on: November 07, 2014, 06:20:06 pm »

The simplest syntax would be to do it C++ style: put a '&' character at the end of the line if you want the next line to be considered an extension of this one.

edit: I'm a dumb. C++ uses \. I won't because then there'd have to be too many backslashes all over for modtools.
« Last Edit: November 09, 2014, 01:25:54 am by expwnent »
Logged

hanspeter

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #380 on: November 09, 2014, 12:56:09 am »

Regarding the class-system:

Just a little addition I'd find useful: is it possible to restrict certain CLASSES to specific CASTES? Like, only [CASTE:MILITARY] can become [CLASS:WARRIOR]?
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #381 on: November 09, 2014, 03:40:08 am »

At some point some or all of this should go in the main repo. It's good enough and useful enough to be useful to a lot of people. How do you feel about that? The easiest way is to just integrate it into the dfhack github repo directly and lose the history. We could do a submodule but those are a pain to work with.

Documentation would also be an issue. You already have a nice HTML documentation thing and it would be a shame to lose all that. It would probably be fine to more or less include it as is and link to it in the existing readme.

There is a small amount of overlap in scripts but hopefully that won't be too much of an issue. They should probably go in subdirectories because they are primarily useful to modders, not players.

PS: The new DFHack is up and interaction-triggers should work now. Have fun. Multi-line commands are not in yet.

edit: PPS: A few of the modtools had incorrect documentation. Basically it goes

Code: [Select]
\\UNIT_ID -> unit id
\\other -> \other
\\\other -> \\other
other -> other

Here "other" is a wildcard and the first rule to apply wins. Previous documentation incorrectly said that \\other -> \\other which would defeat the whole purpose.

This is slightly counter-intuitive because it'll only 'absorb' the first backslash of a not-special argument. For now I'll just leave that.
« Last Edit: November 09, 2014, 03:50:25 am by expwnent »
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #382 on: November 09, 2014, 04:26:16 am »

Regarding the class-system:

Just a little addition I'd find useful: is it possible to restrict certain CLASSES to specific CASTES? Like, only [CASTE:MILITARY] can become [CLASS:WARRIOR]?

Never mind, disregard below and listen to what Roses says.



You could use the wrapper script to enforce that only certain castes become certain classes. It looks like the wrapper script doesn't support this yet, but it shouldn't be hard for Roses to add it. Currently the iclass and aclass tags are for syndrome classes not unit classes. I wrote the below under the (false) assumption that it looks at unit classes instead. It's wrong but it'll give you roughly the right idea of how it will work.

http://www.bay12forums.com/smf/index.php?topic=135597.msg5697736#msg5697736

This should all go on one line to be correct but I'm splitting it up for readability:

Code: [Select]
modtools/reaction-trigger -reactionName BECOME_KNIGHT -command [
 wrapper -unitTarget \\WORKER_ID -acreature [ DWARF:SUPER_M ] -aclass [ DEFAULT ] -script [
  classes/change-class -unit \\WORKER_ID -class KNIGHT
 ]
]

Anyone could do the reaction but it would only turn them into a Knight if they are in the default class (which may or may not exist yet as implemented) and if they were born as a (male) super dwarf. You may also want a complementary command that refunds the base materials if someone other than a male superdwarf attempts to become a knight.

Incidentally, a suggestion: if you make the REQUIRED tags sufficiently close to the syntax of the wrapper script you could make conditions more powerful without duplicating all the same conditions in both places.
« Last Edit: November 09, 2014, 05:04:00 am by expwnent »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #383 on: November 09, 2014, 04:49:23 am »

Regarding the class-system:

Just a little addition I'd find useful: is it possible to restrict certain CLASSES to specific CASTES? Like, only [CASTE:MILITARY] can become [CLASS:WARRIOR]?

You could use the wrapper script to enforce that only certain castes become certain classes. It looks like the wrapper script doesn't support this yet, but it shouldn't be hard for Roses to add it. Currently the iclass and aclass tags are for syndrome classes not unit classes. I wrote the below under the (false) assumption that it looks at unit classes instead. It's wrong but it'll give you roughly the right idea of how it will work.

http://www.bay12forums.com/smf/index.php?topic=135597.msg5697736#msg5697736

This should all go on one line to be correct but I'm splitting it up for readability:

Code: [Select]
modtools/reaction-trigger -reactionName BECOME_KNIGHT -command [
 wrapper -unitTarget \\WORKER_ID -acreature [ DWARF:SUPER_M ] -aclass [ DEFAULT ] -script [
  classes/change-class -unit \\WORKER_ID -class KNIGHT
 ]
]

Anyone could do the reaction but it would only turn them into a Knight if they are in the default class (which may or may not exist yet as implemented) and if they were born as a (male) super dwarf. You may also want a complementary command that refunds the base materials if someone other than a male superdwarf attempts to become a knight.

Actually iclass and aclass tags are for unit classes, isyndrome and asyndrome tags are for syndrome classes. I was going to change isyndrome and asyndrome to check for syndrome names, and then change iclass and aclass to check for both unit class and syndrome classes, but was unsure if there would ever be a situation where you would want to check for those separately. If I can't think of one I will probably merge them. But yes, the wrapper script could identify a caste by either acreature or aclass, both of which could be used to limit who can become a class.

I may add a creature:caste restriction directly into the class system, then you could restrict your classes as you see fit, without the need to use the wrapper, but it'll have to go onto the bottom of my todo pile since technically there is already a way to do it.

At some point some or all of this should go in the main repo. It's good enough and useful enough to be useful to a lot of people. How do you feel about that? The easiest way is to just integrate it into the dfhack github repo directly and lose the history. We could do a submodule but those are a pain to work with.

Documentation would also be an issue. You already have a nice HTML documentation thing and it would be a shame to lose all that. It would probably be fine to more or less include it as is and link to it in the existing readme.

There is a small amount of overlap in scripts but hopefully that won't be too much of an issue. They should probably go in subdirectories because they are primarily useful to modders, not players.

I'm perfectly fine with however much you think should be included in the main repository. But I think you are right that things should go in subdirectories (the way I have mine structured now, that is exactly how they are), my organization philosophy has been, anything a player would want to call on the command line during play just goes straight into the scripts folder, anything a modder references in onLoad goes in its own folder. I am, of course, open to changing the way I have them organized and structured.

As for the HTML document, it unfortunately was made for the previous system (with all those SYN_CLASSes and such), so I doubt it is very useful. I do plan on creating another one that has the updated syntax, and all the changes I have made to various scripts. Most of my scripts do have a -help section though, so that is something at least. Although the large systems (wrapper, class, and civilization, with event and journal on the way) require a lot more explanation than is reasonable in a -help.

And as for the overlap, I am fine with those scripts that overlap being included or not being, I generally have them just because they do things slightly different than all the other versions I know of, and I didn't want to modify someone elses script and then forget that it is different than other peoples versions.
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #384 on: November 09, 2014, 05:14:40 am »

I have the same organizational philosophy, even though the current DFHack scripts folder is a little cluttered. Good we agree. Maybe at some point player scripts will have to be organized into subfolders too but that's a problem for later.

Are you still having problems with the unit death event? I was reading back and you said it was missing some. I haven't touched it in a long time so it's probably still broken but it might have magically fixed itself with some DF change. edit: It's a pretty cheap test so you can probably afford to check it every frame without slowing FPS too much.

Chaining: Suppose you want to shoot a magic bolt that splits at the target and bounces around. A spell that immediately bounces around seems fairly straightforward but if you need the bolt to actually hit the target in order to bounce you might have to use item-trigger or projectile-trigger in a tricky way. It's a weird case. I don't actually need it so if it's not possible don't worry about it.
« Last Edit: November 09, 2014, 07:16:52 am by expwnent »
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #385 on: November 09, 2014, 08:04:44 am »

Looking over everything. Overall I think the code looks pretty great. A few quibbles:

There was a createitem script which overlaps with modtools/create-item. I think the only difference was yours includes an optional duration.

When at least one of several is required, I find it best to say -flowType [magma/water] instead of -magma or -water.

dfhack.run_script('blah',table.unpack('-arg1','asdf','-arg2',asdf2)) is equivalent to
dfhack.run_script('blah -arg1 asdf -arg2 ' .. asdf2)

It's a stylistic choice. Both are fine.

asdf.name can be used in place of asdf['name'] and it generally looks better.

Falling and projectile and propel are similar enough they should probably be combined unless I misunderstand what they do. They should also delegate to dfhack.items.createItem or just work with a pre-existing item. If you want to simultaneously create and project an item you could do something like

Code: [Select]
multicmd
 modtools/create-item -item WEAPON:ITEM_WEAPON_PICK
 falling -item lastCreated -blah blah

createCallback: you generally don't need to do this. You can just say something like

dfhack.timeout(100,'ticks', function () blah end)

When checking if a syndrome has any of a list of syn_classes you technically should be doing the O(n) algorithm with hash tables instead of the O(n^2) algorithm of all pairs comparisons, but most syndromes have few syn_classes and most commands list few syn_classes so it should be fine in practice.

Looking at the way you use persistent variables I think there might be an easier way of doing persistent tables than I thought. Something like

Code: [Select]
local valueStr = dfhack.persistent.tableLookup(tableName,keyName)
dfhack.persistent.tableUpdate(tableName,keyName,valueStr)

In the implementation I'd have the C++ side of things cache the indices of the actual histfigs it's using so that it would get O(1) performance instead of linear performance. It would only make your code slightly cleaner but it would be much faster for looking up stored data.

Still need to do no-target interactions in EventManager. I think I'll just allow it to trigger when the number of defenders isn't exactly one. It could lead to problems, so anyone who uses it would have to check whether the number of targets is appropriate or not.
« Last Edit: November 09, 2014, 10:22:04 am by expwnent »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #386 on: November 09, 2014, 05:08:27 pm »

Are you still having problems with the unit death event? I was reading back and you said it was missing some. I haven't touched it in a long time so it's probably still broken but it might have magically fixed itself with some DF change. edit: It's a pretty cheap test so you can probably afford to check it every frame without slowing FPS too much.
I haven't checked in awhile, but I am not sure if it's that it isn't triggering, or that the last attacker doesn't include death by bleeding or something. I should do some more thorough tests to see the efficiency.

Chaining: Suppose you want to shoot a magic bolt that splits at the target and bounces around. A spell that immediately bounces around seems fairly straightforward but if you need the bolt to actually hit the target in order to bounce you might have to use item-trigger or projectile-trigger in a tricky way. It's a weird case. I don't actually need it so if it's not possible don't worry about it.
That is a good idea, right now chaining just works by replicating the spell and messing with the source and target id's. It would be cool if it relied on actually hitting the first target. I would have to think of a clever way to handle that. I think it would involve projectile-trigger and some trickyness, but I think it could be done.

Looking over everything. Overall I think the code looks pretty great. A few quibbles:

There was a createitem script which overlaps with modtools/create-item. I think the only difference was yours includes an optional duration.
Yes, that is basically the only difference between the two, it might be worth it to just include the optional duration in the modtools version, and then I can scrap my version.

When at least one of several is required, I find it best to say -flowType [magma/water] instead of -magma or -water.
Technically only -magma is needed for that, it defaults to -water, but I understand your point

dfhack.run_script('blah',table.unpack('-arg1','asdf','-arg2',asdf2)) is equivalent to
dfhack.run_script('blah -arg1 asdf -arg2 ' .. asdf2)

It's a stylistic choice. Both are fine.
Hmmm, I like the second way more than my way, I didn't realize it was equivalent, I'll change them over.

asdf.name can be used in place of asdf['name'] and it generally looks better.
I was having difficulties with the . convention. Sometimes it would work fine, othertimes it would not. Is that because for something like asdf.end, end is a special function in lua, and so it gets upset?

Falling and projectile and propel are similar enough they should probably be combined unless I misunderstand what they do. They should also delegate to dfhack.items.createItem or just work with a pre-existing item. If you want to simultaneously create and project an item you could do something like

Code: [Select]
multicmd
 modtools/create-item -item WEAPON:ITEM_WEAPON_PICK
 falling -item lastCreated -blah blah
Yes, they are all three very similar, propel works just on units, falling is just items falling from the sky, and projectile is items moving from one x,y,z to another. The reason they are three separate scripts now is because they started as three separate spells that I expanded on (cyclone, blizzard, and multi-shot respectively). Falling and projectile could easily be combined, it might be nice to keep propel separate though so people know that one is for items and one is for units.

I like your idea of having the item one work on pre-existing items, and simply creating items if need be. That simplifies the code greatly, and allows for using actual ammunition on a unit to perform a special shot. I will look into it.

createCallback: you generally don't need to do this. You can just say something like

dfhack.timeout(100,'ticks', function () blah end)
I don't know why I never tried that, its much simpler. Is there any drawback to using the createCallback though?

When checking if a syndrome has any of a list of syn_classes you technically should be doing the O(n) algorithm with hash tables instead of the O(n^2) algorithm of all pairs comparisons, but most syndromes have few syn_classes and most commands list few syn_classes so it should be fine in practice.
Hmm, good point, it could get computationally expensive pretty quick if someone has syndromes with gigantic lists of syn_classes.

On a side note, add-syndrome is currently able to remove a syndrome based on the SYN_NAME, would it be possible to have to remove syndromes based on SYN_CLASS too? That way you could remove multiple syndromes all with different names, with the same command.

Looking at the way you use persistent variables I think there might be an easier way of doing persistent tables than I thought. Something like

Code: [Select]
local valueStr = dfhack.persistent.tableLookup(tableName,keyName)
dfhack.persistent.tableUpdate(tableName,keyName,valueStr)

In the implementation I'd have the C++ side of things cache the indices of the actual histfigs it's using so that it would get O(1) performance instead of linear performance. It would only make your code slightly cleaner but it would be much faster for looking up stored data.
That would be very awesome if you could do that, also because it would allow me to store the different text files that the classes and civilization scripts use in a persistent table, which would mean they wouldn't have to be read each time you want to do an action with them.

Still need to do no-target interactions in EventManager. I think I'll just allow it to trigger when the number of defenders isn't exactly one. It could lead to problems, so anyone who uses it would have to check whether the number of targets is appropriate or not.
I mainly work with with targeted interactions, even my interactions that are self targeted use the USAGE_HINT:ATTACK so that the combat log isn't spammed with Urist McDwarf casts Stone Skin when he is off growing plants, and is only triggered in combat. With the wrapper script this is as easy as changing !TARGET to !SOURCE. I suppose I could see it being useful to have the ability for interaction-trigger to work on a no-target system, it would definitely be useful for a multi-target system, although the wrapper script can also handle that too.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #387 on: November 09, 2014, 08:03:10 pm »

Self-targeted interactions with USAGE_HINT:ATTACK don't work at all...

Roses

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #388 on: November 10, 2014, 12:32:05 am »

Self-targeted interactions with USAGE_HINT:ATTACK don't work at all...

That's exactly why I use interaction-trigger as the work around. The unit in game targets the enemy, but the script is applied to the unit who cast it. Thus a USAGE_HINT:ATTACK self-targeted interaction of sorts.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [DFHack] Roses' Script Collection
« Reply #389 on: November 10, 2014, 12:52:17 am »

OH, yeah, I see.

...uh crap i need to go make some stuff
Pages: 1 ... 24 25 [26] 27 28 ... 42