• Content Count

  • Joined

  • Last visited

Community Reputation

43 Excellent


About Ryuushu

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks a lot for your explanation @DarkXero, now it's working (for reals this time). Thank you too @ptr.
  2. @ptr Well, on a first look it worked. It did find the reference to the function.. but when I tried to modify it I realized it it was the one outside the constructor. How can I access the one inside of it? This is what I have now AddComponentPostInit("age", function(self, ...) local fn = UpvalueHacker.FindUpvalue(self._ctor, "OnSetOwner") print("FindUpvalue", fn) -- This prints correctly local function OnSetOwner(...) print("OnSetOwner") -- This doesn't prints return fn(...) end UpvalueHacker.SetUpvalue(self._ctor, OnSetOwner, "OnSetOwner") -- It's doing nothing since it's the one outside the constructor </3 end)
  3. @ptr Ahh, I didn't know that. AddComponentPostInit worked perfectly. Thanks a lot!
  4. @ptr I just tried this AddClassPostConstruct("components/age", function(self, ...) local fn = UpvalueHacker.FindUpvalue(self._ctor, "OnSetOwner") print("This is what I found:", fn) end) And the result I get is "This is what I found: nil". Can you point out what's wrong?
  5. How can I use rezecib's UpvalueHacker util to modify this onAttacked event? local function onAttacked(player, data) ... end ... local SomeComponent = Class(function(self, player) ... player:ListenForEvent("attacked", onAttacked) -- <- event listener I wanna modify end) I just can't figure out the root for the component.. I've tried randomly guessing self.class, self.Class, self.fn, self._ctor but none have worked. Maybe the author can help me on this? @rezecib
  6. @Eusong I ran into that problem a few days ago, eventually started using it as a feature. Move swap_body-13 outside the swap folder and rename it vaultsuit or something else before using it in an anim.
  7. Oh, no I meant when it's on the ground. When you do AnimState:SetHaunted(true) it stays "haunted" forever (as in with the cool spooky animated white sheen). I just want to recolor the haunted effect, the default is white, I want it red. Still, thank you~
  8. Has anyone experimented with that? I've been looking as to how make any object have a nice colored sheen-like anim like when ghosts haunt them, but so far I've been unlucky. The game just does inst.AnimState:SetHaunted(true) to add it, so it might be something in the C++ side.. in which case I'm out of luck. Any ideas/suggestions?
  9. That isn't a bug with your mod, but rather with the game, motd.tex seems to be missing for some reason. I'm almost sure the game is crashing for everyone else too.
  10. So far I got my compass widget working, but when I try to change the default arrow for my custom one it doesn't shows up at all. I was digging around the files and it seems that the hud loads its resources by creating a prefab, but when I try to do the same it still doesn't works. My question is, how do I load an Anim for my hud element? I have the following: widgets/rotatingcompass.lua ... self.needle = self:AddChild(UIAnim()) self.needle:GetAnimState():SetBank("one_direction_needle") self.needle:GetAnimState():SetBuild("one_direction_needle") self.needle:GetAnimState():PlayAnimation("idle") ... prefabs/one_direction_needle.lua local assets = { Asset("ANIM", "anim/one_direction_needle.zip"), } local prefabs = { } --we don't actually instantiate this prefab. It's used for controlling asset loading local function fn() return CreateEntity() end return Prefab("one_direction_needle", fn, assets, prefabs) modmain.lua PrefabFiles = { "one_direction_needle", } Assets = { Asset("ANIM", "anim/one_direction_needle.zip") } ... Also, attaching the anim files. one_direction_needle.zip one_direction_needle[EXPORTED].zip EDIT: I'm doing something wrong with the anims. Setting the Bank to "compass_needle" (the one from the base game) and the Build to "one_direction_needle" (the one from my mod) seems to work.
  11. I guess it crashes because OBEDIENCE_DECAY_RATE is a local value. If you do a quick, easy little search in the file you will be able to find where that value is used, which is a local function which is called by a public one. So, you could do: AddComponentPostInit("domesticatable", function(component) local oldCheckAndStartTask = component.CheckAndStartTask component.CheckAndStartTask = function(component) oldCheckAndStartTask() component:CancelTask() end end) CheckAndStartTask() starts the obedience decay task, so we just call this function for a moment (in case other mod uses it for some reason) and then we cancel the decay task right away. I might be missing some params since I don't really play around with components, but the answer should be more or less like this.
  12. You'll need to set sanityaura's aurafn to make it return a value higher than 0 only when the player is illya, like so: local function CalcSanityAura(inst, observer) return observer.prefab == "illya" and 2 or 0 end ... inst.components.sanityaura.aurafn = CalcSanityAura
  13. Basically, I'm trying to get the active wormhole when the player uses it from the client side. I was trying to hook into the player's stategraph and get it with FindEntities, but it says that sg is nil with the following: AddPlayerPostInit(function(inst) print(inst.sg) end) Am I missing something? Also, is there an easier way to do this? The wormhole pushes some events to the doer but I'm not sure if you can listen to them as a client. EDIT: Forgot AddStategraphPostInit is a thing. Also, FindEntities. Got it all working now. I'm still interested in the events though, to optimize things.
  14. @YordlePrincess Hmm, could you upload the file where you are trying to modify the food? (modmain.lua or mycustomfood.lua). I think it'd be easier to take a look at the code as a whole.
  15. @rons0n Assuming you already have the stategraph state and the stategraph action handler, and maybe a component related to it, you could do something like this: AddAction("SWITCHEROO","Exchange places", function(act) if act.target and CanBeCastedOn(act.target, act.pos) then local target_pos = Point(act.target.Transform:GetWorldPosition()) act.target.Transform:SetPosition(act.doer.Transform:GetWorldPosition()) act.doer.Transform:SetPosition(target_pos) return true endend)EDIT: Whoops, had some lines inverted.