Is it possible to duplicate one of my characters so that the things that he is commanded to do are done by all of them at the same time. I mean i have a character that i have programmed him to complete certain actions but now i want more of his kind, simply by creating anew character with the same view won't do it cause i would have to duplicate his "behaviour" each time. So the question is this, can i have multiple "same" characters in one room? I mean the same character, many times.
The short answer is, as you've probably realised, yes but you'll have to duplicate the commands for each 'version' of the character. You could probably move most of your code into custom functions, to save you having to type all of it out over and over again.
Really, it of depends on what sort of 'behaviour' you mean. Some things (like movement) might be better dealt with by the Character Control module (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=28821.0), for example; there was a question asked a while ago about having multiple characters react the same way to clicks (here (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=30437.0)), which you could probably adapt if needed; and so on. So, the long answer is 'Probably, but what exactly are you after?'
It's like the soldiers and activists example but they don't only react to certain clicks, they have a general behaviour f.e.: they take certain actions triggered by some events or by variables that are repeatedly checked, so it would be a real pain in the *** to have to go through such a tight script again. I guess i'll figure of some other smart way to do that
Well such things are typically achieved via iterating through all of the controlled characters in a "while" loop:
int id = 0;
while ( id < 5 ) // do for characters with numbers 0, 1, 2, 3 and 4
{
int random_x = Random( Room.Width-1 ); // generate random room x coordinate
int random_y = Random( Room.Height-1 ); // generate random room y coordinate
character[ id ].Walk( random_x, random_y, eNoBlock, eAnywhere ); // make each walk to a random position
id ++; // proceed to the next character
}
See if it helps you to sort it out.
With the Character Control module you can set up a chain of actions to perform and then use the same method as above to make them all execute the previously defined chain of actions.