Looking for a passage on the effect of good/bad actions on your family through time I don't remember the exact context surrounding the story/situation, but the message was about the impact of one's good or bad deeds through time.

I remember it said something like: good things go down on your family for three(?) generations, while bad things will affect you for twenty(?) generations.

If you recall a similar passage, let me know, it may be the one I'm looking for.
Exodus 20:5-6: You shall not bow down to them or serve them; for I the Lord your God am a jealous God, visiting the iniquity of the fathers on the children to the third and the fourth generation of those who hate me, but showing love to a thousand generations of those who love me and keep my commandments.
Exodus 34:7: keeping steadfast love for thousands, forgiving iniquity and transgression and sin, but who will by no means clear the guilty, visiting the iniquity of the fathers on the children and the children’s children, to the third and the fourth generation.

Implied in the warning of Exodus 20:5 and Exodus 34:7 is the likelihood that children will choose to repeat the sins of their fathers.  A Jewish Targum (1) specifies that this passage refers to “ungodly fathers” and “rebellious children.”  Those generations that commit the same sins their ancestors will receive the same punishment.
Under Old Testament law a generational curse was a consequence for a specific nation (Israel) for a specific sin (idolatry). The history books of the Old Testament (especially Judges) contain the record of this divine punishment meted out.  However, when Israel turned from idols to serve the living God, the “curse” was broken and God saved them (Judges 3:9, 15; 1 Samuel 12:10-11).  The cure for a “generational curse” is repentance of the sin in question, faith in Christ, and a life consecrated to the Lord (Romans 12:1-2).
Jeremiah 32:18 says that the consequences of sin from one generation are visited on the next generations.  Sin’s destructive consequences hurt the person committing the sin as well as those around him. Each generation has the choice to let their natural inclination repeat the cycle or to find a better way. People often want to break negative cycles but do not know how because the way of thinking they were raised with has confused them.  The cure for a “generational curse” is repentance of the sin in question, faith in Christ, and a life consecrated to the Lord (Romans 12:1-2).
(1) https://en.wikipedia.org/wiki/Targum