News Forums RAIN Sample Projects, How To, and Code [RAIN Starter Kit] Basic Behaviors

This topic contains 50 replies, has 6 voices, and was last updated by  prime 6 months, 2 weeks ago.

Viewing 6 posts - 46 through 51 (of 51 total)
  • Author
    Posts
  • #36834

    prime
    Keymaster

    You are correct. You will need to code a target randomizing script. The Sensors and the Detect node are not random.

    You can create a custom action that uses a sensor to return an “any” match, then pick a random entry from the result list. Should be easy.

    #36856

    BrokenHelmet
    Participant

    I see. So, first thing would be to put all detected aspects (visual in my case) into an array/list.

    Is there a way to put all the afore mentioned detected aspects into the array/list. I’m thinking the “ALL” match would be my best bet…

    Then from there, choosing the random target is quite easy once I have them in the script…

    • This reply was modified 6 months, 2 weeks ago by  BrokenHelmet.
    #36861

    prime
    Keymaster

    You can do this:

    IList<RAINAspect> tMatches = AI.Senses.Sense("Visual Sensor", "someAspect", MatchType.ALL);

    to retrieve a list of matches.

    #36891

    Luger
    Participant

    Helo, is it possible to make something like click to move to the waypoint? I would discribe it like you click on terein and you get first waypoint and it’s action. Then character moves to it, stops there and then do some action. If I click another time while character moves, then it store another waypoint and it’s action, and move to it when first action is done?

    #36897

    BrokenHelmet
    Participant

    @prime: Thanks, I will give it a go.

    @Luger: Hey. There are quite a number of ways to accomplish this, which I am sure @prime can explain. However, if I understand your query, the first thing you would have to do, is to script a mouse click event (assuming it is for pc), which shoots a raycast that detects the position where the ray has hit on the terrain. This will then allow you to add a rain navigation target to said point. Alternatively, you could just create a prefab which gets instantiated at this transform point. The prefab can contain visual aspects among other components.

    After, it is a simple matter of the NPC detecting the aspect and moving towards it, and execute whatever action you want. This is all dependent on the BT you create. Alternatively, you could create a custom behaviour script for the NPC, reference it from the raycast script, and tell it what to execute as a custom action.

    I am sure there are still a number of other ways, but this is what I got from the top of my head. Hope it helps a bit.

    • This reply was modified 6 months, 2 weeks ago by  BrokenHelmet.
    #36908

    prime
    Keymaster

    Y - I would certainly do it using a custom action, where each time the player clicks I add another waypoint/action to a queue, then let the custom action pull things off the queue and execute them one by one.

Viewing 6 posts - 46 through 51 (of 51 total)

You must be logged in to reply to this topic.