Ultroman

  • Content count

    1,049
  • Joined

  • Last visited

Community Reputation

330 Excellent

About Ultroman

  • Rank
    Senior Member

Recent Profile Visitors

1,253 profile views
  1. So, you think you're good here, then? No more questions about this part? I'm a bit confused as to whether you are asking a question xD Nice that you already have the configuration ready for keys.
  2. Try this. I commented out self.forcenightvision, because I think you wanted to do that on the playervision component, but you're already doing that by calling the ForceNightVision function. local _G = GLOBAL local function GetKeyFromConfig(config) local key = GetModConfigData(config) return key and (type(key) == "number" and key or _G[key]) end local key = GetKeyFromConfig("nv") nvk = false _G.TheInput:AddKeyUpHandler(key, function () nvk = not nvk if nvk == true then _G.ThePlayer.components.playervision:ForceNightVision(true) _G.ThePlayer.components.playervision:SetCustomCCTable(BEAVERVISION_COLOURCUBES) --self.forcenightvision = true _G.ThePlayer.components.talker:Say("Night Vision enabled") else _G.ThePlayer.components.playervision:ForceNightVision(false) _G.ThePlayer.components.playervision:SetCustomCCTable(nil) --self.forcenightvision = false _G.ThePlayer.components.talker:Say("Night Vision disabled") end end)
  3. Night vision(client)

    You are having trouble, because you think you are getting the inst and self parameters passed to the function you are hooking up to the key-handler, but the key-handlers do not provide any parameters.
  4. local SpawnHounds = function() -- Spawn the hounds and whatever. Probably make some kind of cooldown timer. end GLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_H, SpawnHounds) KEY_H should correspond to the H key on the keyboard. You can make the key customizable by adding an option in the mod configuration. local SPAWN_HOUNDS_KEY = GetModConfigData("HoundSpawnKey") local SpawnHounds = function() -- Spawn the hounds and whatever. Probably make some kind of cooldown timer. end GLOBAL.TheInput:AddKeyDownHandler(SPAWN_HOUNDS_KEY, SpawnHounds) Then you'd have to find the list of possible keys in constants.lua. I'd try to find a mod with a customizable key, and steal their configuration Keep in mind, though, that AddKeyDownHandler fires every frame where you hold down the key, while AddKeyUpHandler only fires when you let go of the key.
  5. Assistance with two perks

    You should probably use AddKeyUpHandler instead of AddKeyDownHandler. AddKeyDownHandler fires every frame where you hold down the key, while AddKeyUpHandler only fires when you let go of the key.
  6. Problem with States

    It seems like you were already doing what has to be done. Track down exactly where something goes haywire, just by printing state all the time and all over the place, until you see something that isn't quite right. Then you can slowly turn off the broad phase debugging, and start printing more variables to ensure they are what you think they should be. I can't look at that mountain of code and instantly tell you where the problem is. Only if I was lucky enough to stare right at it and have the right brainwave.
  7. This will tell you how to change the animation build at your wim. You just need to instead listen to your character's "sanitydelta" event. See which parameters you get with it. You get oldpercent and newpercent in the data parameter. If you'd rather cut at percentages you can do it like that. If you want the thresholds to be an integer sanity value instead, here's the code for that. local isInSecondForm = false local function TurnBackToNormal(inst) -- Do whatever is needed to be in the normal state. -- You at least need to change the animation build, if your character needs to look different. inst.AnimState:SetBuild("normal") isInSecondForm = false end local function TurnIntoSecondForm(inst) -- Do whatever is needed to be in the shadow creature state. -- You at least need to change the animation build, if your character needs to look different. inst.AnimState:SetBuild("secondform") isInSecondForm = true end local function OnSanityDrop(inst, data) -- Make sure not to react while the player is dead. if inst:HasTag("playerghost") or inst.components.health and inst.components.health:IsDead() then return end -- If sanity drops below 1, we become a shadow creature. if not isInSecondForm and inst.components.sanity.current < 1 then TurnIntoSecondForm(inst) -- Otherwise, if sanity gets back above 50, we become normal again. elseif isInSecondForm and inst.components.sanity.current > 50 then TurnBackToNormal(inst) end end -- Put this in master_postinit function inst:ListenForEvent("sanitydelta", OnSanityDrop)
  8. Sorry, m8. I don't know enough about it to answer. Perhaps it's just including new anim files and making a prefab postinit where you change the anim bank and build of the prefab? If the prefab changes anims, then maybe that approach will get annoying.
  9. There's no such thing as a "mushroom" foodtype. food.components.edible.foodtype == "mushroom" In the Hamlet code I could only find these: GENERIC MEAT ELEMENTAL WOOD HORRIBLE RAW VEGGIE ROUGHAGE GEARS GOLDDUST INSECT BONE TASTY maybe more...see constants.lua for FOOD_TYPES, FOOD_GROUPS and more. If it's one single edible item you want to give this burn rate, then check food.prefab == "prefabname". If it's seceral prefabs, then you need to do the same kind of thing we did with the foodbonuses.
  10. Is it not good enough to look at the code for the original characters? Genuine question. I haven't worked with character mods myself.
  11. I need to see where you use your OnEat function. E.g. your fn() or master_postinit() function, where you hook up OnEat to your character's eater component.
  12. Did you hook up the OnEat function properly? I'd need to see your code.
  13. Yes, I think that's in the swap_wand SCML file. abs_y or abs_pivot_y, depending on what you want. Subtract a bit from either, and see how it reacts in animations. Messing with the pivot might make it not rotate correctly with the arm.
  14. OK, I fixed it. There was something wrong with your animation builds, and a bunch of references were wrong. Also, OnThrown it tried to use an animation your don't have (the spinning boomerang animation) on line 38 in wand.lua. I just commented it out for now. The item flies through the air now. wand.zip
  15. This shows pretty clearly what's wrong. You're missing the = sign on those lines.