Download ugxmods_buyable_ending.gsc (Version 1.0) and place it in root/usermaps/mapname/scripts/zm
Add this line to the top of your mapname.gsc:
Add this line to your mapname.zone:
Open up your ugxmods_buyable_ending.gsc and you will see a list of useful options at the top of the file which you can configure. They have all been set to valid default values so that the script works automatically out of the box.
You can customize the ending hintstring, cost, and also make the endgame require other things to be done first (flags, notifies) for other scripts if you want players to complete objectives before they can buy the ending.
Drag a "trigger_use" from the entity browser in Radiant Black into your map and give it this targetname value: "ending"