#View Requirement Help

1 messages · Page 1 of 1 (latest)

grim coyote
#
 'head-green1':
   material: MAP
   model_data: 1002
   slots: 
   - 11
   display_name: '&fTest'
   lore:
   - '&flore here'
   priority: 0
   view_requirement:
      requirements:
         bodypart:
         type: javascript
         expression: '%bodyhealth_health_HEAD_rounded% == 100'
 'head-red1':
    display_name: '&fTest'
    lore:
    - '&flore here'
    material: MAP
    model_data: 1001
    slots: 
    - 9
    view_requirement:
      requirements:
        bodypart:
        type: javascript
        expression: '%bodyhealth_health_HEAD_rounded% < 33'
    priority: 1
 'head-red2':
    display_name: '&fTest'
    lore:
    - '&flore here'
    material: MAP
    model_data: 1001
    slots: 
    - 10
    view_requirement:
      requirements:
        bodypart:
        type: javascript
        expression: '%bodyhealth_health_HEAD_rounded% < 66'
    priority: 2
 'head-red3':
    display_name: '&fTest'
    lore:
    - '&flore here'
    material: MAP
    model_data: 1001
    slots: 
    - 11
    view_requirement:
      requirements:
        bodypart:
        type: javascript
        expression: '%bodyhealth_health_HEAD_rounded% < 99'
    priority: 3
 'head-red4':
    display_name: '&fTest'
    lore:
    - '&flore here'
    material: MAP
    model_data: 1000
    slots: 
    - 9-11
    view_requirement:
      requirements:
        bodypart:
        type: javascript
        expression: '%bodyhealth_health_HEAD_rounded% > 1'
    priority: 4```
#

hi im trying to figure out view requirement

#

basically, i'd like 3 green bars at 100% health, and it fading into a red bar per 1/3 of health. with eventually at <1% health, there'd be zero bars remaining, red nor green

#

i have a video showcasing the issue but im too new to post the link in here

clever quail
#

your requirements aren't aligned correctly

#

instead of ```yml
view_requirement:
requirements:
bodypart:
type: javascript
expression: '%bodyhealth_health_HEAD_rounded% > 1'

you should have
```yml
    view_requirement:
      requirements:
        bodypart:
          type: javascript
          expression: '%bodyhealth_health_HEAD_rounded% > 1'
#

We also recommend not using the JS requirement and use other existing types instead

#

in this case, you can simply use the > comparator requirement type

    view_requirement:
      requirements:
        bodypart:
          type: ">"
          input: '%bodyhealth_health_HEAD_rounded%'
          output: 1
grim coyote
#

oh ok, thanks i'll give this a go!