How i can add an attribute to another attribute

Hi im making a characteristic system, so i made a button to calculate life points whit a random value and i need to add to this value the fortitude value, and everytime that the fortitude value changes the life points must change.

for example.

I throw the dice to calculate life points and that value was "10"
and i have a value of 3 in fortitude so the life points is equal to 13. but during the game the fortitude raises to 4 and the life points must change too.

How i add an attribute to other.

Thanks

Comments

  • DepressedPandaDepressedPanda Member Posts: 215
    If I'm understanding your question add a 3rd change/constrain variable that just sets @life to life + fortitude?
  • amarilloveganamarillovegan Member Posts: 3
    thanks for the help. I do what do you say and i create a constrain attribute behavior (Constrain: "Life" to "fortitude") and works, the value of fortitude appears en the life value, but when i throw the dice did dont work. if i do this backwards, i fi throw the dice and make the constrain after that is the same.

    The constrain isnt adding the value it changes the value.. perhaps im doing wrong?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited March 2013

    Hi @amarillovegan with respect to @DepressedPanda Constrain isn't really helpful here, I'm thinking; instead I'd suggest using a Change Attribute behaviour.

    Secondly, if it were me, because you are adding the value of two different things, I'd make the programming clearer by making a third integer attribute, being the sum of those other two.

    So in your button to calculate life points, something like

    When touch is pressed
    Change Attribute Life to random(1,10) --- guessing this is the sort of thing you have
    Change Attribute LifeFort to scene.Life+scene.Fortitude
    Display Text "Life "..scene.LifeFort --- maybe you're doing this?

    As long as your Fortitude attribute is a scene or game one, when it's changed at a future time, it'll be automatically taken into account with the above Rule. Hope that sorts it for you.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • amarilloveganamarillovegan Member Posts: 3
    hey i try the way you said and works but whit constrain i link the 3 attributes. thanks for the support for u two! u are awesome
Sign In or Register to comment.