hello everyone! I currently am trying to dynamically set up an audio stream player so that different weapon types play their own respective sound when hitting an enemy. I currently have this setup working for otgher various data types but I have not been able to get it to work with audio. Any advice would be greatly appreciated! Code below for reference. The code below here is the Damage Component swift # allows for various attack attributes from the home brewed Attack class func new_attack(area): enemy_knockback() var attack = Attack.new() var hitbox : HitboxComponent = area attack.attack_damage = attack_damage attack.knockback_force = knockback_force attack.attack_size = attack_size attack.hp = hp attack.target = target attack.angle = angle attack.hit_sound = hit_sound attack.knockback_direction = knockback_direction hitbox.damage(attack) hitbox.enemy_knockback(attack) attack.hit_sound = hit_sound inside this code block above we are creating an attack instance with the values that are passed via other methods. the code below will show where the relevant code is coming from. the code below here extends the damage component. swift ``` func _ready():
angle = global_position.direction_to(target)
rotation = angle.angle() + deg_to_rad(135)
match level:
1:
hp = 1
speed = 150
attack_damage = 5
knockback_force = 100
attack_size = 1.0
HurtBoxType = 1
hit_sound = $HitSound ``` The hit sound when printed shows a unique audiostream player however when I pass this information to its parent class aka the Damage component when I try to call this value I get a NIL value for some reason. if you have any other questions let me know!!
