News Forums RAIN General Discussion and Troubleshooting Trouble detecting Players, Photon Networked

This topic contains 6 replies, has 2 voices, and was last updated by  JeffTech 3 months, 1 week ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #34106

    JeffTech
    Participant

    Hi,

    The player gameobjects are renamed to username of the player when they are instantiated in the scene, detecting is an issue I can’t seem to figure how this would be done. The Entity Form is requiring the gameobjects name, any ideas or tutorials on setting this up for photon?

    Thanks Robert

    #34111

    prime
    Keymaster

    The Entity Form links to the object itself, not the name of the object. Changing the name of the game object at runtime should have no impact on sensors.

    #34112

    JeffTech
    Participant

    I found the problem, thanks. Are there any good tutorials for scripting firing a projectile (attack) using Rain?

    #34113

    prime
    Keymaster

    Not really. Generally RAIN would be used to trigger the action (gun firing bullet) but wouldn’t be responsible for managing the actual projectile or any of the game-related logic. Usually a Gun Manager or similar would do that. The Bootcamp demo from Unity is a bit complicated, but does have a GunManager you can look at. Also the Tornado Twins have a package called FPS Control that is free on the asset store. It uses an older version of RAIN and simulates gun fire - may be worth looking at.

    I’ll also put in a plug for our Squad Command: Advanced Warfighter AI package on the Asset Store. It is a working example of a battle scene that includes re-usable components for aiming, firing, health, and many other capabilities. The purpose of the package is to give developers a head start on rigging up shooter scenes with good AI, using RAIN.

    https://www.assetstore.unity3d.com/en/#!/content/23526

    #34114

    JeffTech
    Participant

    That’s cool, thanks! Is there a tutorial for the trigger action setup? One more question, I have the ai forever detecting in the first part and then splitting up between patrolling and moving toward the player… how do you get it to return to patrol if the player is no longer in range?

    #34117

    prime
    Keymaster

    We don’t have a specific tutorial for triggering an action. However, the general approach is to use a Custom Action whenever you need to interact with game logic/game code. Custom Actions let you define your own code, and can be used to define normal behaviors (like move and detect) that vary from the built-ins, special calculations (like calculating the distance between objects and setting the result in a memory variable), and making calls into non-RAIN code (like finding a component on the ai.Body using ai.Body.GetComponent<type>() and then calling a method on it.)

    For your second question - there are different ways to do it based on how you want the logic to work. The simplest way would be to add a constraint node as a parent to your “moving toward the player” behavior. A constraint node checks a condition every frame and fails/exits whenever that condition becomes false. If your constraint condition is “player != null” then the move behavior will fail whenever the player is missing. You could do the same for patrol - with a condition of “player == null”. Then create a structure like:

    PARALLEL
    — DETECT (REPEAT FOREVER)
    — SELECTOR (REPEAT FOREVER)
    — — CONSTRAINT (player == null)
    — — — PATROL
    — — CONSTRAINT (player != null)
    — — — MOVE TO PLAYER

    #34125

    JeffTech
    Participant

    That was a simple fix, thanks… AI is now returning to patrol. The custom actions part will have to wait for tomorrow, I understand what you mean I just need to see how it’s entered in Rain. I take a look at that project you mentioned.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.