In 1488, aged 15, James IV becomes King of Scotland but his path to the throne is a dramatic one.
James III was an unpopular king; largely due to taxation and the marginalisation of groups of nobles. Two of these noble families - Home and Hepburn- decided to rebel against him, and his son, James, took up the cause alongside them.
It's thought that this was due to James III deciding that he was essentially going to disinherit his son James (future James IV) in favour of a younger son, also called James. (Still with me?) Though it isn't entirely clear whether this was a conscious decision to take arms against his father, or more of a 'kidnap and force' type situation.
James III, determined to put a stop to these rebellious activities (even if it meant executing his own son) leads his army from Edinburgh to Stirling where a battle ensues at Sauchieburn on 11 June, 1488.
The rebel army wins, but James III was not in fact killed in battle. As the story goes, he was thrown from his horse whilst fleeing, and carried to a hut. From said hut he calls out for a priest, though instead is visiting by a mysterious figure who proceeds to finish him off.
Whether or not the young James IV had processed the idea that he would be (in part) responsible for the death of his father is still up for debate. However, he clearly felt a large amount of guilt as he wore an uncomfortable metal belt around his waist for the rest of his life, as a way of penance.
Despite this, James IV took up his new royal role with enthusiasm and quickly established himself as an able, energetic, renaissance king.