LongFeiaot Posted March 16, 2016 Share Posted March 16, 2016 I have designed a few components(including level,exp,skill,CD and etc.) and UI for my character.They works well in server side.To make them work in client side ,I add these components in common_postinit function.But They don't change the data. For example, in server side, I can click the add button to make the skill's level up to 1,but I can't do that in client side. What's more, I can't use the data such as level,exp etc which were saved in the components when I was in client side. How to solve this problem? Insert other media Link to comment Share on other sites More sharing options...
Aquaterion Posted March 16, 2016 Share Posted March 16, 2016 I had the same problem, I was told to use net variables Link to comment Share on other sites More sharing options...
LongFeiaot Posted March 16, 2016 Author Share Posted March 16, 2016 Oh,Thanks,that is a way to solve. By the way, is there any example for how to use replica?I know how to create it, but don't understand how it work. Link to comment Share on other sites More sharing options...
Kzisor Posted March 18, 2016 Share Posted March 18, 2016 @LongFeiaot take a look at the following links. Link to comment Share on other sites More sharing options...
LongFeiaot Posted March 18, 2016 Author Share Posted March 18, 2016 @Kzisor Wow, excellent! I have read the code and learnt how to do.Thank you very much. 2 quetions more: 1、In your levelbadge.lua, I see the function OnUpdate. When does it fire? I don't konw how to use it so I use event to transfer data between UI and components, but I think your code is more concise 2、Do you know how to make a UI can be drag?I means that like items can be pick up by mouse from inventory. I can read code, so,to save your time, you can simply tell me what file to learn. PS,why don't add these code to the GUIDE? It's really useful. Link to comment Share on other sites More sharing options...
LongFeiaot Posted March 18, 2016 Author Share Posted March 18, 2016 two more questions: 1、The function ListenForEvent has 3 parameters,I know how to use the first and second one,but can't understand the third one even though I read the function definition code . 2、In hunger.lua , I see the class function use 3 parameters,the second is nil and the third is a table containing some data which have been define in the first parameter,and these data is related to replica. I used to think it is important for replica, but you don't use them.So,what is their role? Link to comment Share on other sites More sharing options...
Kzisor Posted March 18, 2016 Share Posted March 18, 2016 14 hours ago, LongFeiaot said: @Kzisor Wow, excellent! I have read the code and learnt how to do.Thank you very much. 2 quetions more: 1、In your levelbadge.lua, I see the function OnUpdate. When does it fire? I don't konw how to use it so I use event to transfer data between UI and components, but I think your code is more concise 2、Do you know how to make a UI can be drag?I means that like items can be pick up by mouse from inventory. I can read code, so,to save your time, you can simply tell me what file to learn. PS,why don't add these code to the GUIDE? It's really useful. 1) OnUpdate is fired when the game engine tells it to fire. 2) I'm sorry, but I don't know if that is possible. 14 hours ago, LongFeiaot said: two more questions: 1、The function ListenForEvent has 3 parameters,I know how to use the first and second one,but can't understand the third one even though I read the function definition code . 2、In hunger.lua , I see the class function use 3 parameters,the second is nil and the third is a table containing some data which have been define in the first parameter,and these data is related to replica. I used to think it is important for replica, but you don't use them.So,what is their role? 1) The third parameter is the instance which will be used to listen on. Look at some of 'TheWorld' code for players to understand more about it. 2) They allow the server to automatically formulate replica data on the client side, I don't use them because they are not entirely needed. Link to comment Share on other sites More sharing options...
Muche Posted March 19, 2016 Share Posted March 19, 2016 On 18. 3. 2016 at 9:35 AM, LongFeiaot said: 2、Do you know how to make a UI can be drag?I means that like items can be pick up by mouse from inventory. Enable attached client mod. In the main menu a small rectangle will appear that can be dragged around. modmain.lua Link to comment Share on other sites More sharing options...
LongFeiaot Posted March 20, 2016 Author Share Posted March 20, 2016 Nice example!Thank you very much. Link to comment Share on other sites More sharing options...
Muche Posted March 29, 2016 Share Posted March 29, 2016 On 18. 3. 2016 at 3:36 PM, Muche said: Enable attached client mod. In the main menu a small rectangle will appear that can be dragged around. modmain.lua Now as a reusable module (aimed at window dragging though) - http://steamcommunity.com/sharedfiles/filedetails/?id=655603539 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now