Paste #106538: Unnamed Denizen Script Paste

Date: 2023/02/23 23:08:42 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


healthSystemFlags:
    type: world
    events:
        on player join:
            - if <player.has_flag[feeling].not>:
                - flag <player> feeling:100
            - if <player.has_flag[sanity].not>:
                - flag <player> sanity:100
            - if <player.has_flag[blood].not>:
                - flag <player> blood:100
            - if <player.has_flag[physicalDamage].not>:
                - flag <player> physicalDamage:0
            - if <player.has_flag[internalDamage].not>:
                - flag <player> internalDamage:0
            - if <player.has_flag[temperature].not>:
                - flag <player> temperature:40

            - definemap bloodMOVEMENTSPEED:
                GENERIC_MOVEMENT_SPEED:
                    1:
                        operation: ADD_SCALAR
                        amount: <element[0].sub[<element[100].sub[<player.flag[blood]>]>].div[200]>
                        id: 91100000-1000-1000-1000-100000000000
            - adjust <player> add_attribute_modifiers:<[bloodMOVEMENTSPEED]>

healthSystemTick:
    type: world
    events:
        on delta time secondly:
            - foreach <server.online_players> as:__player:

                # Bloodloss
                - if <player.flag[blood].round_up> < 100:
                    - if <player.has_flag[bleeding].not>:
                        - if <util.random_chance[<player.food_level.add[<player.saturation>].mul[1.5]>]>:
                            - flag <player> blood:+:1
                    - else:
                        - if <util.random_chance[<player.food_level.add[<player.saturation>].mul[1.0]>]>:
                            - flag <player> blood:+:1
                - if <player.has_flag[bleeding]>:
                    - choose <player.flag[bleeding]>:
                        - case minor:
                            - if <util.random_chance[25]>:
                                - playeffect effect:item_crack special_data:red_wool at:<player.location.add[0,1,0]> offset:0.1,0.33,0.1 quantity:2 velocity:1 data:0.025
                                - flag <player> blood:-:1
                            - if <util.random_chance[1]>:
                                - flag <player> bleeding:!
                        - case mild:
                            - if <util.random_chance[50]>:
                                - playeffect effect:item_crack special_data:red_wool at:<player.location.add[0,1,0]> offset:0.1,0.33,0.1 quantity:4 velocity:1 data:0.05
                                - flag <player> blood:-:1
                            - if <util.random_chance[0.5]>:
                                - flag <player> bleeding:!
                        - case severe:
                            - if <util.random_chance[75]>:
                                - playeffect effect:item_crack special_data:red_wool at:<player.location.add[0,1,0]> offset:0.1,0.33,0.1 quantity:8 velocity:1 data:0.05
                                - flag <player> blood:-:1
                            - if <util.random_chance[0.1]>:
                                - flag <player> bleeding:!
                        - case lethal:
                            - playeffect effect:item_crack special_data:red_wool at:<player.location.add[0,1,0]> offset:0.1,0.33,0.1 quantity:16 velocity:1 data:0.075
                            - flag <player> blood:-:<util.random.int[1].to[2]>
                            - if <util.random_chance[0.05]>:
                                - flag <player> bleeding:!
                - if <player.flag[blood].round_up> < 0:
                    - flag <player> blood:0

                # Bloodloss Damage
                - define blooddamage 0
                - if <player.flag[blood].round_up> <= 59 && <player.flag[blood].round_up> >= 50:
                    - if <util.random_chance[5]>:
                        - define blooddamage:+:0.05
                - if <player.flag[blood].round_up> <= 49 && <player.flag[blood].round_up> >= 40:
                    - if <util.random_chance[10]>:
                        - define blooddamage:+:0.05
                - if <player.flag[blood].round_up> <= 39 && <player.flag[blood].round_up> >= 30:
                    - if <util.random_chance[25]>:
                        - define blooddamage:+:0.05
                - if <player.flag[blood].round_up> <= 29 && <player.flag[blood].round_up> >= 20:
                    - if <util.random_chance[50]>:
                        - define blooddamage:+:0.05
                - if <player.flag[blood].round_up> <= 19 && <player.flag[blood].round_up> >= 10:
                    - if <util.random_chance[75]>:
                        - define blooddamage:+:0.05
                - if <player.flag[blood].round_up> <= 19 && <player.flag[blood].round_up> >= 10:
                    - define blooddamage:+:0.05
                - if <player.flag[blood].round_up> <= 9 && <player.flag[blood].round_up> >= 5:
                    - define blooddamage:+:0.1
                - if <player.flag[blood].round_up> <= 4 && <player.flag[blood].round_up> >= 1:
                    - define blooddamage:+:0.2
                - if <player.flag[blood].round_up> <= 0:
                    - define blooddamage:+:0.4
                - hurt <player.health_max.mul[<[blooddamage]>]> cause:CUSTOM

                # Bloodloss Speed
                - definemap bloodMOVEMENTSPEED:
                    GENERIC_MOVEMENT_SPEED:
                        1:
                            operation: ADD_SCALAR
                            amount: <element[0].sub[<element[100].sub[<player.flag[blood]>]>].div[200]>
                            id: 91100000-1000-1000-1000-100000000000
                - adjust <player> attribute_modifiers:<[bloodMOVEMENTSPEED]>