Hi, this is probably a stupid question that belongs in the Beginner's section - sorry if so:
I am tying to get more than one entity to access and use one function by using the on_[key] instruction. The reason I'm doing this is that I'm testing out the basics of a two player fighting game. The basic structure of my code is this:
function do_this{
if(my._suchandsuch==this)
{my._something=this;}
blahblah();}
action character1
{on_a = do_this;}
action character2
{on_b = do_this;}
(I could post the real code but it wouldn't help, as it's just calling specific animation data at the moment.)
Theoretically, when character1 calls do_this (by the player hitting the 'a' key), the MY synonym in do_this should become character1; and the same goes for character2 (on the player pressing the 'b' key). However, instead, if I try to press the 'a' or 'b' keys I get an empty synonym error message. It works fine if I assign a synonym to the characters (eg player=me;_ and then do the same at the beginning of the do_this function (eg. me=player , but if I do this then I need to create a separate do_this function for each character. This might not be so bad, except that I intend for there to be more AI characters that will access the same function...
I've searched all the posts on the forum, and from what I've read I think it might be that the on_ instruction doesn't send the synonym with it, but just executes the function. Is this the case? If so, does anyone know how I can get around this, so that both entities can access the function?
Thanks, sorry for the dumb question.
-Keith