Bay 12 Games Forum

Please login or register.

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

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

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells official v1.1
« Reply #270 on: July 25, 2014, 03:29:08 pm »

So I am not really sure where to post this, but I have begun working on a class system using persistent variables and kill counts. Basically you get skill points to use on spells that are available to you and class points that are let you train your class. I am planning on making it fairly modular so that other modders can modify it how they please, but to give you an example, my mod will have the classes set up something like this.

Spoiler (click to show/hide)

EDIT: Actually, I decided to take it a step further and add experience points to each creature. Namely you will need to put [CREATURE_CLASS:EXPERIENCE_X] where x is a given number. It will naturally default to 1 so if you don't put any of these tokens in any creatures it will work the same as a kill count, but it will allow you to configure mega beasts and such to be worth more. You can then set a configurable amount of experience for each skill point and class point, and then have a configurable amount of class points per class advancement and skill points per skill learned.
« Last Edit: July 25, 2014, 09:33:54 pm by Roses »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells official v1.1
« Reply #271 on: July 28, 2014, 04:26:19 pm »

So I have got the class system mostly working, I still want to add some extras (like attribute requirements for certain classes), and I need to test out the experience earning system to make sure it is all working, but to give you a little example, here is my DFHack screen showing allowed and unallowed class changes.

Code: [Select]
[DFHack]# spells/test 0 WARRIOR
Class requirements not met. SQUIRE level 1 needed. Current level is 0
[DFHack]# spells/test 0 KNIGHT
Class requirements not met. WARRIOR level 3 needed. Current level is 0
[DFHack]# spells/test 0 JUGGERNAUT
Class requirements not met. KNIGHT level 3 needed. Current level is 0
[DFHack]# spells/test 0 CLERIC
Class requirements not met. ACOLYTE level 1 needed. Current level is 0
[DFHack]# spells/test 0 PRIEST
Class requirements not met. CLERIC level 3 needed. Current level is 0
[DFHack]# spells/test 0 BISHOP
Class requirements not met. PRIEST level 3 needed. Current level is 0
[DFHack]# spells/test 0 PALADIN
Class requirements not met. KNIGHT level 2 needed. Current level is 0
Class requirements not met. PRIEST level 1 needed. Current level is 0
[DFHack]# spells/test 0 SQUIRE
Already this class
[DFHack]# spells/test 0 ACOLYTE
Class change successful. Changed from SQUIRE to ACOLYTE.
[DFHack]#

Now you might be wondering how the game knows about all your classes and such, well it is really simple! All you need is a file like this;
Code: [Select]
[CLASS:SQUIRE]
[NAME:squire]
[EXP:1000]
[LEVELS:1]

[CLASS:WARRIOR]
[NAME:warrior]
[EXP:2000:5000:8000]
[LEVELS:3]
[REQUIREMENT_CLASS:SQUIRE:1]
[AUTO_UPGRADE:KNIGHT]

[CLASS:KNIGHT]
[NAME:knight]
[EXP:12000:16000:20000]
[LEVELS:3]
[REQUIREMENT_CLASS:WARRIOR:3]
[AUTO_UPGRADE:JUGGERNAUT]

[CLASS:JUGGERNAUT]
[NAME:juggernaut]
[EXP:25000:30000:35000]
[LEVELS:3]
[REQUIREMENT_CLASS:KNIGHT:3]

[CLASS:ACOLYTE]
[NAME:acolyte]
[EXP:1000]
[LEVELS:1]

[CLASS:CLERIC]
[NAME:cleric]
[EXP:2000:5000:8000]
[LEVELS:3]
[REQUIREMENT_CLASS:ACOLYTE:1]
[AUTO_UPGRADE:PRIEST]

[CLASS:PRIEST]
[NAME:priest]
[EXP:12000:16000:20000]
[LEVELS:3]
[REQUIREMENT_CLASS:CLERIC:3]
[AUTO_UPGRADE:BISHOP]

[CLASS:BISHOP]
[NAME:bishop]
[EXP:25000:30000:35000]
[LEVELS:3]
[REQUIREMENT_CLASS:PRIEST:3]

[CLASS:PALADIN]
[NAME:paladin]
[EXP:5000:10000:15000]
[LEVELS:3]
[REQUIREMENT_CLASS:KNIGHT:2]
[REQUIREMENT_CLASS:PRIEST:1]

This tells the game how the name of the class, how many levels the class has, how much experience it takes to upgrade to the next level of the class, the requirements needed for the class, and if it is eligible for an automatic upgrade (this is basically just saying that a knight is basically a level 4 warrior, but it has a different name).

Additions I have planned for the classes are
[REQUIRED_PHYS:PHYSICAL_ATTR:#] - a certain level of physical attributes is needed
[REQUIRED_MENT:MENTAL_ATTR:#] - a certain level of mental attributes is needed
[BONUS_PHYS:PHYSICAL_ATTR:#] - gives a bonus to a physical attribute for being this class
[BONUS_MENT:MENTAL_ATTR:#] - gives a bonus to a mental attribute for being this class
[SPELLS:INTERACTION_ID:#] - allows for interactions to be learned based on the level of the class

Now unfortunately this current system requires an inorganic with certain syndromes, and some other things, but don't worry I am also working on a python script that will simply read your class file and create all necessary items!
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells official v1.1
« Reply #272 on: July 28, 2014, 08:50:14 pm »

The classes can now have the following

Code: [Select]
[CLASS:KNIGHT] <- unique ID, must be different for each class
[NAME:knight] <- name of class, will appear in game as CE_DISPLAY_NAME
[LEVELS:3] <- number of levels in the class
[EXP:12000:16000:20000] <- experience amounts for each level
[REQUIREMENT_CLASS:WARRIOR:3] <- class requirements
[REQUIREMENT_PHYS:STRENGTH:1800] <- physical attribute requirements
[REQUIREMENT_PHYS:TOUGHNESS:1800]
[REQUIREMENT_MENT:WILLPOWER:1500] <- mental attribute requirements
[BONUS_PHYS:ENDURANCE:200] <- physical attribute bonus from the class
[BONUS_MENT:FOCUS:100] <- mental attribute bonus from the class
[SPELL:SHIELD_BLOCK:0] <- levels at which interactions can be learned, will not allow you to learn an interaction which you don't meet the level requirements for
[SPELL:SHIELD_BASH:0]
[SPELL:PARRY:0]
[SPELL:BATTLE_CRY:1]
[SPELL:CHARGE:1]
[SPELL:LEADERSHIP:2]
[SPELL:SHIELD_WALL:3]
[AUTO_UPGRADE:JUGGERNAUT] <- if present will change class to listed class at max level

My python script currently will create all required reactions, inorganics, and DFHack command lines (using the new system talked about here). You will still have to manually alter the reactions for the building you want and the reagents you want the class change to require, the inorganics will also need you to add the correct CDI tokens, but other than those two things it will all be self contained.

I am also considering making class specific weapons and armor, but that might be a bigger project than I realize.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells official v1.1
« Reply #273 on: July 29, 2014, 03:55:33 pm »

Success!

Code: [Select]
Unit 2 killed unit 56 and earned 1 experience. Total experience is 42
Unit 2 killed unit 59 and earned 1 experience. Total experience is 43
Unit 2 killed unit 60 and earned 1 experience. Total experience is 44
Unit 2 killed unit 58 and earned 1 experience. Total experience is 45
Unit 2 killed unit 62 and earned 1 experience. Total experience is 46
Unit 2 killed unit 63 and earned 1 experience. Total experience is 47
Unit 2 killed unit 55 and earned 1 experience. Total experience is 48
Unit 2 killed unit 61 and earned 1 experience. Total experience is 49
Unit 2 killed unit 57 and earned 1 experience. Total experience is 50
Unit 2 killed unit 1 and earned 1 experience. Total experience is 51
LEVEL UP!! SQUIRE LEVEL 1
REACHED MAX LEVEL FOR CLASS SQUIRE

Class system is up and running. Just want to make one more addition before I post it, right now you only get experience from the killing blow, but that means your healers and tanks aren't going to be getting much experience, so I am planning on adding experience gains from skill usage (if I can) or possibly area experience, where all friendly units around the killing unit will share in the experience gained.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells official v1.1
« Reply #274 on: July 29, 2014, 08:03:01 pm »

And thus did I start converting my ungodly 1,200 kilobyte file in Fortbent that relies on DFHack anyway to your class system.

EDIT: Oh boy, I'm making a python script to make raws that are going to be read by your python script. We've gone full meta.

EDIT 2: How about bonus ment/phys attributes per level?
« Last Edit: July 29, 2014, 08:11:25 pm by Putnam »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells official v1.1
« Reply #275 on: July 29, 2014, 08:50:09 pm »

And thus did I start converting my ungodly 1,200 kilobyte file in Fortbent that relies on DFHack anyway to your class system.

EDIT: Oh boy, I'm making a python script to make raws that are going to be read by your python script. We've gone full meta.

EDIT 2: How about bonus ment/phys attributes per level?

Haha, well right now my python script outputs 4 different files, a reaction file, an inorganic file, a dfhack file that needs to be copied into onLoad.init and a permitted reactions file that needs to be copied into the entity you would like.

Reactions look like (there are currently two, one for the class names and one for the spell learning)
Code: [Select]
[REACTION:CHANGE_CLASS_WARRIOR]
[NAME:change class - warrior]
[BUILDING:TEST_1:NONE]
And inorganics look like
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]
[SYNDROME]
[SYN_NAME:KNIGHT]
[CE_DISPLAY_NAME:NAME:knight:knights:knight:START:0]
[SYNDROME]
[SYN_NAME:JUGGERNAUT]
[CE_DISPLAY_NAME:NAME:juggernaut:juggernauts:juggernaut:START:0]
[SYNDROME]
[SYN_NAME:ACOLYTE]
[CE_DISPLAY_NAME:NAME:acolyte:acolytes:acolyte:START:0]
[SYNDROME]
[SYN_NAME:CLERIC]
[CE_DISPLAY_NAME:NAME:cleric:clerics:cleric:START:0]
[SYNDROME]
[SYN_NAME:PRIEST]
[CE_DISPLAY_NAME:NAME:priest:priests:priest:START:0]
[SYNDROME]
[SYN_NAME:BISHOP]
[CE_DISPLAY_NAME:NAME:bishop:bishops:bishop:START:0]
[SYNDROME]
[SYN_NAME:PALADIN]
[CE_DISPLAY_NAME:NAME:paladin:paladins:paladin:START:0]

Thats a good idea about bonus attributes per level, I will change the input to be [BONUS_PHYS:STRENGTH:#:#:#] (or however many levels the class has)
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells official v1.1
« Reply #276 on: July 29, 2014, 08:58:21 pm »

How's the experience gain going to look like? Your examples have numbers like 12,000 but that suggests 12,000 kills being required...

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells official v1.1
« Reply #277 on: July 29, 2014, 09:22:29 pm »

Ah, no the experience gain is configurable, by default each creature gives 1 experience. But if you give them [CREATURE_CLASS:EXPERIENCE_100] then they will instead give 100 experience. This means that without touching any of the creatures raws the "experience" is basically a kill count and you should adjust your classes for that, but if you are willing to go in and alter creatures to add the creature class then they can give as much or as little experience as you would like (theoretically you could even give a creature negative experience by using [CREATURE_CLASS:EXPERIENCE_-100], but I don't actually know if my script would have trouble with that).

I just ran a test for with low experience counts for all the classes and used a hunter to go around and kill wildlife. It all worked well, except there is a difficulty in using persistent variables that causes the first class change to fail, I will have to find a way to remedy that.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells official v1.1
« Reply #278 on: July 29, 2014, 10:59:11 pm »

Uh... so how about giving material emission interactions?

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells official v1.1
« Reply #279 on: July 30, 2014, 02:58:51 am »

Another good suggestions, forgot about those completely... Let's see, I will have to think about that, but it shouldn't be too hard.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells official v1.1
« Reply #280 on: July 30, 2014, 11:02:09 am »

Four new additions

1. Bonuses are now tracked per level [BONUS_PHYS:STRENGTH:100:150:200] (bonuses can also now be negative)
2. An additional requirement is now possible, [REQUIREMENT_COUNTER:COUNTER_ID:#]. This is to be used with my counter script. It means you can require a unit to perform a reaction or interaction (or anything that triggers a script) X number of times before they can use that class.
3. Spells now work differently. You put them in your class file like
Code: [Select]
[SPELL:SPELL_TEST_1:0]
 [CDI:INTERACTION:TEST_1]
 [CDI:ADV_NAME:test 1]
 [CDI:TARGET:C:LINE_OF_SIGHT]
 [CDI:TARGET_RANGE:C:10]
 [CDI:USAGE_HINT:ATTACK]
 [CDI:MAX_TARGET_NUMBER:C:1]
 [CDI:VERB:casts test 1:test 1 cast:tested 1]
 [CDI:WAIT_PERIOD:1000]
This will allow for material emission interactions, and configurable CDI's for different classes. The X in SPELL:X:# only needs to be unique in a given class, they can be re-used in seperate classes.
Note that my python script will now take the CDI's directly from the classes.txt file and output nice inorganics
Code: [Select]
[INORGANIC:DFHACK_CLASS_SPELLS]
[USE_MATERIAL_TEMPLATE:STONE_TEMPLATE]
[SYNDROME]
[SYN_NAME:WARRIOR_SPELL_TEST_1]
[CE_CAN_DO_INTERACTION:START:0]
[CDI:INTERACTION:TEST_1]
[CDI:ADV_NAME:test 1]
[CDI:TARGET:C:LINE_OF_SIGHT]
[CDI:TARGET_RANGE:C:10]
[CDI:USAGE_HINT:ATTACK]
[CDI:MAX_TARGET_NUMBER:C:1]
[CDI:VERB:casts test 1:test 1 cast:tested 1]
[CDI:WAIT_PERIOD:1000]
4. Spells can now have AUTO instead of a number (remember the number specifies the level at which a class can learn the spell). If the spell has SPELL:X:AUTO then the skill will be learned as soon as the unit becomes that class.

EDIT: I am also thinking about different bonuses the classes could provide. Right now anything that can be done via syndrome is easy enough (just add it to the syndrome for the class), but there might be other changes that are better suited to be done in DFHack than in the syndrome system.

EDIT2: And now I am thinking of changing the way spells are handled again. The system as it stands now works, but doesn't allow for customization and additional features for spells. The new system I am thinking about would have options for things like spell upgrades (i.e. instead of learning firebreath and dragonfire, upgrade firebreath to dragonfire), spell requirements (i.e. REQUIREMENT_PHYS, etc...), and forbidden things (i.e. can't learn this spell if you know that spell or have levels in that class). Unfortunately this new way would require an extra file, which means more complexity for the user. I'm not sure. What do you think?
« Last Edit: July 30, 2014, 04:47:54 pm by Roses »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells official v1.1
« Reply #281 on: July 31, 2014, 02:22:32 pm »

If bonus attributes use syndromes, they shouldn't. That's one DFHack thing. Skills, too.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells official v1.1
« Reply #282 on: July 31, 2014, 02:55:49 pm »

Nope, bonus attributes use DFHack, bonus skills is another thing I can do (could also do required skills)
Logged

Meph

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

Roses, just wanted to say thank you again for that upgradeBuilding script.

Here the finished result for the human buildings I made with it. Thats all buildings they have access to, and most of them do use your script. Wouldnt have been possible without you.

http://i.imgur.com/it1ddOK.jpg (I havent finished the captions/text yet)

PS:
Success!

Code: [Select]
Unit 2 killed unit 56 and earned 1 experience. Total experience is 42
Unit 2 killed unit 59 and earned 1 experience. Total experience is 43
Unit 2 killed unit 60 and earned 1 experience. Total experience is 44
Unit 2 killed unit 58 and earned 1 experience. Total experience is 45
Unit 2 killed unit 62 and earned 1 experience. Total experience is 46
Unit 2 killed unit 63 and earned 1 experience. Total experience is 47
Unit 2 killed unit 55 and earned 1 experience. Total experience is 48
Unit 2 killed unit 61 and earned 1 experience. Total experience is 49
Unit 2 killed unit 57 and earned 1 experience. Total experience is 50
Unit 2 killed unit 1 and earned 1 experience. Total experience is 51
LEVEL UP!! SQUIRE LEVEL 1
REACHED MAX LEVEL FOR CLASS SQUIRE

Class system is up and running. Just want to make one more addition before I post it, right now you only get experience from the killing blow, but that means your healers and tanks aren't going to be getting much experience, so I am planning on adding experience gains from skill usage (if I can) or possibly area experience, where all friendly units around the killing unit will share in the experience gained.
When you post this, I will certainly use it as well. :D Any ETA?
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 #284 on: July 31, 2014, 03:39:17 pm »

Well its almost done, but it is set up for the new version of DFHack that uses the different system. Luckily my python script will handle that all for you so you just need to modify the reactions it creates (add reagents and such). And make sure the "spells" you specify match interactions that you have created. I am actually hoping to get it, along with all of my scripts which have been updated for the new system, out by the end of the day.
Logged
Pages: 1 ... 17 18 [19] 20 21 ... 42