Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

Problem with Stats

$
0
0
I got this code from a couple of other discussions. Thank you to those.

My problem is whenever I increase the speed attribute and then click on health-1 (when health is say '0') it decreases the health to negative values , and makes the total attribute point increase which helps in again increasing the speed attribute.

Code in my stat
(set: $Apointsplus to true)

Attribute Points = [$Attripoints]<attripoints|

Health = [$Health]<health| (link-repeat: "Health +1")[{
	(if: $Attripoints >= 1)[
		(set: $Apointsplus to true)
	]
	(if: $Attripoints <=$Attripoints  and $Apointsplus is true)[
		(set: $Health to it + 1)
		(set: $Attripoints to it - 1)
		(replace: ?health)[$Health]
		(replace: ?attripoints)[$Attripoints]
		(if: $Attripoints is 0)[
			(set: $Apointsplus to false)
		]
	]
}] (link-repeat: "Health -1")[{	(if: $Attripoints <= 1)[
		(set: $Apointsplus to true)
	]
	(if: $Attripoints <$tot and $Apointsplus is true)[
		(set: $Health to it - 1)
		(set: $Attripoints to it + 1)
		(replace: ?health)[$Health]
		(replace: ?attripoints)[$Attripoints]
	]
}]

(set: $Apointsplus to true)
Speed = [$Speed]<Speed| (link-repeat: "Speed +1")[{
	(if: $Attripoints >= 1)[
		(set: $Apointsplus to true)
	]
	(if: $Attripoints <=$Attripoints  and $Apointsplus is true)[
		(set: $Speed to it + 1)
		(set: $Attripoints to it - 1)
		(replace: ?Speed)[$Speed]
		(replace: ?attripoints)[$Attripoints]
		(if: $Attripoints is 0)[
			(set: $Apointsplus to false)
		]
	]
}] (link-repeat: "Speed -1")[{	(if: $Attripoints <= 1)[
		(set: $Apointsplus to true)
	]
	(if: $Attripoints <$tot and $Apointsplus is true and $Speed > 0)[
		(set: $Speed to it - 1)
		(set: $Attripoints to it + 1)
		(replace: ?Speed)[$Speed]
		(replace: ?attripoints)[$Attripoints]
	]
}]

Code in my passage
(set: $Attripoints to it + 3)
(set: $tot to $Attripoints)

I tried setting if condition to make the health attribute '0' if it is less than '0'. It helped in making the health stay at 0 but it still increased the total attribute points regardless.

English is not my first language.

Viewing all articles
Browse latest Browse all 1844

Trending Articles