Quote from: RickJ on Sun 11/04/2010 04:33:56
You could use a custom function to talk with that particular NPC. The function would increment a conversation counter each time it is executed. The conversation counter would then be queried to determine which topic should be started. The counter is implemented using a static variable which means that it is declared outside the bounds of any function. The values of static variables are persisted through out the game. Dynamic variables, those defined within the bounds of a function are only defined while the function is executing and it's values are not save from one execution of the function to the next.
Here is a code example illustrating the technique. It's not complete or error free but should give you a good idea of how to do this. Hope you find ithis helpful.Code: ags *** Room Script Example *** // Define a conversation counter for this particular NPC // and initialize it to zero int SomeNpcConversationCounter = 0; // Create a custom function used to talk with this particular NPC function TalkToSomeNpc(Dialog *topic) { // If this is the first time talking to the NPC named "SomeNpc" // then use dTopic1 or whatever name you prefer. if (SomeNpcConversationCounter<=0) { StartDialog(dTopic1); } // If this is the second time talking to the NPC named "SomeNpc" // then use dTopic2 or whatever name you prefer else if (SomeNpcConversationCounter==1) { StartDialog(dTopic2); } // If you have talked with the NPC 3 or more times then use // the topic passed in as the parameter. else { StartDialog(topic); } // Add one to the conversation counter SomeNpcConversationCounter++; } // This is a function created using the Interaction editor (i.e. using the // llighting bolt icon in the lower right hand pane of the editor). It is executed // in response to some player action such as a mouse click on an NPC or other // game entity. function room_SomeInteraction() { // Talk to the NPC named SomeNpc. // The first two times the dTopic1 and dTopic2 // will be started. On subsequent times dTopic3 // will be started. TalkToSomeNpc(dTopic3); }
PS: Catlover I have 6 cats, all rescued, all all ornry as hell!
Thanks RickJ, I was using a dynamic variable, not a static variable

I only have one cat, bought, and desexed
