Limit No of Gift Items Per Ticket Based on Person Count(Covers)

I dont have much idea where to start and what needs to be done. Could anyone of you help set this up ?

And to answer your earlier question, i am using this method to count no of persons on table – Tracking Number of Persons