Search Unity

uMMORPG Official Thread

Discussion in 'Assets and Asset Store' started by mischa2k, Dec 29, 2015.

  1. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    yes but my main problem is how I can do it, how I replace the mesh? for the monsters, npc or Player because I cant do it, I see many videos and all are complete diferent that the one that I have in the skeleton mosnter in the pack. please if any one can do step by step how I can do it, it be very nice guys. Thank you for all support
     
  2. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    You pretty much just drag your fbx model into the player model, so that the fbx is a child of the player. Just like in any other Unity project.
     
  3. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    Finally now how to change the mesh, I replace it and i get this any idea why I can attack him? and how fix this?
     
  4. MarkVatani

    MarkVatani

    Joined:
    Sep 4, 2012
    Posts:
    39
    It looks like your new mesh is turned 180 degrees, so it faces backwards. Also, make sure your animations are set properly in the animation controller, so that they play under the right parameters. For example, when the NPC dies, it must happen when the HP in the attached monster.cs component reaches 0. It's best to copy the animation controller from the existing skeleton and just change out the "motion" animation in the inspector to you new mesh's animation for dying.
     
  5. MarkVatani

    MarkVatani

    Joined:
    Sep 4, 2012
    Posts:
    39
    For the devs: I noticed the skills don’t remain on Skillbar for existing characters when joining later.
     
  6. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Like @SecondMouse said, you should rotate your mesh by 180 degree on the Y axis. You can simply add an empty child GameObject to your monster, move all your mesh objects in their and then rotate it by 180 degree.

    Seems like you are almost there though..
     
  7. kyozanuro

    kyozanuro

    Joined:
    Mar 10, 2016
    Posts:
    3
    How to make a MMORPG without client side prediction?
     
  8. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    What do you mean exactly?
     
  9. kyozanuro

    kyozanuro

    Joined:
    Mar 10, 2016
    Posts:
    3
    I see your package has the ability to move the character by ASDW keys. But it's not using client prediction, isn't it?
    As i see 99% of MMORPG which use ASDW keys have client prediction (predict moving, attacking, sounds, blood effects...)
    more:http://gabrielgambetta.com/fpm2.html
     
  10. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Yes, client side prediction isn't implemented yet.

    For click movement we don't really need it, since we only synchronize the destination and the client will then calculate it's own path. This works pretty good and feels very much in sync.

    For WSAD movement we might implement it sooner or later after more important features are finished. This is not an easy task of course, so it will definitely take some time and research.
     
  11. kyozanuro

    kyozanuro

    Joined:
    Mar 10, 2016
    Posts:
    3
    You can take a look at this: https://roystanross.wordpress.com/downloads/
    I know using unity built-in physics is hopeless.
     
  12. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    Im Still have same problem with the animations, I make new animator controller for this hero character and I insert all animations, and still not show all animations and I set the correct avatar and the correct animation controller, any tip what can i do? I leave short video to better describe my situation. thanks any reply helps a lot.
     
  13. MarkVatani

    MarkVatani

    Joined:
    Sep 4, 2012
    Posts:
    39
    Don't create a new animation controller. Make a COPY of the animation controller from the Skeleton and modify that with the animations from your new model.
     
    mischa2k likes this.
  14. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    I did only make copy only from skeleton controller and replace only the animations and still nothing any other tip that I missing? any one please help. Im attach a link, Thank you
     
  15. MarkVatani

    MarkVatani

    Joined:
    Sep 4, 2012
    Posts:
    39
    Watch this. It'll illustrate what I mean.
     
  16. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Can you please put into words what exactly your issue is and what exactly you did and what exactly works / doesn't work? A 360p video is kinda hard for debugging.
     
  17. MarkVatani

    MarkVatani

    Joined:
    Sep 4, 2012
    Posts:
    39
    That video is for the guy (luis29vm) who couldn't get his new monster animations working. I'm good here. uMMORPG is working great for me, and that video should help him.
     
    Last edited: Oct 31, 2016
  18. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Ah, sorry. Quoted the wrong post :)

    I am not sure if your problem is solved now or not. In general, please write down exactly what you did and then explain exactly what does / what doesn't work. Perhaps also add screenshots. This is the quickest way to get your problems resolved.
     
  19. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    Thank you very much finally I change the animations. you save me a lot time and problems... xd
     
  20. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Ok, good to hear.
     
  21. GOLDY00

    GOLDY00

    Joined:
    Mar 16, 2013
    Posts:
    139
    I was wondering is it possible to get some one to sorta do some tutorial videos on the basics like making new weapons or shields or character swapping animation swapping stuff like that it will be awesome I would but at the moment all I know how to do is put items in and I only just got a sword in that's all thanks in advance
     
  22. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    For those who would like to change gold color based on gold amount on player inventory, here is small example for you:

    Code (CSharp):
    1. // open file Scripts/_UI/UIInventory.cs and find line with comment gold and after that add
    2.  
    3.            if(player.gold>50){
    4.                 goldText.color = new Color(.973f, .275f, .231f);
    5.            } else if(player.gold>10){
    6.                 goldText.color = new Color(0f, .8f, .8f);
    7.            }
    8.  
    About color codes, you need to use RGB and divide every number with 255 or use already predefine color name variables which can be found from https://docs.unity3d.com/ScriptReference/Color.html
     
    mischa2k likes this.
  23. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    I usually add tutorials to the documentation's How-To section. I prefer text over video because it's easier to change whenever something changes in the code (instead of recording a whole new video).
     
  24. MarkVatani

    MarkVatani

    Joined:
    Sep 4, 2012
    Posts:
    39
    I want passive monsters. How do I set a monster to attack a player only if the monster is attacked first?
     
    Last edited: Nov 2, 2016
  25. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    Do you try adjust the agro range? Maybe if you put in the minimum ,works
     
  26. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    I try make Mage class any tip? I all ready make 2 diferent class, I have barbs , knight and hunter,but Mage I don't have a clue any one know How to set up? Thank you guys.
     
  27. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    Mages, wizards are usually casting skills, so i guess you could use projectile to show that fireball or something else is going to hit the monster and when it impacts then you should probably show somekind effect.
     
    mischa2k likes this.
  28. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    @vis2k do you have any plan to make a button or something like that to let the player auto stack items on player inventory? At the moment player must drag items to each other to just get them stacked on one slot, but i thought that maybe there is a way to make just simple button which will arrange that automatically. Or then let the items stack after those has been collected/boughted.
     
  29. GOLDY00

    GOLDY00

    Joined:
    Mar 16, 2013
    Posts:
    139
    can somee one help me im trying to change so when you create a charector its not a dropbox its buttons 3 accross 3 high there is this script how i change it soits like multiple buttons instead
    using UnityEngine;
    using UnityEngine.UI;
    using UnityEngine.Networking;

    public class UICharacterCreation : MonoBehaviour {
    [SerializeField] GameObject panel;
    [SerializeField] InputField inputCharacterName;
    [SerializeField] Dropdown dropdownClass;
    [SerializeField] Text dropdownCurrent;
    [SerializeField] Button createButton;
    [SerializeField] Button cancelButton;

    // cache
    NetworkManagerMMO manager;

    void Awake() {
    // NetworkManager.singleton is null for some reason
    manager = FindObjectOfType<NetworkManagerMMO>();

    // button onclicks
    createButton.onClick.SetListener(() => {
    var msg = new CharacterCreateMsg();
    msg.name = inputCharacterName.text;
    msg.classIndex = dropdownClass.value;
    manager.client.Send(CharacterCreateMsg.MsgId, msg);
    });
    cancelButton.onClick.SetListener(() => {
    inputCharacterName.text = "";
    Hide();
    FindObjectOfType<UICharacterSelection>().Show();
    });
    }

    void Update() {
    // only update if visible
    if (!panel.activeSelf) return;

    // hide if disconnected
    if (!NetworkClient.active) Hide();

    // copy player classes to class selection
    dropdownClass.options.Clear();
    foreach (var p in manager.GetPlayerClasses())
    dropdownClass.options.Add(new Dropdown.OptionData(p.name));

    // we also have to refresh the current text, otherwise it's still
    // 'Option A'
    var idx = dropdownClass.value;
    dropdownCurrent.text = dropdownClass.options[idx].text;
    }

    public void Hide() { panel.SetActive(false); }
    public void Show() { panel.SetActive(true); }
    }
     
  30. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Set the aggro area radius to 0.

    See @cioa00's answer.

    Not really planned at the moment. You could easily add that though. Just needs a UI button and the sorting logic could even happen in the UI script. Just use CmdInventorySwap etc. commands.

    The script already has examples on how to use buttons like the createButton. Just add UI buttons in the Canvas and then modify the code to use those buttons.
     
  31. GOLDY00

    GOLDY00

    Joined:
    Mar 16, 2013
    Posts:
    139
    thats the thing im not sure about how to do i dont want it to be a drop down box for the warrior and archer i want it to be buttons
     
  32. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Read through the Unity manual for the new UI. It's a bit difficult at first, but once you get used to it it's really easy.
     
  33. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    Good point. I will take look on that. Before i posted my question i had idea to try going on this way:
    1) checking what is in the inventory
    2) create two lists, where list A contains item name=maxStack and list B contains name=(counted amount value, which will be increased every time when item has been found)
    3) loop inventory items and populating lists with required data
    4) cleaning inventory and putting stacked items back, where items will be set up to their maxStack value (B[item.name]/A[item.name] -> then we know how many inventory slots will be used, ofc stack numbers should be updated over the item picture too)

    Maybe i was overthinking and there is possible to make it way easier way.
     
    Last edited: Nov 2, 2016
  34. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    Any Idea how i link the Fire ball projectile to the Mage? I try to see how it works with the Archer how attack the arrow, but I dont know how to synk the attack, can some one help? or give a tip? Thank you for the support
     
  35. jagatai33

    jagatai33

    Joined:
    Feb 2, 2016
    Posts:
    165
    A while back i added a few lines of reusable code from CmdInventoryMerge to auto merge (Stack) items as they are looted if the item is in the players inventory, so auto stack stack-able items.

    Basically go into Player.cs and replace CmdTakeLootItem() with the code below:
    Code (CSharp):
    1.     [Command]
    2.     public void CmdTakeLootItem(int index) {
    3.         // validate: dead monster and close enough and valid loot index?
    4.         // use collider point(s) to also work with big entities
    5.         if ((state == "IDLE" || state == "MOVING" || state == "CASTING") &&
    6.             target != null && target is Monster && target.hp == 0 &&
    7.             Utils.ClosestDistance(collider, target.collider) <= lootRange &&
    8.             0 <= index && index < ((Monster)target).lootItems.Count)
    9.         {
    10.             // find a free inventory slot
    11.             var monster = (Monster)target;
    12.             var freeIdx = inventory.FindIndex(item => !item.valid);
    13.             if (freeIdx != -1) {
    14.                 // take it
    15.                 var item = monster.lootItems[index];
    16.  
    17.                 // Added for auto stack when looting
    18.                 var _item = inventory.FindIndex(stack => stack.valid && stack.maxStack > stack.amount && monster.lootItems[index].name == stack.name);
    19.                 if (_item != -1) {
    20.                     var itemTo = inventory[_item];
    21.                     var stack = Mathf.Min(item.amount + itemTo.amount, itemTo.maxStack);
    22.                     var put = stack - item.amount;
    23.                     item.amount = itemTo.amount - put;
    24.                     itemTo.amount = stack;
    25.                     inventory[_item] = itemTo;
    26.                 } else {
    27.                     inventory[freeIdx] = item;
    28.                 }
    29.  
    30.                 // clear it
    31.                 // note: Item has a .valid property that can be used to 'delete' an
    32.                 //       item. it's better than .RemoveAt() because we won't run into index-
    33.                 //       out-of-range issues
    34.                 item.valid = false;
    35.                 monster.lootItems[index] = item;
    36.             }
    37.         }
    38.     }
    Hope this helps.

    Sorry had to re-paste code.

    -J
     
    Last edited: Nov 2, 2016
    cioa00 likes this.
  36. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    Oh, this is something interesting. I forgot that option at all - merge items after they has been looted. Quite brilliant idea :)
     
  37. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    @jagatai33 The only issue which is see at the moment is when you happend to give same items (ex. hp potion) on monster loot drop list, then you can stack only first hp potion and second potion can't be stack or drag to any slot. But overall it`s working as i expected :)
     
  38. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    You don't need any new scripts. Just create a new skill similar to 'Precise Shot' etc., replace the projectile, give the skill to the mage.
     
  39. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    I expected exactly what you had explained (i probably didn't explained quite well), but somehow only first hp potion will stack and second doesn't stack or doesn't show up on new slot (had few potions on different inventory slots). As you can see on pictures below, when i tried to loot potion (first one already stacked) then it doesn't show up on inventory. I`ll try later that again with clean project files, not sure at the moment if something what i have changed might have some effect on looting/inventory actions.


     
  40. jagatai33

    jagatai33

    Joined:
    Feb 2, 2016
    Posts:
    165
    Yeah thats actually a bug with CmdTakeLootItem, if you added 2 HP Potions into the monster drop list you can only pick one up at a time. Ill look into this unless vis2k has the extra cycles and wants to squeeze it into v1.40? :)

    -J
     
  41. jagatai33

    jagatai33

    Joined:
    Feb 2, 2016
    Posts:
    165
    So good news, its fixed now, it turned out it wasnt an issue with CmdTakeLootItem, it was inside UILoot.cs.

    Below is the fix, replace UILoot.cs with the code below:
    Code (CSharp):
    1. // Note: this script has to be on an always-active UI parent, so that we can
    2. // always find it from other code. (GameObject.Find doesn't find inactive ones)
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5. using System.Linq;
    6.  
    7. public class UILoot : MonoBehaviour {
    8.     [SerializeField] GameObject panel;
    9.     [SerializeField] GameObject goldSlot;
    10.     [SerializeField] Text goldText;
    11.     [SerializeField] GameObject itemSlotPrefab;
    12.     [SerializeField] Transform content;
    13.  
    14.     void Update() {
    15.         var player = Utils.ClientLocalPlayer();
    16.         if (!player) return;
    17.  
    18.         // use collider point(s) to also work with big entities
    19.         if (panel.activeSelf &&
    20.             player.target != null &&
    21.             player.target.hp == 0 &&
    22.             Utils.ClosestDistance(player.collider, player.target.collider) <= player.lootRange &&
    23.             player.target is Monster &&
    24.             ((Monster)player.target).HasLoot()) {
    25.             // cache monster
    26.             var mob = (Monster)player.target;
    27.  
    28.             // gold slot
    29.             if (mob.lootGold > 0) {
    30.                 goldSlot.SetActive(true);
    31.  
    32.                 // button
    33.                 goldSlot.GetComponentInChildren<Button>().onClick.SetListener(() => { player.CmdTakeLootGold(); });
    34.  
    35.                 // amount
    36.                 goldText.text = mob.lootGold.ToString();
    37.             } else goldSlot.SetActive(false);
    38.  
    39.  
    40.             // instantiate/destroy enough slots
    41.             // (we only want to show the not-empty slots)
    42.             var items = mob.lootItems.Where(item => item.valid).ToList();
    43.             UIUtils.BalancePrefabs(itemSlotPrefab, items.Count, content);
    44.  
    45.             // refresh all item slots
    46.             for (int i = 0; i < items.Count; ++i) {
    47.                 var entry = content.GetChild(i).GetChild(0).GetChild(0); // slot entry
    48.                 entry.name = i.ToString(); // for drag and drop
    49.  
    50.                 if (items[i].valid) {
    51.                     // click event (done more than once but w/e)
    52.                     var itemIndex = mob.lootItems.FindIndex(item => item.valid && item.name == items[i].name); // real item list index
    53.                     entry.GetComponent<Button>().onClick.SetListener(() => {
    54.                         player.CmdTakeLootItem(itemIndex);
    55.                     });
    56.                    
    57.                     // set state
    58.                     entry.GetComponent<UIShowToolTip>().enabled = items[i].valid;
    59.                     entry.GetComponent<UIDragAndDropable>().dragable = items[i].valid;
    60.                     // note: entries should be dropable at all times
    61.  
    62.                     // image
    63.                     entry.GetComponent<Image>().color = Color.white;
    64.                     entry.GetComponent<Image>().sprite = items[i].image;
    65.                     entry.GetComponent<UIShowToolTip>().text = items[i].Tooltip();
    66.  
    67.                     // name
    68.                     entry.parent.parent.GetChild(1).GetComponent<Text>().text = items[i].name;
    69.  
    70.                     // amount overlay
    71.                     entry.transform.GetChild(0).gameObject.SetActive(items[i].amount > 1);
    72.                     if (items[i].amount > 1) entry.GetComponentInChildren<Text>().text = items[i].amount.ToString();
    73.                 }
    74.             }
    75.         } else panel.SetActive(false); // hide
    76.     }
    77.  
    78.     public void Show() { panel.SetActive(true); }
    79. }
    80.  
    It was just a matter of adding item.valid so the new itemIndex returned the new valid state of the monsters loot list.

    hope this helps.
    -J
     
  42. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    Yes it does work as expected :p Thank you
     
    jagatai33 likes this.
  43. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    Hello morning all, I making a Mage Class, and I did all the new skills for the mage and I put learn by defaul in the mage player at the moment only have proyectile arrow and Im testing with the arrow. I duplicate the Archer player and the new one is the Mage. but went i go attack all was perfect skills works animations and all works good but not show any damage to the mosnter and not show the arrow. any tip what can i do?
     

    Attached Files:

  44. jagatai33

    jagatai33

    Joined:
    Feb 2, 2016
    Posts:
    165
    make sure what ever weapon your using for your mage has a "ProjectileMount" object on it, use the White Bow as an example.

    -J
     
  45. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    Im Using the the Bow as weapon.
     

    Attached Files:

  46. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    Beacouse I dont know yet how to set up a staff weapon, Im using the defaul templet from the archer. And I have the same problem with the Archer, I using the Bow from the base Archer and not show up only make the attacks, but not make any damage, I missing something But i Dont know What can it be. :(
     
    Last edited: Nov 3, 2016
  47. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    You found a bug in UILoot? Can you tell me what exactly to do to see it in a fresh uMMORPG version?
     
  48. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Does the projectile fly towards the monster and hit it?
     
  49. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    thank you I solve this Problem. with the archer now im go try with the mage :)
     
  50. jagatai33

    jagatai33

    Joined:
    Feb 2, 2016
    Posts:
    165
    hey @vis2k

    add a few health potions to the skeletons drop chance, after you kill the monster youll notice you can only loot one of its type, so i added item.valid when finding the index for itemIndex.

    Code (CSharp):
    1.                     var itemIndex = mob.lootItems.FindIndex(item => item.valid && item.name == items[i].name); // real item list index
    let me know if you need more details.

    -J