Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Using Toggles to calculate character stats.

Discussion in 'Scripting' started by acousticworm, Apr 16, 2019.

  1. acousticworm

    acousticworm

    Joined:
    Apr 8, 2019
    Posts:
    3
    Is it possible to script character stats using toggles being on and off for the value? I figure I will have to assign an integer to the toggle switches. If so is that possible?

    IE:

    Character Stat: Strength

    toggle1
    toggle2

    baseValue = 1 ( i want them to do some damage without having any points)
    finalValue = baseValue + number of toggle switches turned on and off.


    if toggle 1 is on
    finalValue = baseValue +1
    else finalValue= baseValue

    if toggle 1 and toggle 2 are on
    finalValue = baseValue +2
    else finalValue = baseValue
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201