It sounds like you're trying to dynamically adjust unit leadership in a game engine or modding environment. Since your attempts with Attack.atom_setpar(), Attack.act_leadership(), and Attack.act_attach_modificator() haven't worked, it suggests that these methods aren't part of the API or scripting framework you're using.
Here are some possible steps to troubleshoot or find a solution:
Check Documentation: Verify if there's an existing method or function in your game engine's API that handles unit stats directly. Some games have unique methods for modifying stats like leadership, attack power, etc.
Alternative Functions: Try searching for alternative functions or hooks related to unit modification or stat adjustments. You might find something like Unit.set_leadership() or Hero.get_leadership() that you can leverage.
Global vs. Local Variables: Ensure that the leadership variable is accessible where you're trying to use it. If it's being declared locally within a function, make sure it's properly passed to any method that needs it.
Triggers/Events: Look into whether you can set up triggers or events that detect when the hero's leadership changes and dynamically adjust the leadership of the troll unit in response.
Minecraft APK
Modding Forums/Communities: If all else fails, modding communities or forums dedicated to the game or engine you're working with could be a valuable resource. Often, other developers or modders may have already encountered similar issues.
If you can provide more specifics about the game or engine you're working with, I might be able to offer more targeted advice.