Results 1 to 2 of 2

Thread: Help with attaching entities

  1. #1
    Join Date
    Nov 2006

    Default Help with attaching entities

    Hypno-Joe as some of you may know, will be using some mouse aim stuff. I need to attach his eyeball animations to his entity. Which means I'll need to make the eyeballs an entity itself. According to the scripting reference, there's the SetAttach function. Only problem is that it takes an entity ID. I know there's a GetID function but how do I get the id of an entity not in "this" namespace? Also what about RunFunction -- I've noticed it's there, what's the difference between that and just running the function directly? I noticed in the description it said it's useful for running functions of other entities? So how does it know which entity to run the function from?

    Any help anyone can give is appreciated.

  2. #2


    You could use GetEntityIDByName to get the player ID.

    Or, you could create and attach your eyeballs from the player script. For instance, I call this function from OnPostInit to attach a weapon entity to my player:

    function MakePaperDoll()
    	m_doll = CreateEntity(this:GetMap(), this:GetPos(), "weapons/paper_doll.lua");
    	m_doll:SetAttach(this:GetID(), Vector2(0,0));
    	m_doll:SetLayerByName("Overlay 1");
    And, yes, RunFunction is used to run a function in another script. The entity with the function in its script is the one which will actually be running it.

    For example, when my player changes weapons, I tell the paper_doll.lua entity created above to change weapons as well with this line in player.lua:

    m_doll:RunFunction("ChangeWeapon", name, weaponStrength);

Similar Threads

  1. Interaction between two entities - Grabbing
    By Siris in forum Novashell Game Creation System
    Replies: 2
    Last Post: 03-22-2008, 05:14 AM
  2. Getting Entities to discover the Brain State of other entities
    By stellarvector in forum Novashell Game Creation System
    Replies: 1
    Last Post: 06-28-2007, 11:11 PM
  3. Rotating tiles/entities
    By sphair in forum Novashell Game Creation System
    Replies: 0
    Last Post: 03-12-2007, 09:33 PM



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts