Update storyfunction.cpp

updating this function to be a standalone to be able to get called by other functions