Anstarveo Posted March 25, 2017 Share Posted March 25, 2017 (edited) If >= 2 players use my custom character in the same server then the skill won't work unless all of them activate it. I think the game use the same variable (local ZenRest, local MidStr, etc.) instead of individual variable for each of them? How can I fix this? modmain.lua oisaokuto.lua Edited March 26, 2017 by Anstarveo Link to comment Share on other sites More sharing options...
Serpens Posted March 25, 2017 Share Posted March 25, 2017 put these variables into a component and add it to the characters. Link to comment Share on other sites More sharing options...
Anstarveo Posted March 25, 2017 Author Share Posted March 25, 2017 Can you give an example? Link to comment Share on other sites More sharing options...
Serpens Posted March 25, 2017 Share Posted March 25, 2017 (edited) local MyComp = Class(function(self, inst) self.inst = inst self.myvariable = nil -- you can add as many vairables you like to end) function MyComp:OnSave() local data = {} data.myvariable = self.myvariable -- save variable return data end function MyComp:OnLoad(data) if data.myvariable ~= nil then self.myvariable = data.myvariable -- load my variable end end return MyComp put this into a script in your mod folder scripts/components. Of course you can rename "MyComp" and "myvariable" to whatever you prefer, but the name of the file should be the same name like you chose for "MyComp"but in lower letters. And in your characterfile you make "inst:AddComponent("MyComp")" where you also added other components (I guess it is in master_postinit. Now whenever you change the value for your character change it with: inst.components.mycomp.myvariable = x Edited March 25, 2017 by Serpens Link to comment Share on other sites More sharing options...
Anstarveo Posted March 26, 2017 Author Share Posted March 26, 2017 I follow your advice, but I change "inst:AddComponent("MyComp")" to "inst:AddComponent("mycomp") and everything works like a charm! Thank you very much! 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