Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 14 Jan 2013
Offline Last Active Mar 27 2014 07:02 AM

#5032378 Object Communication

Posted by on 14 February 2013 - 04:20 PM


I'm integrating AngelScript into our game engine and I'm facing one problem I would like to ask here.

Lets say I have a GameObject class, which can own a asIScriptObject* and call function in it. (Like in the "game" sample).

I have two GameObjects, "Go1" with "player.as" and "Go2" with "zombie.as"

If a player kills a zombie, a function "void Kill()" must be called from player.as inside the zombie.as script.


I would like to avoid using a Send/Receive message function but to directly call Kill() inside player.as (a lots like in Unity) : 


class player
    //This is call from the engine on the GameObject's controller script:
    void DoSomething()
        GameObject go2 = Engine.FindObjectByName("Go2");

        //What I would like to do, or something like that:
        Controller go2Controller = go2.GetController("zombie");



The "void Kill()" function is unknown from the engine, but an "instance" of zombie.as is created in Angelscript's engine. Can I get that instance and call function on it? I'm lost here.


Thank you very much