Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Trying to figure best way to do party based rpg elements.

Discussion in 'Scripting' started by tawdry, Mar 8, 2015.

  1. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,356
    Hey guys so just been thinking a bit on ways to do a 3D party system. Here's the route i'm thinking of trying but if anyone has a better suggestion or spots a flaw please share.

    So in the game you can have up to 4 companions and have a potential 16 to choose from and swap between.. I thought maybe create 5 empty GO's for the transforms parent companions to the Go's then in update do the find component blah blah blah .(potential problems movement with a empty as the parent and null references when the empty GO's are not occupied.

    Now you can change the order the companions line up. i thought maybe have a scene open if u click "O" for order or some such. Then have 5 boxes a central one 2 in front and 2 at back. Have trigger colliders over the box and a list of available companion mugshots that can be dragged onto them. On trigger enter the companion would be assigned to the box its dragged to if available . A mouse click would remove a companion if it is occupying a box. (potential problem i have physics set to ignore triggers which disables mouseovers and clicks etc)
    Don't really know how to do much of this atm so don't want to waste time figuring it out if its not going to work.
     
  2. derPuppeteer

    derPuppeteer

    Joined:
    Mar 21, 2014
    Posts:
    23
    Of course this can work!

    I would recommend creating a movement script for your 5 empty transforms, so they follow each other independent of wether there is a character inside of them or not.
    Then you could attach your character prefabs to them and let them play some animations based on their movement.

    One other approach would be writing a movement script and assigning it to your characters directly. Each movement script has again a transform pointer to whom they should follow. Each time the party changes you would have to set those transforms again.

    One other hint on how you could do the movement itself:
    You could save the players position in regular intervalls (0.1s). This way you could let the party follow the players footsteps directly.
    This way you could also get rid of the transform pointers by instead defining how far away from the player they should walk (along that path).

    I hope that helped
     
  3. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,356
    Think i'm having a rethink on the 5 empty GO idea. As my chars are all using root motion might get tricky instead thinking maybe setting a bool at start of update for each possible companion and setting to true if in party and assigning a variable number based on position in party still got to fl;esh it out but might be less complicated i hope..Also how do u stop them spazzing out if they are supposed to maintain a certain distance from player but that distance places them in a navmesh nogo area ie position already occupied
     
    Last edited: Mar 8, 2015