As suggested by Tim, a cumsum of the event grouped by id is sufficient, in addition to replacing NA with 0s.
df %>% group_by(ID) %>% mutate(target=cumsum(replace_na(event, 0)))