Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Authoring Kit
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
Gomo
Member
 
Join Date: Apr 2014
Posts: 50

Old September 6th, 2014, 01:08 PM
Hello.
I am trying to make an advancement method which consumes points based on level of existing skill.
For example advancement from 1 cost 50 points, from 2 costs 100, from 3 cost 200 and so on.
Currently I tried to set it by:

Code:
    <eval index="4" phase="Traits" priority="2000"><![CDATA[
      doneif (tagis[Advance.Gizmo] = 0)
 
      if (origin.parent.tagis[Advance.Increase] > 0) then
        linkage[basis].field[trtAdv].value += 1
      elseif (origin.parent.tagis[Advance.Decrease] > 0) then
        linkage[basis].field[trtAdv].value -= 1

        endif
		      ]]></eval>
which uses "trtAdv" instead of default "trtBonus" and which works in calculation of level of skill.
But when I try to use that code to determine the cost in XP:
Code:
	    <eval index="1" phase="Setup" priority="4000"><![CDATA[
		var level as number
			  var curvesq as number
	  var pointspent as number
	  var advanced as number
	  var sequence as number

			  perform gizmo.findchild[none,"Advance.Gizmo"].setfocus
					if (state.isfocus <> 0) then
			if (focus.islinkage[basis] <> 0) then
				level = focus.linkage[basis].field[trtUser].value + focus.linkage[basis].field[trtAdv].value
				
	  curvesq = focus.linkage[basis].field[sklLrnCrv].value
	  pointspent = focus.linkage[basis].field[trtUser].value
	  advanced = focus.linkage[basis].field[trtAdv].value

	  else
	  curvesq = 0
	  pointspent = 0
	  	  endif
	  endif


	  	  sequence = power(2,advanced)*curvesq
      doneif (origin.ishero = 0)

	field[advCost].value = sequence * 10 
				
				doneif (state.isfocus = 0)
		if (focus.islinkage[basis] = 0) then
		field[advCost].value = 0
		endif
      ]]></eval>
...then always I've got focus.linkage[basis].field[trtAdv].value as 0.
"trtUser" is getting correctly.
I tried some changes with timing but still can't to manage to make it work.
Thanks in advance for any help.
Gomo is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old September 11th, 2014, 09:58 AM
I'm sorry, but could you please elaborate on what you're trying to accomplish? I don't understand what you're saying.
Mathias is offline   #2 Reply With Quote
Gomo
Member
 
Join Date: Apr 2014
Posts: 50

Old September 11th, 2014, 10:19 AM
I am trying to make advancement cost be a continuation of creation cost.
In example:
Character buys a skill in creation to 3rd level so he pays 1(for first) + 2(for second) + 4( for 3rd level) = 7 points.
In advancement he would like to rise that skill to 4th level so it should pay 8 points (in assumption that each next level cost twice amount of previous level).
In Creation I use skill points, and in advancement I use XPs.
I try to determine current level of a skill by summarizing trtUser (assigned in creation) and trtAdv (assigned in advancement).
Now it works only for first advancement, like the current advancement would not be stored, but it works for trtFinal, so I know it works somehow but not for determining current cost in XPs.
Gomo is offline   #3 Reply With Quote
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,633

Old September 11th, 2014, 09:13 PM
Quote:
Originally Posted by Gomo View Post
I am trying to make advancement cost be a continuation of creation cost.
In example:
Character buys a skill in creation to 3rd level so he pays 1(for first) + 2(for second) + 4( for 3rd level) = 7 points.
In advancement he would like to rise that skill to 4th level so it should pay 8 points (in assumption that each next level cost twice amount of previous level).
In Creation I use skill points, and in advancement I use XPs.
I try to determine current level of a skill by summarizing trtUser (assigned in creation) and trtAdv (assigned in advancement).
Now it works only for first advancement, like the current advancement would not be stored, but it works for trtFinal, so I know it works somehow but not for determining current cost in XPs.
It seems the point value doubles the previous cost with each advancement. If this is the case you could use a field that stores the exponents and just raise 2 to that exponent field as you apply the advances...

1=2^0, 2=2^1, 4=2^2, etc. should be doable in herolab with a power function if I am not mistaken...

RavenX Pronouns: She/Her

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #4 Reply With Quote
Gomo
Member
 
Join Date: Apr 2014
Posts: 50

Old September 12th, 2014, 10:46 AM
Equation is not the problem.
The problem is with getting a number of previous advances which will be used in this equation.
Right now I only get levels before advancement.
Gomo is offline   #5 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old September 12th, 2014, 11:17 AM
trtAdv + 1 needs to be in the same script that calculates the cost, instead of adding to trtAdv in one script and calculating the cost in a different script.

That way, since advancements always process their scripts in order from oldest to newest, in each case, the total of trtAdv will include all the changes from all the ones added before this one, but none of the ones added after this advance.
Mathias is offline   #6 Reply With Quote
Gomo
Member
 
Join Date: Apr 2014
Posts: 50

Old September 12th, 2014, 12:19 PM
Ok, I simplified equation for testing purposes now it looks like this:
Code:
	field[advCost].value = focus.linkage[basis].field[trtUser].value + focus.linkage[basis].field[trtAdv].value + 1
I have set starting level to 3 so for 4th I would have to spend 4 xp, 5th 5xp, and 6th 6xp = 15 xp.
right now I am getting 4th -4, 5th -4, 6th -4 = 12xp.
Gomo is offline   #7 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old September 12th, 2014, 12:28 PM
You're only showing the line of your code that calculates the cost.

What's the line of code that's adding +1 to trtAdv look like? Could you please show us the rest of the script, so we can help you figure out why the cost increase and value increase aren't working together correctly?
Mathias is offline   #8 Reply With Quote
Gomo
Member
 
Join Date: Apr 2014
Posts: 50

Old September 12th, 2014, 12:47 PM
I belive it is this:
Code:
<eval index="2" phase="Setup" priority="5000"><![CDATA[
      #resspent[resAdvance] += field[advCost].value
      ]]></eval>
The rest of the code for the advancement:
Code:
    <eval index="4" phase="Final" priority="1000"><![CDATA[
      if (herofield[acLastAdv].value < field[advOrder].value) then
        herofield[acLastAdv].value = field[advOrder].value
        endif
      ]]></eval>

    <!-- Determine if this is the most recent advancement pick -->
    <eval index="5" phase="Render" priority="1000"><![CDATA[
      if (herofield[acLastAdv].value = field[advOrder].value) then
        perform assign[Advance.Newest]
        endif
      ]]></eval>

    <!-- Put the dynamic tagexpr for choosers into the child gizmo -->
    <eval index="6" phase="Render" priority="2000" name="Assign Dynamic Tagexpr"><![CDATA[
      if (empty(field[advDynamic].text) = 0) then
        gizmo.child[advDetails].field[advTagexpr].text = field[advDynamic].text & " & !thing.showonly"
        endif
      ]]></eval>

    <!-- Synthesize an appropriate name for the advancement -->
    <eval index="7" phase="Final" priority="10000"><![CDATA[
      ~if this advancement has an annotation, there is no user-selection, so build
      ~the name from our pieces and we're done
      if (tagis[Advance.Notation] <> 0) then
        perform gizmo.child[advDetails].setfocus
        field[livename].text = field[name].text & ": " & focus.field[advUser].text
        done
        endif

      ~start with the name of the selected advancement
      field[livename].text = gizmo.findchild[none,"Advance.Gizmo"].field[name].text

      ~determine the user-selected child associated with this advancement
      ~Note: If the user hasn't selected anything yet, we won't have one, so we need
      ~       to bail out at this point if we don't have one yet.
      perform gizmo.findchild[none,"Advance.Gizmo"].setfocus
      doneif (state.isfocus = 0)

      ~if we have a domain, append it to our name
      ~Note: If this is a boost, we need to get the domain from the basis linkage.
      if (focus.tagis[User.NeedDomain] <> 0) then
        if (tagis[Advance.AddNew] <> 0) then
          field[livename].text &= ": " & focus.field[domDomain].text
        else
          field[livename].text &= ": " & focus.linkage[basis].field[domDomain].text
          endif
        endif
      ]]></eval>
Gomo is offline   #9 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old September 12th, 2014, 02:06 PM
From Shadowrun, which also needs to calculate the cost of an advancement depending on the value of the trait, I've pulled out some of the relevant portions of the script that adds to trtBase (you're using trtAdv for the same purpose) and then calculates the cost:


Code:
    <!-- If this is an increase, add one to the trait, and subtract one for a decrease -->
    <eval index="4" phase="Traits" priority="2000" name="Calc Advance"><![CDATA[
      ~we only worry about this on actual advances - not traits added at creation
      doneif (tagis[Advance.Gizmo] = 0)

      if (origin.parent.tagis[Advance.Increase] <> 0) then
        linkage[basis].field[trtBase].value += 1
      elseif (origin.parent.tagis[Advance.Decrease] <> 0) then
        linkage[basis].field[trtBase].value -= 1
        endif

      origin.parent.field[advCost].value += field[trtAdvCost].value
      ]]></eval>
Mathias is offline   #10 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 10:28 AM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.