• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Help with scripts

fierop

Member
This is a cross-post of a thread I have going in the HL - Authoring Kit Forum and it was suggested I put it here for other's benefit as well.

Here is my circumstance. I am adding some custom equipment based on some information I tracked down out on the Internet. The pieces of equipment in question are Cybernetic Augmentations. I have added all these Augmentations as pieces of equipment.

I want to add an Augmentation which requires two other pieces of equipment before being allowed. Upon satisfying the pre-requisites then the user would gain a trait at a specific die value.

So, I want to add Tactical Analysis System which imbues the user with the Danger Sense trait at d4. But in order to get the augmentation the player character must already have "Mindset Rank 1" and "Cybernetic Eye(s)".

Can anyone help me with this script? I am still trying to track down documentation on script syntax and if I can get this one I may be able to figure out how to do it for some of the other objects I have.

Thanks in advance for your assistance in this matter.

PFiero
 
I'm presuming that "Mindset rank 1" and Mindset rank 2" are different pieces of equipment.

What happens if this augmentation is taken without the presence of the other two augmentations? Is that allowed, but you don't get Danger Sense, or should there be a warning if that happens?

Well, Cybernetic eye is easy to test for. In the editor, go to the Pick-reqs button. Add a new pick-req, and select cybernetic eye from that list.

Presuming that mindset rank 1 has a unique ID of "eqCyMinds1" (equipment - cyberware - mindset - 1), here's a pre-req script to test for mindset rank 1 or 2 or 3:

Code:
if (hero.childlives[eqCyMinds1] + hero.childlives[eqCyMinds2] + hero.childlives[eqCyMinds3] <> 0) then
@valid = 1
endif

If any of those items have been added to the hero, then hero.childlives[the item's ID] will equal 1. If it's not present, it equals 0. So, adding all those together, and seeing if the sum is not 0 will tell you whether you have one or more mindset things on the character. Replace the unique IDs in my sample script with whatever IDs you gave your mindset items.

If you're allowed to purchase the various pieces of equipment, independant of each other, but you only get the asset if all three are present, that's a bit more complex - say so if that's the case and I'll guide you through that.
 
Here are some screen caps

the error
herolab_error1.png


and the two scripts I've got in the pre-req section.
herolab_pre-req1.png


and

herolab_pre-req2.png
 
You defined the Mindset and Cybereye pieces of equipment and tested them before creating this thing, right? You've verified that those Ids are correct?

The fact that it gave an error on the full cyber-eyes, and not the cyber-eye, is suspicious - it should have stopped compiling and reported an error with the first thing that was wrong, if there was something wrong with the script in general.
 
Okay, well apparently I'm a dork.

I forgot I had been piddling with another Item and Pre-Requisites. I also discovered that the Full Cybernetic Eyes error was a victim of me being said dork and typo'ing the id.

Now off to do the bootstrap to make acquiring the equipment give me the Danger Sense trait.
 
Alright....Looks like I have things working.

Mathias thank you for the assistance.

I am planning on working on a whole slew of objects for the Cortex system an I'm certain I will have some more questions.
 
The Beastman Asset grants Danger Sense, so I'd suggest opening a copy of Beastman within the assets tab of the editor. There, you'll see that the "Bootstraps" button on the top right is highlighted, and says that there are 8 bootstraps. Press that button, and you can see how Danger Sense is added. Now for the complex part - making this copy of Danger Sense cost 0 trait points.

Press the "Tags" button associated with Danger Sense, and you'll see that two tags are added: "Die.0" and "FreeDie.2". Die.0 means add the option for that asset to go to d0. What that means: let's say you wanted to play a Bestman who was unusually unaware compared to his kin. So, you might purchase the Bestman package, and then switch the level of Danger Sense to d0 - that will recover the trait point cost for Danger Sense and grey out Danger Sense. Since your cybernetics aren't going to include the option to buy off the assets they grant, you don't need to include the Die.0 tag.

The FreeDie.2 tag means to reduce the cost of the trait by 2 (remember from reading the editor manual - Traits in Cortex are stored as half the value, so FreeDie.2 means that the d4 level of Danger Sense is free).

For future reference, also take a look at the Fields button for Enhanced Senses or Inherent Weapons - that's how to pre-fill the text box for a free trait.

Don't forget to delete the copy of Beastman you just added, or you'll encounter errors next time you try to compile the files.
 
OK, yet another question.

How can I do pre-reqs for increasing reqs within the same trait.

For example:
I have a trait called Data Storage & Access.
@ d2-d4 it requires Mindset Rank 1
@d6-d10 it requires Mindset Rank 2
@ d12 it requires Mindset Rank 3

Is it just a matter of multiple if statements? If so how do you check the die level AND the trait name?
 
It is a matter of multiple if statements.

As a prereq, write a requirement for any one of the mindset ranks - just like you did for your other piece of cyberware. When you're still in the list, selecting the trait, you don't know what the trait's level will be, so you can't test that yet.

Once that's done, add an eval rule, as well. Eval rules have all of the functions of an eval script, but they also have the validation requirements that prereqs have. Timing: Validation / 5000 - Put Eval rules at that time unless you have a specific reason not to.

Code:
~first, if we're a d12 trait
if (field[trtFinal].value >= 6) then
  ~that requires mindset 3
  validif (hero.childlives[cybMndSet3] <> 0)
 
~if not that, check if we have a d6 - d10 trait
elseif (field[trtFinal].value >= 3) then
  ~that requires mindset 2 or 3
  validif (rank 2 or rank 3)
 
~if we have a lower trait value than that
else
  ~we need any level of the mindset
  validif (rank 1 or rank 2 or rank 3)
  endif

Note that I didn't write out the full code for the tests - don't forget to finish that up when you copy this to your trait.

BTW, validif ( ) is the same as:

if ( ) then
@valid = 1
done
endif

Saves a bit of typing when writing prereqs.
 
Awesome.

Thanks again for the assistance.

I am getting quite a bit accomplished with this and I believe it will make for a more satisfying experience for my gamers. There are about 6 of us in our group and we all own Hero Lab. It has made character creation less of a chore and gives the GM the ability to view the various PC's sheets without having to decipher each player's notes.

Job well done.
 
Okay...more help...please?

I now have a Trait....Dermal Plating. It is available, say, from d4 - d8...so a total of three die steps.

At d4 the PC gets Inherent Armor at d4
At d6 the PC gets Inherent Armor at d6
and finally a d8 the PC gets Inherent Armor at d8.

I have bootstrap set up to assign asInhAr at d4 and FreeDie 2. No problem. So how can I get each die level assigned its equivalent bootstrap settings?

:o)

PFiero
 
For Dermal plating - is it just Inherent armor, renamed, or does it have other things? If it is just a renaming, why bother bootstrapping it?

Having one thing control the free level of another thing during play wasn't something I was able to work out - the free cost needs to be incorporated into the trait rating before the trait rating is finalized, but you can't assign the free cost to the inherent armor until the trait rating of dermal plating is finalized.

You'll need three separate assets for dermal plating d4, d6, and d8. To see how I've done that sort of thing elsewhere, check the three versions of the Animate trait from Demon Hunters - they should be near the top of the assets list.
 
Any tips on how to bootstrap an Attribute Step for improving an Attribute when a Trait is added?

The animate asset is again where you're going to start. The first question is, do you consider this bonus to be a permanent bonus, affecting the XP cost for the trait, or is it an in-play bonus, added after everything else? I'll be writing the sample code as if it's an in-play bonus. Replace the trtInPlay references with trtBonus to switch it to a permanent bonus.

In the second eval script for animate d12, you'll find this:

Code:
      ~add our trait rating to our strength
      hero.child[attrStr].field[trtArray].arrayvalue[field[trtBonus].value] +=1

Since you want an in-play attribute step, rather than an additional die, use field[trtInPlay] instead of field[trtArray].

Code:
~+1 strength step:
hero.child[attrStr].field[trtInPlay].value += 1

Use the same timing as the script on the Animate asset, Traits/5000.
 
I kind of went with the Dermal Plating "ranks" if you will. There just didn't seem to be a good way to do what I was thinking.

As for the Attribute step I will dig into the Animate script to see what I can figure out.

What I had been doing was using bootstrap to adjust adjAttr. Why are you using trtInPlay? What is the difference between them?

Sorry if I don't seem to be getting this but I am having some difficulties determining which contexts to use when.

Thanks.

PFiero
 
Could you tell me more about how Dermal Plating works, or just copy its description from whatever source you got it from?

What is adjAttr? There isn't an adjAttr field.

Could you elaborate on what sort of context problems you're having?
 
Dermal plating basically fit into the category you mentioned earlier in that it is just a form of Inherent Armor. I set it up as various levels so that issue is resolved.

I got the Attribute adjustment working as well by using the script sample you posted. That is for a Bio-Tech Augmentation that offers enhancements to the various attributes.

The context issues I think has to do with me trying to do things with the In-Play adjustments piece of HL and right clicking on various fields. I don't recall where I found it earlier. What I'm referring to for the most part is finding, for instance, what field or object to use when writing a script. A current example is as follows: I have a Bio-Tech base matrix that is set up as a Top Holder. When players purchase a Bio-Tech object, for example Adrenaline Pump. The pre-req for that is the Bio-Tech base matrix and I have that set up. But I also want the Adrenaline Pump to be automatically held by the base matrix. So, how would I find the field in the Adrenaline Pump that would define what holds it or if it even being held? The .pdf document I have indicates that there is a holdlimit tag expression that allows you to define what object can hold another. I don't know how to find out what fields or object IDs would be used in that kind of script.

This may seem a bit expansive but I'm finding it hard to do anything but duplicate existing scripts because there is no real map showing how things relate and though the .pdf document describes what some scripts do it doesn't give any real examples of how to use them. Sorry but I want to do so much with HL and I think some of the things I want to do are possible but just out of my reach and I hate to bog you down with all these questions.

PFiero
 
I'm afraid that it would take quite a long time to do a thorough map of everything in the data files. We have numerous data files, and only three programmers. I'm responsible for the d20, Pathfinder, Cortex, and Call of Cthulhu games in Hero Lab. Rob and Colen each have their Hero Lab games, plus improving the core program, plus working on Army Builder and Card Vault.

If we were to take the time to properly describe every piece of the data files and every option someone could make use of, it would take a considerable chunk of time that we've decided could be better used adding more content and new game systems.

So, rather than answering every possible question in documentation, we help people through the specific problems they're having on this forum. Searching through the forums becomes a form of documentation, since a person can look up the answers we gave the previous person. Also, most existing things in the files can be opened in the editor and studied there, so if you can think of something that already exists that does something similar to what you want to do, you can look at it, to see how it does that task.

Sorry for the digression. In answer to your specific question, the holding mechanism is only accessible to users while editing a character. You can't set up a piece of gear to automatically be held. The holdlimit script restricts the type of things that can be held. For example, if you added a new gear category for your bio-tech, and placed all your biotech in that category, then add a piece of that gear to your hero, look at its tags, and figure out which one represents that category (I think it would be something like GearCat.BioTech), you'd put "GearCat.BioTech" in the holdlimit for your base matrix. That way, the user can't accidently move their pistol into the base matrix.

Unless there can be multiple base matrixes (and it matters which matrix an item is in), why even bother with the container mechanisms? If all biotech must go in the base matrix, why not assume that it's already there once added to the character, and skip the step of containing it?
 
Point taken for the container mechanism. I think I was trying to find a way to restrict quantities of objects but am seeing that some things are just better left up the human to deal with. No worries.

I am seeing a bit more clearly where cost versus return can be an issue with putting together a "data dictionary" for each system.

I have tried to do some digging into various existing objects to see what those scripts and items look like. There is just a lot of them and not knowing exactly which ones do what makes it a daunting task to find one with examples. I may look at putting together a list of the various items, traits, and skills to see if I can establish a list of which ones have things like pre-req scripts, eval scripts, and so forth.

I just kinda felt like I was taking away from your time in having you answer questions that may be fairly basic but I think I've got a better clue now.

I'll continue to post here.

Thanks.

PJ
 
Back
Top