• 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

Authoring Example help

Here's how I dealt with this issue in Shadowrun:

(You can ignore the parts about trtOver and trtReplace - that's needed in Shadowrun to deal with spirit possession, which overrides some of your normal attributes)

All the code from Calc trtFinal is basically repeated in the trtFinal procedure that each of these calls.

Code:
<!-- We need a second calculation pass for trtFinal so that things that
depend on the first Calc trtFinal can apply their effects, and then
those effects are incorporated into trtFinal by this script -->
<eval index="4" phase="Traits" priority="6000" name="Calc trtFinal #2">
<after name="Calc trtFinal"/>
<after name="Calc grRating"/><![CDATA[
var normalval as number
var replaceval as number
var overval as number
 
call trtFinal
 
if (field[trtOver].value >= 0) then
field[trtFinal].value = overval
elseif (field[trtReplace].value >= 0) then
field[trtFinal].value = maximum(normalval, replaceval)
else
field[trtFinal].value = normalval
endif
]]></eval>
 
<!-- And a third calculation pass for trtFinal so that things that
depend on the second Calc trtFinal can apply their effects, and then
those effects are incorporated into trtFinal by this script -->
<eval index="5" phase="Traits" priority="8000" name="Calc trtFinal #3">
<after name="Calc trtFinal #2"/><![CDATA[
var normalval as number
var replaceval as number
var overval as number
 
call trtFinal
 
if (field[trtOver].value >= 0) then
field[trtFinal].value = overval
elseif (field[trtReplace].value >= 0) then
field[trtFinal].value = maximum(normalval, replaceval)
else
field[trtFinal].value = normalval
endif
]]></eval>
 
<!-- And a fourth calculation pass for trtFinal so that things that
depend on the third Calc trtFinal can apply their effects, and then
those effects are incorporated into trtFinal by this script -->
<eval index="6" phase="Traits" priority="10000" name="Calc trtFinal Final">
<after name="Calc trtFinal #3"/><![CDATA[
var normalval as number
var replaceval as number
var overval as number
 
call trtFinal
if (field[trtOver].value >= 0) then
field[trtFinal].value = overval
 
~since this is the final time we'll calculate trtFinal, we also want to
~tag those things that ended up needing to use the replacement value
if (field[trtOver].value <> normalval) then
perform assign[Helper.ValReplace]
endif
elseif (field[trtReplace].value >= 0) then
field[trtFinal].value = maximum(normalval, replaceval)
 
~since this is the final time we'll calculate trtFinal, we also want to
~tag those things that ended up needing to use the replacement value
if (replaceval > normalval) then
perform assign[Helper.ValReplace]
endif
else
field[trtFinal].value = normalval
endif
]]></eval>
 
Here's the only line of the trtFinal procedure that's really relevant to what you're doing - the rest is related to calculating replaceval and overval, and several shadowrun-specific things.

Code:
normalval = field[trtUser].value + field[trtBase].value + field[trtBonus].value + field[trtInPlay].value + field[trtAugment].value + field[trtMagic].value
 
What you'll do for the incrementers is to disable them during advancement mode, not hide them, but the first priority is to get the mechanics working - user interface can come later.

How do I do this? I'm asking because I think it's easy and you will know off the top of your head. If not, point me in the direction of where to look!

Thanks!

edg
 
#situational requires several hundred lines of code, spread all over the files. I'm sorry, but I don't have enough time right now to find and copy them all.
 
How do I do this? I'm asking because I think it's easy and you will know off the top of your head. If not, point me in the direction of where to look!

Thanks!

edg

From the position script in tab_advance:

Code:
~freeze all modifiable portals in creation mode
~Note: All freezing must be done *before* any positioning is performed.
if (state.iscreate <> 0) then
  portal[delete].freeze = 1
  portal[edit].freeze = 1
  endif
 
Thanks for the quick replies!

regards @#situation - No problem. I figured it was big!

Thanks for the other items!

Can pickreq have an OR condition? In other words, if they have X OR Y, they can have a thing?

Again, you are awesome, Mathias! Thanks for all of your help!

edg
 
Pickreqs can't have OR - use an exprreq for that instead:

hero.childlives[XXXXX] + hero.childlives[YYYYY] <> 0

I actually never used pickreqs in Shadowrun, Cortex, or Call of Cthulhu. I always used exprreqs or prereqs, becuase I was always generating identity tags and testing for them. That way, you can have things that get disabled, and if they're disabled, you don't forward the "we're here" identity tag to the hero, and any exprreqs looking for that item fail. With a pickreq, you can only test for its presence. You can't test for its current status.
 
The advancement mechanisms in the skeleton files are what you want to use for this advancement system - just rename XP to skill points, and do keep it separate from the pool of skill points used during character creation.

Leave your advancements as increases to trtBonus, not trtUser. Stick with the way the skeleton files handled it.

(the exception is if your game system wants to check things like "land vehicle operation 3+ required", and you want to test rating during creation + rating from advancements, without adding any rating bonuses that came from race/profession/perks/etc. - then, you'll need to create a pair of new fields - tell me if this is something you need to set up).

Okay, I'm getting into advancement and getting errors.

I'm mostly using the skeleton files structure. So, there are four choices for advancements: Gain New Ability, Gain New Skill, Increase Skill, Increase Attribute. From a functional standpoint, they all work. If I select "Increase Attribute" it only shows me non maxed attributes and increases the selected one by one.

The problem I'm having is costs. As you suggested above, I kept what existed but renamed it xp. If I go to the journal and add xp, that works just fine. Further, I have defined abilities and in those abilities, I have set up xpCosts and they work just fine.

For example:

Code:
	<thing
    id="abexAC1"
    name="First Action Check Increase"
    compset="Ability"
    isunique="yes"
    description="First action check increase">
	<fieldval field="xpCost" value="4"/>
	
	<!-- handle costs for different professions -->
	<eval value="1" phase="Traits" priority="5000"><![CDATA[
	  if (hero.tagis[Profession.FreeAgent] <> 0) then
		field[xpCost].value = 3
	  endif
	  ]]></eval>
		  
    <!-- Define any script needed to apply changes to other traits -->
    <eval value="2" phase="Traits" priority="8000"><![CDATA[
	  ~if we haven't been activated, just get out (only needed for user-activated abilities)
	  ~doneif (field[abilActive].value = 0)
	  
      ~apply whatever adjustment(s) are needed here
	  if (container.ishero <> 0) then
		#traitbonus[trAC] += 1
	  endif
      ]]></eval>
	  
    </thing>

That works just fine. All of my abilities like this work. They use xp and don't take from skill points.

However, when I select a new Skill or advance a skill, it doesn't cost me xp. It doesn't seem to add to starting skill points used. When I increase an attribute, though, it doesn't cost xp and it increases starting attribute points.

One of my issues at the moment is that I don't see how to set the cost of the advances, except abilities which I defined as above. I assume the other advances are using stuff behind the scenes and I don't know how to override them for the different costs.

Let me know where I wasn't clear!

Thanks!

edg
 
Sorry, let me get back to you on this next week. This week has been very busy with a Pathfinder update.
 
Sorry, let me get back to you on this next week. This week has been very busy with a Pathfinder update.

I wondered about that. Sorry. It can wait. I just got excited with all of the things I have implemented this past week!

I hope the release goes well!

edg
 
In the skeleton files, this is the script that adds the cost of an advancement to the advancement cost resource;

Code:
<!-- Each advancement consumes its cost in accrued advances -->
<eval index="1" phase="Setup" priority="5000"><![CDATA[
  #resspent[resAdvance] += field[advCost].value
  ]]></eval>

(in the skeleton files, that's in advancement.core, line 129 - it's Eval Script #1 in the Advance component).

I see in your scripts that you're not calculating costs until Traits/5000, and this is at Setup/5000.
 
Again, maybe I need to define what I'm doing and see what you suggest on how to handle it.

(Assume the advancement.core items are there. I have only defined new abilities to advance.)

With regards to skills, the increase works but not the cost. I have defined a field called xpCost on abilities to use. But the default skill increase uses the advCost field and I'm not allowed to set it. How do I set this field in code after they pick it from the list?

In Alternity, a character is only allowed two ability score increases. Each of those costs is different based on which increase it is and what profession. It also doesn't allow the attribute to go above its maximum.

How would you do these? What else can I give you to help?

Thanks!

edg
 
Why can't you set advCost?

What's the intended difference between xpCost and advCost? Why not just rename advCost to xpCost - or leave the field's name alone, and only rename the resAdvance resource itself?
 
Why can't you set advCost?

What's the intended difference between xpCost and advCost? Why not just rename advCost to xpCost - or leave the field's name alone, and only rename the resAdvance resource itself?

If thing_advance.dat has:

Code:
<thing
    id="advAttrib"
    name="Increase Attribute"
    compset="Advance"
    description="Select an attribute to increase by one.">
    <fieldval field="advAction" value="Increase Attribute"/>
    <fieldval field="advDynamic" value="component.Attribute & !Helper.Maximum & !Hide.Attribute"/>
    <tag group="Advance" tag="Increase"/>
	<eval index="1" phase="Render" priority="1000">
      <![CDATA[
		if (tagis[Profession.Mindwalker] <> 0) then
			field[advCost].value = 15
		endif
      ]]></eval>
	  
    <!-- Attach the child entity for tracking the advance -->
    <child entity="Advance">
      </child>
    </thing>

Then I get:

Code:
Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'eval' script for Thing 'advAttrib' (Eval Script '#1') on line 3
  -> Only derived fields can generally be modified via scripts (field 'advCost')

I get the same error if I try and set advCost in thing_abilities.dat.

So, I made advCost derived and tried this in thing_advances.dat:

Code:
<eval index="1" phase="Render" priority="1000">
      <![CDATA[
		if (tagis[Profession.Mindwalker] <> 0) then
			field[advCost].value = 15
			hero.child[resXP].field[resSpent].value += 15
		endif
      ]]></eval>

It's increasing the starting attribute points used by four for each increase. It's not adding to resXP spent. The resAdvances is increased by one for each of these advances added. (That's just info as I'm not using resAdvances.)

So, not sure what I'm doing wrong or what I should be doing.

Thanks!

edg
 
change type="static" to type="derived" in the definition of the advCost field.

(I actually don't like the way so many fields are set as static in the skeleton files - I've ended up changing almost all of them to derived fields in all the game systems I've created, because even if a value is constant in 99% of cases, there's always one situation where a specific item overrides the general rule)
 
Also, check the timing on your script that's adding to resSpent. Render should not be a phase you can use to do that. The resources component is in miscellaneous.str - check what phase & priority its scripts are at.
 
Back
Top