Change Villager's name - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html) +--- Forum: Development (https://forum.cuberite.org/forum-13.html) +--- Thread: Change Villager's name (/thread-3192.html) Pages:
1
2
|
Change Villager's name - MGlolenstine - 08-01-2018 Ok, so I want to change Villager's name. To get the Villager, I can only use it's entity ID... How can I change it's CustomDisplayName and/or other properties? Thanks in advance RE: Change Villager's name - NiLSPACE - 08-02-2018 You can use the cMonster:SetCustomName method. You can use it like this: world:DoWithEntityByID(entityId, function(entity) entity:SetCustomName("Name") end) RE: Change Villager's name - MGlolenstine - 08-02-2018 (08-02-2018, 02:19 AM)NiLSPACE Wrote: You can use the cMonster:SetCustomName method. You can use it like this: That's what I tried, but it didn't work... Here's my code Code: local vilName = "Villager123" RE: Change Villager's name - NiLSPACE - 08-02-2018 Did you actually use <world>:DoWithEntityByID? Because simply defining a function doesn't immediately call it. RE: Change Villager's name - MGlolenstine - 08-02-2018 (08-02-2018, 05:27 AM)NiLSPACE Wrote: Did you actually use <world>:DoWithEntityByID? Because simply defining a function doesn't immediately call it. I did... Code: Player:GetWorld():DoWithEntityByID(Player:GetWorld():SpawnMob(Player:GetPosX(), Player:GetPosY(), Player:GetPosZ(), mtVillager, false), ChangeVillager) I do know how to code, but I'm new to LUA and Cuberite. RE: Change Villager's name - xoft - 08-02-2018 Maybe you know how to code (how are we supposed to know?), but we do know that you definitely suck at asking questions. http://catb.org/~esr/faqs/smart-questions.html#intro RE: Change Villager's name - NiLSPACE - 08-02-2018 Quote: but we do know that you definitely suck at asking questions. That's a little harsh, but you do have a point. Remember, we know nothing except the context you give us. Could you validate that the callback is actually being called? A simple print statement in the beginning should suffice. RE: Change Villager's name - MGlolenstine - 08-02-2018 (08-02-2018, 06:45 AM)NiLSPACE Wrote:Quote: but we do know that you definitely suck at asking questions. Well it is being called, as the Villager is "Invincible"... I just don't think that the SetCustomName is working, as it's the only thing in that code block that shows no results. And you xoft... I don't mind a bit of productive criticism, but I don't like toxic people but I totally understand. RE: Change Villager's name - xoft - 08-02-2018 Yeah, sorry, I'm in a bit foul mood today. I have a feeling that the custom name (or its change) is not propagated through the network protocol. If you log out and back in to the game, does the name update? RE: Change Villager's name - MGlolenstine - 08-02-2018 (08-02-2018, 07:01 AM)xoft Wrote: Yeah, sorry, I'm in a bit foul mood today. Don't worry, I hppe that you'll be in a better mood tomorrow . Sadly the name doesn't update on a relog, not even after I restart the server. I'm using Raspberry Pi 2B if that makes any difference. |