That's close to an "impossible question", since it's a really expansive question. You're essentially asking either to have someone write the event/decision for you, or to have a complete tutorial written on how to do it. You'll get much better answers if you try to work through the problem one stage at a time, and then return with any specific singular problems where your attempts go wrong. =)
The best starting point: find and copy the basic event template on
Event Modding, and test it out in the game with the debug command "event (youreventid)", e.g.,
event mymodprefix.1 , typed in the console (`~ key). If it pops up on screen, great. If not, figure out what went wrong -- and you'll thank yourself later if you take the time to figure out and set up
The Validator, since it really helps.
You probably want a decision rather than an event. They're about the same in terms of skill required (not hard, but takes a little doing to wrap your head around), but events fire themselves while the other is manually triggered by the player: so, a random event that legitimises your bastards probably won't help you. However, because a decision has no feedback for the player unless it also triggers an event, you usually need to use both a decision to do what you want when you want to, and then an event that's launched from the decision to tell the player that everything did what it was supposed to (taking advantage of the Clausewitz engine's automatic portrait insertion and tooltips to show off the effects).
In other words, even something as simple as this actually involves at least three separate stages: 1) create an event which contains the script code you want to run in the "option", 2) create a decision that triggers that event, which itself requires script code in the "effect' (usually just a "character_event" command to fire your event), and 3) create a localised .csv file that contains all of the text you want to use.
To know all this you'll need to understand
Scripting (to control flow),
Scopes,
Conditions (to filter the scopes),
Commands (to perform the same tasks as the legitimize_bastard decison in the game's decisions/dynasty_decisions.txt,
Decision Modding, and
Event Modding. You'll then need to worry about
Localisation to learn how to create a properly formatted .csv file (although exporting one from a spreadsheet editor like OpenOffice, LibreOffice, or Excel will help avoid major crippling errors).