Registered Users
  • Content count

  • Joined

  • Last visited

Community Reputation

258 Excellent


About Serpens

  • Rank
    Senior Member
  1. I have no knowledge about custom sounds. But a few months ago I asked the author of the character mod "Medic" wich has a custom speech sound. His speech sound is not affected by the ingame volume settings. The author told me that this is normal for custom sounds. So maybe there is nothing you can do. If I'm wrong, someone correct me please
  2. thanks. Yes this was also the way I tried it already, but I hoped there would be a better way To get the "timeleft" we can also use "GetTaskRemaining(self.task)". But the reason why I was searching for another way was, that when the task is finished and the function called, the timeleft is not set to nil automatically. So I have to set it nil in this function. My code is a bit encapsulated, that's why I feared it could cause problems. But I will do it that way now and try to make sure that everything works.
  3. What is the proper way to save and restore tasks in a component? Eg. in my component I want to call a function after one day: self.task = self.inst:DoTaskInTime(TUNING.TOTAL_DAY_TIME,function(inst) ... end) When I now quit and load the game, this task has stopped, right? So how to resume the task with the time left? I could get the timeleft of the task when saving and start the task with that time again when loading, but this is a dirty workaround and won't work well I think...
  4. yes. "self.inst" is the instance that is eating. So the line could be: if self.inst:HasTag("player") and food.prefab=="pigksin" and not self.inst.prefab=="wheathghthoughougue" then
  5. I did a quick search and I meant sth like this in your modmain: AddComponentPostInit("eater", function(self) local _TestFood = self.TestFood self.TestFood = function(self, food, testvalues) if self.inst:HasTag("player") and food and food.prefab=="pigksin" then -- fordbid every player to eat pigksin return false else return _TestFood(self, food, testvalues) -- if it is not pigskin, return the old function end end end) This will forbid every player character to eat pigskin.
  6. don't know it right out of the box, but maybe just take a look at other mods that sets diet ? They will modify the eat function for a specific player with maybe "not HasTag("meat")" or similar. And instead of forbidding meat, you can just allow/forbid pigskin this way.
  7. please link your mod when it is finished. In case me or someone else will start working on the "adventure" mod again, maybe your mod could be helpful to realize the world with islands.
  8. I think when you use this "GetString" function for wilson, then it is searching for a string that contains "WILSON"... but I'm not 100% sure. So maybe you should use instead Say(GetRanomdItem(STRINGS.MODS.HUM_SHOP.ANNOUNCE_GONETEXT)) May I ask what kind of mod you are working on? Cause the mod I'm actually working on, a Quest-Mod, does also contain this guy as a shop You can get coins from doing quests (or find then while looting sth) and then you can buy some basic stuff at this guy. The questgiver is the pigking, but I also thought about giving this shopguy a few quests. Do you plan something similiar? If so we could work together. I build an "Quest-API" mod (90% finished), where anyone can simply add his custom quests and rewards. Maybe this could be helpful to you?
  9. 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
  10. put these variables into a component and add it to the characters.
  11. you have to define STRINGS.MODS.HUM_SHOP somewhere before you can fill it. So just put if not STRINGS.MODS.HUM_SHOP then STRINGS.MODS.HUM_SHOP = {} end you can leave out the "if then" stuff, if you are sure you do not delete the content of it.
  12. I have no experience creating a custom character, but I can imagine that code in master_postinit is only executed at server. And if you do stuff that should also be done for client in it, it of course does not work for clients/with caves active. Saving some values for your character is indeed better in a component, with OnSave and OnLoad. What values do you want to save? Only boolean/strings/numbers ? Or also instances? You could post the code of your component.
  13. Don't have time to look at your problem, but if your question is "how to mod replicas", maybe this code about builder component replica is helpful: -- builder mod for client AddClassPostConstruct("components/builder_replica", function(self) local _CanLearn = self.CanLearn self.CanLearn = function(self, recname) local recipe = GLOBAL.GetValidRecipe(recname) if recipe~=nil and not recipetestfn(recname,recipe,self.inst) then -- add a custom recipetestfn test return false else return _CanLearn(self, recname) end end end)
  14. I found it in the lucy prefab: inst.components.talker.colour = Vector3(.9, .4, .4)