Results 1 to 2 of 2

Thread: Getting Entities to discover the Brain State of other entities

  1. #1
    Serf
    Join Date
    Jun 2007
    Posts
    1

    Default Getting Entities to discover the Brain State of other entities

    I want to set up scenarios where entities will only do something if another entitiy is doing something.

    Example using dragon eggs.

    the dragon will not chase the player unless the player is walking.

    I've been racking my head on it. I'm not that great of a coder so this is an area that is haunting me.

    I know it probably has something with the functions AskBrainByName() and InState() but I can't figure out how to put the two together.

    Charles

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,377

    Default

    An easy way to do this is check if the player is in state Idle or not.

    Code:
    if (not GetPlayer:GetBrainManager():InState("Idle")) then
          //chase the player, he's running right now!
    end

    I tested this in the dragon eggs example and it worked, added a stealth element to the game. (hide when the dragon comes)

    Here is the modified code when I added that line in case you wanted to test it there:
    Code:
    //is the player close?
    if (this:GetDistanceFromEntityByID(g_playerID) < 700
            and this:HasLineOfSightToPosition(GetPlayer:GetPos(), true)) then
     
                if (not GetPlayer:GetBrainManager():InState("Idle")) then //ADD THIS
    		
                    //We can see the player!
                    this:SetDesiredSpeed(5); //start running
                    SetupPlayerChase();
                    GetTextManager:Add("I see you!", this);
                 end //ADD THIS
             
    end
    Seth A. Robinson
    Robinson Technologies

Similar Threads

  1. Rotating tiles/entities
    By sphair in forum Novashell Game Creation System
    Replies: 0
    Last Post: 03-12-2007, 09:33 PM
  2. Some brain requests (might already be there?)
    By whisperstorm in forum Novashell Game Creation System
    Replies: 3
    Last Post: 01-04-2007, 11:46 AM
  3. Announcement: State Secrets
    By jjohn in forum Game development
    Replies: 0
    Last Post: 09-13-2005, 12:12 AM
  4. brain types list
    By rabidwolf9 in forum Dink Smallwood HD
    Replies: 2
    Last Post: 01-08-2005, 08:32 PM
  5. I NEED SETHS EMERGENCY BACKUP BRAIN!
    By onlinegaminggod in forum RTsoft Tavern
    Replies: 2
    Last Post: 07-25-2002, 08:46 AM

Bookmarks

Bookmarks

Posting Permissions

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