Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 18 19 [20] 21 22 ... 42

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

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack Spells official v1.1
« Reply #285 on: July 31, 2014, 03:41:38 pm »

In that case, good luck. I am sadly not able to use it then, because things like itemsyndrome and spawnunit are not updated to dfhack r5 yet, if I am not wrong. I tried updating to r5 today, but I couldnt find any releases for these for r5.
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 Spells official v1.1
« Reply #286 on: July 31, 2014, 03:51:44 pm »

Indeed, hopefully when DFHack gets updated to the new version of DF all of the various things will be included. And hopefully by then I will have fixed all of the bugs that are bound to be creeping into my scripts as I change them over, then you can use them all fresh and new.
Logged

crossmr

  • Bay Watcher
    • View Profile
    • Jeonsa
Re: DFHack Spells official v1.1
« Reply #287 on: July 31, 2014, 07:26:40 pm »

I don't know if this is the right place to ask it, but the fixmerchants and fixdiplomats options that existed before, is there anywhere that details what the actual changes are?
I know toady fixed the elven diplomat in the new one (but only if you gen a new world) so I wondered about adding it into an existing world like you could before.

I wondered if we could do this ourselves manually while we we wait for everything else to be fixed.

Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack Spells official v1.1
« Reply #288 on: July 31, 2014, 07:27:44 pm »

I don't know if this is the right place to ask it, but the fixmerchants and fixdiplomats options that existed before, is there anywhere that details what the actual changes are?
I know toady fixed the elven diplomat in the new one (but only if you gen a new world) so I wondered about adding it into an existing world like you could before.

I wondered if we could do this ourselves manually while we we wait for everything else to be fixed.
This is the place to ask: http://www.bay12forums.com/smf/index.php?topic=139553.0
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 Spells official v1.1
« Reply #289 on: July 31, 2014, 08:07:37 pm »

Well I am pretty much done, just running tests. I added a lot of options at the last minute for further limiting spell learning and class changing.

Code: [Select]
DFHack is ready. Have a nice day!
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]# base/classes
Unit 1 killed unit 3 and earned 1 experience. Total experience is 1
Unit 1 killed unit 5 and earned 1 experience. Total experience is 2
Unit 1 killed unit 6 and earned 1 experience. Total experience is 3
[DFHack]# classes/change-class -unit 1 -class SQUIRE
Class change successful. Changed from NONE to SQUIRE.
Unit 1 killed unit 8 and earned 1 experience. Total experience is 4
Unit 1 killed unit 9 and earned 1 experience. Total experience is 5
Unit 1 killed unit 11 and earned 1 experience. Total experience is 6
Unit 1 killed unit 7 and earned 1 experience. Total experience is 7
Unit 1 killed unit 15 and earned 1 experience. Total experience is 8
Unit 1 killed unit 16 and earned 1 experience. Total experience is 9
Unit 1 killed unit 12 and earned 1 experience. Total experience is 10
Unit 1 killed unit 14 and earned 1 experience. Total experience is 11
LEVEL UP!! SQUIRE LEVEL 1
REACHED MAX LEVEL FOR CLASS SQUIRE
Unit 1 killed unit 17 and earned 1 experience. Total experience is 12
[DFHack]# classes/change-class -unit 1 -class WARRIOR
Class change successful. Changed from SQUIRE to WARRIOR.
Unit 1 killed unit 20 and earned 1 experience. Total experience is 13
Unit 1 killed unit 23 and earned 1 experience. Total experience is 14
Unit 1 killed unit 19 and earned 1 experience. Total experience is 15
Unit 1 killed unit 21 and earned 1 experience. Total experience is 16
Unit 1 killed unit 22 and earned 1 experience. Total experience is 17
Unit 1 killed unit 32 and earned 1 experience. Total experience is 18
Unit 1 killed unit 27 and earned 1 experience. Total experience is 19
Unit 1 killed unit 29 and earned 1 experience. Total experience is 20
Unit 1 killed unit 30 and earned 1 experience. Total experience is 21
LEVEL UP!! WARRIOR LEVEL 1
Unit 1 killed unit 33 and earned 1 experience. Total experience is 22
Unit 1 killed unit 28 and earned 1 experience. Total experience is 23
Unit 1 killed unit 31 and earned 1 experience. Total experience is 24
Unit 1 killed unit 25 and earned 1 experience. Total experience is 25
Unit 1 killed unit 37 and earned 1 experience. Total experience is 26
Unit 1 killed unit 26 and earned 1 experience. Total experience is 27
Unit 1 killed unit 34 and earned 1 experience. Total experience is 28
Unit 1 killed unit 24 and earned 1 experience. Total experience is 29
Unit 1 killed unit 35 and earned 1 experience. Total experience is 30
Unit 1 killed unit 36 and earned 1 experience. Total experience is 31
LEVEL UP!! WARRIOR LEVEL 2
Unit 1 killed unit 43 and earned 1 experience. Total experience is 32
Unit 1 killed unit 48 and earned 1 experience. Total experience is 33
Unit 1 killed unit 44 and earned 1 experience. Total experience is 34
Unit 1 killed unit 40 and earned 1 experience. Total experience is 35
Unit 1 killed unit 39 and earned 1 experience. Total experience is 36
Unit 1 killed unit 41 and earned 1 experience. Total experience is 37
Unit 1 killed unit 42 and earned 1 experience. Total experience is 38
Unit 1 killed unit 46 and earned 1 experience. Total experience is 39
Unit 1 killed unit 45 and earned 1 experience. Total experience is 40
Unit 1 killed unit 47 and earned 1 experience. Total experience is 41
LEVEL UP!! WARRIOR LEVEL 3
REACHED MAX LEVEL FOR CLASS WARRIOR
Unit 1 killed unit 49 and earned 1 experience. Total experience is 42
[DFHack]#
I spawned 50 dogs and had a dragon kill them all, the onUnitDeath trigger caught 42 of them, so I think it has some trouble if a unit bleeds to death or something. Maybe if I have it run more often, since the dragon kills them very fast, I am unsure.

I will be posting all of my scripts tomorrow (was hoping for tonight, but I have found a couple bugs I need to fix, and I want to put together at least a little ReadMe for the classes scripts). Overall I am pretty happy with it. I don't really notice any slow down, and it has all the functionality I want for now (I am already thinking of other things to add, but I will release before I add more). The only thing that is finicky is the persistent variables, but expwnent said he plans on expanding that system sometime in the future so that you can store more than just a string and 7 integers, I guess when that happens I will need to rewrite a lot of these scripts, but it will also be much cleaner and faster.

For those interested the final design of the classes.txt and spells.txt files you will create are

classes.txt
Code: [Select]
[CLASS:WARRIOR] -- Unique ID for each class
[NAME:warrior:warriors:warrior] -- Standard NAME:PLURAL:ADJ for the class
[LEVELS:3] -- Number of levels a class has, note that they start out at level 0
[EXP:20:30:40] -- Experience required to move from each level
[REQUIREMENT_CLASS:SQUIRE:1] -- Previous class requirement
[FORBIDDEN_CLASS:BRAWLER:0] -- Prevents you from becoming the class if you have a forbidden class at a given level
[REQUIREMENT_PHYS:STRENGTH:1500] -- Required physical attribute
[REQUIREMENT_MENT:FOCUS:1500] -- Required mental attribute
[REQUIREMENT_SKILL:SHIELD:4] -- Required skill
[REQUIREMENT_TRAIT:ANGER:50] -- Required trait
[REQUIREMENT_COUNTER:PRAY:10] -- Required counter (used with my special-counter.lua script)
[BONUS_PHYS:TOUGHNESS:0:100:200:300] -- Bonus attributes given at each level
[BONUS_MENT:WILLPOWER:0:10:20:30] -- Bonus attributes given at each level
[BONUS_SKILL:ARMOR_USER:0:1:2:3] -- Bonus skill levels given at each level
[BONUS_TRAIT:ANGER:0:5:10:15] -- Changes to traits given at each level (not really sure its useful, but I figured why not)
[AUTO_UPGRADE:KNIGHT] -- If present, will upgrade to the given class at max level
[SPELL:SPELL_TEST_1:0] -- Spells the class can learn (must be the class at the time of learning the skill)
 [SPELL_FORBIDDEN_CLASS:SQUIRE:0] -- Can't learn the spell if you have this class at this level
 [SPELL_REQUIREMENT_PHYS:STRENGTH:2000] -- Can't learn the spell if your stats are below this
 [SPELL_REQUIREMENT_MENT:FOCUS:2000]
 [SPELL_FORBIDDEN_SPELL:SPELL_TEST_2] -- Can't learn the spell if you already learned this spell
 [SPELL_UPGRADE:SPELL_TEST_3] -- If present, when learning the spell you will forget this spell
You can, of course, have multiple of all the tokens except AUTO_UPGRADE, EXP, NAME, and LEVELS.

spells.txt
Code: [Select]
[SPELL:SPELL_TEST_1]
 [CDI:INTERACTION:TEST_1]
*Any CDI tokens you want
This file isn't strictly needed, but if you set it up the python script will generate the inorganics for the syndromes to learn the spells and will make sure that all the ID's match up properly.

Both files go in your raws folder.
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack Spells official v1.1
« Reply #290 on: August 01, 2014, 04:20:04 am »

Cool!
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells R5 update (now with class system)
« Reply #291 on: August 02, 2014, 12:53:12 am »

I have uploaded all of my scripts on github (also on DFFD for those that prefer), use the Packaged_Scripts repository for a correct grouping of all the scripts. Everything is also provided in the New_Scripts repository, but the various requirements are not in the correct format (I just didn't want to delete that repository, but for all intents and purposes it should be ignored). Almost all scripts have a help section, they will be expanded on in the future.

Now I know I said I would create a readme for the class system (and really I should make a readme for all of my scripts, like my last one), but for now this will help you if you intend to use the class system.

"You will find a python script in your raw/ folder, and two extra text files, classes.txt and spells.txt in your raws/objects/ folder. Set up your classes and spells and exampled in these files and then run the python script. It will create all the reactions and inorganics you need, along with the corresponding [PERMITTED_REACTION]s and onLoad.init inputs. The only thing you need to do is modify the txt files that get created in the raw/ folder and provide your own buildings and reagents."

Now I am sure there are loads of issues with some of these scripts as I have not thoroughly tested all of them, but hopefully they are working enough for whoever is interested to try them.

NOTE: All of these scripts are to be used with the new onLoad.init system which is talked about here and can be found here. Of course, because it relies on DFHack it is not to be used with 0.40.* releases until DFHack has been updated.
« Last Edit: August 02, 2014, 12:54:54 am by Roses »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells R5 update (now with class system)
« Reply #292 on: August 02, 2014, 01:48:09 am »

So what's the syntax for assigning a specific unit a specific class? I'm going to use that for a script of my own.

AFAIK it's probably "changeclass -unit (id) -class (CLASS)", or in the case of a lua script running it dfhack.run_script('changeclass','-unit',tostring(unitid),'class',someclass)

That someclass part is gonna be a doozy.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells R5 update (now with class system)
« Reply #293 on: August 02, 2014, 12:42:56 pm »

The syntax is "classes/change-class -unit (id) -class (CLASS)"
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells R5 update (now with class system)
« Reply #294 on: August 02, 2014, 02:11:43 pm »

So what are the class inorganics gonna look like? That code is incomprehensible (ddtot etc.)...

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells R5 update (now with class system)
« Reply #295 on: August 02, 2014, 02:44:15 pm »

Hahaha, yeah, that code is pretty bad. It is a copy from some work code that has just been limping along in my repository for years and should really be scrapped and rewritten, but it works so I stay with it.

Currently two inorganics are made. The DFHACK_CLASS_SPELLS and DFHACK_CLASS_NAMES
Code: [Select]
[INORGANIC:DFHACK_CLASS_SPELLS]
[USE_MATERIAL_TEMPLATE:STONE_TEMPLATE]
[SYNDROME]
[SYN_NAME:SPELL_TEST_1]
[CE_CAN_DO_INTERACTION:START:0]
[CDI:INTERACTION:TEST_1]
[SYNDROME]
[SYN_NAME:SPELL_TEST_2]
[CE_CAN_DO_INTERACTION:START:0]
This one will just copy whatever is in your spells.txt file (my example spells.txt file is lacking all the usual CDI tags, so the inorganics it creates similarly lack them.

Code: [Select]
[INORGANIC:DFHACK_CLASS_NAMES]
[USE_MATERIAL_TEMPLATE:STONE_TEMPLATE]
[SYNDROME]
[SYN_NAME:SQUIRE]
[CE_DISPLAY_NAME:NAME:squire:squires:squire:START:0]
[SYNDROME]
[SYN_NAME:WARRIOR]
[CE_DISPLAY_NAME:NAME:warrior:warriors:warrior:START:0]
This inorganic is currently just used for changing the name of the class. It is removed and added depending on your class. You can also add any class specific syndrome information you want here.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells R5 update (now with class system)
« Reply #296 on: August 02, 2014, 03:53:38 pm »

DFHACK_CLASS_NAMES? I can most definitely work with that. Makes it so that I don't have to hardcode into the script that'll assign the classes (using your script to assign the classes--I'm not obsessed with going through two layers to do everything here, it's simply the most efficient way!)

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells R5 update (now with class system)
« Reply #297 on: August 02, 2014, 04:06:25 pm »

If there is anything you would like me to change or alter in the scripts or anything to make what you want to do easier just let me know.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells R5 update (now with class system)
« Reply #298 on: August 02, 2014, 04:08:35 pm »

Nah, my situation's unique enough that including these things would be an exercise in bloat.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells R5 update (now with class system)
« Reply #299 on: August 06, 2014, 11:59:36 am »

I hope the class system has been working alright for you. I ran a test fort for a couple years with a small sample of classes (just four). It worked alright, but I was a little dissapointed with the onUnitDeath tracking of experience. It was missing several units, and not attributing experience right if it was an interaction effect that killed the target (ranged kills were also behaving strangely). I may need to re-work the experience system a bit, and I definitely need to add a possibility for experience gain from using interactions.

My newest idea is a progressive world system. My idea for my mod is too have forts continue to be able to progress in the worlds "story". For my particular example, after enough time has passed in a fort, and the player has done certain tasks (like researching, discovering, and ultimately defeating certain things) an "event" will happen that causes things to change dramatically. Portals will begin to open to the different elemental planes, these portals (a unit) will spawn units from the corresponding elemental plane until killed. These portals will continue to spawn randomly around your fort map until the player accomplishes certain things, then another "event" will happen and the story will continue to unfold. This will allow the game to behave like it has "expansion packs", and will allow players to experience the full story, without it all being shoved down their throats at once.
Logged
Pages: 1 ... 18 19 [20] 21 22 ... 42