Artificial intelligence in games is typically used for creating player's opponents. Manual edition of intelligent behaviors for Non-Player Characters (NPCs) of games is a cumbersome task that needs experienced designers. Our research aims to assist designers in this task. Behaviours typically use recurring patterns, so that experience and reuse are crucial aspects for behavior design. The use of hierarchical state machines allows working on different abstraction levels, sharing transitions and reusing pieces from the more detailed levels. However, the static nature of the design process does not release the designer from the burden to completely specify each behaviour. Our approach applies Case-Based Reasoning (CBR) techniques to retrieve and reuse stored behaviors represented as hierarchical state machines (actually, behaviour trees). In this paper we focus on dynamic retrieval of behaviours taking into account the world state and the underlying goals to select the most appropriate state machine to guide the NPC behaviour. The global behaviour of the NPC is dynamically built in run time querying the CBR system. We exemplify our approach through a serious game, developed by our research group, with gameplay elements from First-Person Shooter (FPS) games.