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
JakeMilo
Member
 
Join Date: Mar 2015
Posts: 91

Old December 31st, 2015, 05:22 AM
Good Day,

I have been working on a side project with the authoring kit and have encountered a small problem.

The progression system I am trying to implement has a two tier cost system, and the cost system is also non-linar.

The first set of costs are:

rank cost (total cost)
0 0 (0)
1 10 (10)
2 15 (25)
3 20 (45)
4 25 (70)
5 30 (100)

The second set of costs are:

rank cost (total cost)
0 0 (0)
1 5 (5)
2 10 (15)
3 15 (30)
4 20 (50)
5 25 (75)

Using thread necromancy I found this:

http://forums.wolflair.com/showthrea...t=excel&page=2

Which helped resolve the second set of numbers. However, the first set of numbers are behaving strangely.

Code:
<!-- Each career skill point that is allocated by the user costs the appropriate XP -->
	<eval index="5" phase="Traits" priority="10000">
      <before name="Calc resLeft"/>
      <after name="Bound trtUser"/><![CDATA[
	    doneif (field[trtFinal].value = 0)
	    doneif (tagis[Skill.Career] = 0)
		var traitlevel as number
		var traitcost as number
		var finalvalue as number
		traitlevel = field[trtFinal].value
		traitcost = 5
		finalvalue = traitcost / 2 * (traitlevel * traitlevel + traitlevel)
		hero.child[resXP].field[resSpent].value += finalvalue
      ]]></eval>
	  
	<!-- Each non-career skill point that is allocated by the user costs the appropriate XP  -->
	<eval index="6" phase="Traits" priority="10000">
      <before name="Calc resLeft"/>
      <after name="Bound trtUser"/><![CDATA[
		doneif (field[trtUser].value = 0) 
	        doneif (tagis[Skill.Career] = 1)  
		var traitlevel as number
		var traitcost as number
		var finalvalue as number
		traitlevel = field[trtFinal].value
		traitcost = 5
		finalvalue = traitcost / 2 * (traitlevel * traitlevel + traitlevel)
		hero.child[resXP].field[resSpent].value += finalvalue + 5
      ]]></eval>
With the finalvalue + 5 in, the first and second rank cost 10 each and then increases in 5 increments.

Without the doneif (field[trtUser].value = 0) line, it causes the 0 value of the skill to cost 5 each.

Was wondering if anyone could help tell me what blindingly obvious mistake that I am making is?

I also tried this:

Code:
var traitlevel as number
                doneif (field[trtFinal].value = 0)
	        doneif (tagis[Skill.Career] = 1)
		var finalvalue as number
		traitlevel = field[trtFinal].value
		finalvalue = (2.5 * traitlevel * traitlevel) + (2.5 * traitlevel) 
		hero.child[resXP].field[resSpent].value += finalvalue - 5 -->
Which is the excel graph formula (ignoring the 0 value), which breaks in similiar ways.
JakeMilo is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old December 31st, 2015, 06:57 AM
In this case, your first set of costs are not quite the same formula.

The formula for your first table is 2.5x^2 + 7.5x

So in HL:
Code:
traitcost = 5
finalvalue = (traitcost / 2 * traitlevel * traitlevel) + (traitcost * 3/2 * traitlevel)
Mathias is online now   #2 Reply With Quote
JakeMilo
Member
 
Join Date: Mar 2015
Posts: 91

Old December 31st, 2015, 07:21 AM
Good Day,

Thanks for the rapid response.

It, of course, works.
JakeMilo is offline   #3 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 06:50 PM.


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