Bay 12 Games Forum

Please login or register.

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

Author Topic: Roses' Script, System, and Utilities Collection (Rework Underway!)  (Read 26229 times)

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (Rework Underway!)
« Reply #255 on: August 25, 2018, 03:20:16 pm »

So I've been going through everything and realized that one of the reasons it's so complicated is because I was trying to make the scripts work both inside my framework and as standalone scripts. This made things needlessly complicated so I've decided to just make all my scripts work inside my framework since without it they really don't do anything more than already published scripts do.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (Rework Underway!)
« Reply #256 on: September 05, 2018, 02:12:13 pm »

As is probably not surprising, things have been moving much slower than I had hoped. As something to help show that I am still working on it and to help illustrate what I am working on, I have decided to do a set of Feature Notes (e.g. explaining the features of the various scripts, what they do, and how they can be used). So today will be the first of a series of notes.

Tracking
Description:
Tracking is used by nearly every script that makes a change to an item, unit, or building. It stores all changes made (i.e. changing a unit's strength with unit/attribute-change) in persistent tables that last between save/reload. This allows for a number of interesting uses.

Uses:
  • The most basic use of tracking is to keep a consistent game state between save/reload (this is present in other peoples work, I know Putnam for sure, probably others as well). This is needed because the default DFHack callback isn't persistent.
  • A more interesting use of tracking is the ability to terminate changes before their typical end duration. This allows changes to be "dispelled" through a variety of methods. The currently implemented methods for termination are, Syndrome Name, Syndrome Class, and Change Type. This is done by attaching a syndrome to each change (either a real in-game syndrome or a fake syndrome that is just used for tracking purposes).
  • Another use is coupling one or more changes between units. This allows changes to be dependent on each other and can be used as another method for termination or as a
Examples:
  • If you were to use the unit/attribute-change script and set a duration of 1000 ticks for the change exiting the game at any point in that 1000 ticks would cause the attribute change to become permanent, which was not intended. Tracking keeps this information in a persistent table which is checked every time the game is loaded so that the change can be correctly reverted.
  • Let's give a unit five different attribute changes, 3 positive (+Strength, +Agility, +Toughness) and 2 negative (-Strength, -Endurance). Each syndrome has a different name, each of the positive changes has a syndrome class [BUFF], and each negative has a syndrome class [DEBUFF]. You could terminate the changes based on their individual syndrome names, by their syndrome class (get rid of just buffs or just debuffs), get rid of all attribute changes, or get rid of a specific attribute change (for example get rid of both strength changing effects).
  • In the previous example the negative attribute changes would be linked with the unit that caused the negatives. This allows us to not just terminate the negative changes but also put them back on the source unit. You could also have the source unit gain bonuses for the negative syndromes on the target unit and those would disappear if the target unit got the negative syndromes removed
Summary:
Tracking allows for increased control over the behavior, effects, and duration of changes made with scripts. It offers things akin to "dispelling", "banishing", "purging", and other typical D&D like spell interactions.
« Last Edit: September 18, 2018, 11:58:19 am by Roses »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection (Rework Underway!)
« Reply #257 on: September 19, 2018, 01:10:07 pm »

I continue to make slow but steady progress. Have gone through all the base scripts and functions. Now I need to go through the systems. Updated the previous post to show progress.

Now it is time for another Feature post. This time we are talking about the wrapper feature. I know the Examples section for these feature things are pretty poor right now. I will be adding actual usable examples in the future.

Wrapper
Description:
The wrapper script is a unique script that allows for providing other scripts with more information, better targeting, and a whole host of other things. In essence it "wraps" around other scripts to improve on their uses without needing to modify the wrapped script.

Uses:
  • Adds extra targeting options so that interactions and scripts can be tailor made for specific targets. Targeting can be done by creature, caste, civ, entity, location, syndromes, classes (creature and syndrome), age, sex, attributes, skills, traits, wounds, body parts, etc... Basically almost any information you could think of.
  • Can use formulas to pass values to other scripts. This allows you to use a single interaction/script (say unit/attribute-change) but have the actual numbers used in the script depend on a number of factors including attributes and skill on both the source and target of the interactions.
  • Can also modify are enhance a script in other ways. You can make single interactions target multiple units in a radius about the target. You can have interactions chain from one target to another. You can have interactions reflect back on the source. And more.
Examples:
  • Suppose you want to make an interaction that is only usable in combat but only targets a friendly unit. You would create an offensive interaction, use modtools/interaction-trigger to cause the wrapper script to trigger, and then set the targeting options to a certain distance away from the source and require a member of the same civ as the source.
  • If you want to create an interaction that increases a targets toughness but want to make the increase relative to the sources willpower you can use the wrapper script to create a formula that checks the sources willpower and calculates a number for the unit/attribute-change function to alter the targets toughness.
  • If you want a script to target multiple units but don't want to modify the script itself you can change the max number of targetable units with the wrapper function. It will then randomly select up to that number (depending on the other targeting options used) and apply the script to each of them.
Summary:
By using the wrapper script with the modtools/interaction-trigger script (or any other trigger script) you can dramatically increase the options for both targeting and effects of scripts without having to modify the scripts themselves.
Logged
Pages: 1 ... 16 17 [18]