But it dont want to work as I want.
Here video
https://youtu.be/GZ_xEDuujTo
Can some one look at code and say what I missed?
Spoiler:Code: Select all
class mutagen : inventory { double result_value; double target_result_value; default {inventory.amount 1;} } ////////////// class fractal_mutation : mutagen { double max_health; double current_health; double previous_health; double default_radius; double default_height; bool master_check; override void AttachToOwner(Actor user) { max_health = user.health; current_health = user.health; previous_health = user.health; default_radius = user.radius; default_height = user.height; result_value = 1; if(user.master != null){master_check = true;} super.AttachToOwner(user); } override void doeffect() { if(owner.health<=1){return;} if(owner.radius <= 1 || owner.radius <= 1) {owner.a_die(); return;} if (master_check == true) { master_check = false; double constanta = fractal_mutation(owner.master.findinventory("fractal_mutation") ).result_value; owner.A_setscale(constanta); owner.a_setsize(default_radius * constanta, default_height * constanta); owner.a_sethealth(max_health * constanta); max_health = owner.health; current_health = owner.health; previous_health = owner.health; } current_health = owner.health; if(current_health == previous_health){return;} result_value = current_health/max_health; owner.A_SetScale(result_value); owner.a_setsize(default_radius*result_value, default_height*result_value); if(owner.radius >= 1 && owner.height >= 1) { owner.a_spawnitemex(owner.getclassname(),0,0,0, frandom(- owner.radius,owner.radius), frandom(- owner.radius,owner.radius), frandom(0,owner.height),0, SXF_SETMASTER|sxf_nocheckposition); owner.a_givetochildren("fractal_mutation",1); } previous_health = owner.health; } }