force_shield: type: task definitions: target|multiplier script: # Set the middle of the shield - define origin # Will define the position for the particles - define shield ,7,7,7].shell.parse[div[1.8].add[<[origin]>]]> - define outer_shield ,7,7,7].shell.parse[div[1.55].add[<[origin]>]]> - define inner_shield ,7,7,7].shell.parse[div[2.05].add[<[origin]>]]> # Save the location of the shield and remove it after x seconds - flag server shield:<[origin].to_ellipsoid[3.8,3.8,3.8]> expire:20s # Defines the players originally INSIDE the shield - define safe_entities <[origin].find.living_entities[].within[3.9]> # Flag those players that they're in the shield. - foreach <[safe_entities]> as:ent: - flag <[ent]> in_shield ## Radius of shield should be a variable. For now, Radius = 3.5 ## Outer shield should be radius + 0.5 ## Inner shield should be radius - 0.4 - repeat 500 as:n: # Find the entities that try to get inside or outside - define ents <[origin].find.living_entities.within[4]> - narrate <[ents]> - define unalive_ents <[origin].find_entities.within[4].filter_tag[<[filter_value].is_living.not>]> - define ents:->:<[unalive_ents]> - foreach <[ents]> as:ent: - define distance_to_inner <[ent].location.distance[<[origin]>].sub[3.1].abs> - define distance_to_outer <[ent].location.distance[<[origin]>].sub[4].abs> # if the entity isnt far out enough, stop - if <[ent].location.distance[<[origin]>]> < 3.1: - foreach next # if the entity is closer to the inner shield than the outer shield it's trying to get out: Push to origin - if <[distance_to_inner]> < <[distance_to_outer]>: - push <[ent]> origin:<[ent].location> destination:<[origin]> no_rotate speed:0.5 - wait 0.1s # If the entity is closer to the outer shield than the inner shield, it's trying to get in: Push away - if <[distance_to_outer]> < <[distance_to_inner]>: - adjust <[ent]> velocity:<[ent].location.sub[<[origin]>].normalize.div[1.5]>