[QUOTE=onion] Thanks very much @C-7, it's great that you've shared your code! Your solution is sound, but have a niggling worry about the amount of duplication you've got if you have similar code for each NPC. Although it's not much of a problem as long as you don't need to change it.
@theubie I'm glad you've told me about this solution, it's what I've had in my head actually. I'm very familiar with mySQL, so this wouldn't be a problem. It essentially makes C2 the frontend and store the logic elsewhere. A bit like a webpage actually.
As a webdeveloper, this makes sense to me! [/QUOTE]
It's a trade-off. I could do it as a function and save on the duplication, but it would make special circumstances more difficult. I like being able to list the conditions right there because there are plenty of instances where you would want things different. As far as where you store the actual text, it makes no real difference whether it's in a database on your server or in your C2 code. I would just as soon make it easier on yourself and include it in your C2 code--I would hate to have to adjust the message length to make it fit correctly each time in your database. I would definitely not worry about file-size if you are. Minified, my game is just over 2MB plus graphics (which brings it to around 30MB). If you're worried about speed, I would spend your time being efficient with your graphics.