TheSkylarr

  • Content Count

    223
  • Joined

  • Last visited

Community Reputation

38 Excellent

About TheSkylarr

  • Rank
    Member
...

Recent Profile Visitors

679 profile views
  1. Yeah, from what I can tell, there isn't anything built into the component to allow or disallow it, it could be as simple as adding a button that performs the action for you. Sadly, I can't help you with that though.
  2. Unless there's something built into the component, it's gonna be hard. Once I'm back on my main computer I'll see what I can do to help you.
  3. @Monti18 Hmm, I just sat in my test world attacking a target dummy for about a minute and a half and didn't notice any change with my code, but the numbers do seem a little weird. I'll test it a bit later and add it to the guide if necessary
  4. Understandable change there, glad I could help. Personally I like having all my speech lines in the speech files, but if works, it works. Good luck with your project.
  5. Okay, ignore my previous post, that doesn't work. I've got a a second one for you that doesn't require you to have special code in your characters prefab file, it just works with whatever if statement you want. AddStategraphPostInit("wilson", function(sg) local _attack = sg.states["attack"] -- This specifies which state we're adding to local _onenter = _attack.onenter _attack.onenter = function(inst,...) _onenter(inst,...) if inst.prefab == "hatkid" and not inst.components.combat.target:HasTag("monster") then -- this runs if the thing your character is attacking doesn't have the tag "monster" inst:ClearBufferedAction() -- Cancel the attack before it hits. inst.sg:GoToState("idle", true) -- Go to idle state, technically redundant but it keeps things neat. inst.components.talker:Say(GetString(player, "ACTIONFAIL_GENERIC")) -- This will use the characters speech file for this line. end return end end) In this example, once you change the prefab name (I used Hat Kid to test it), the specified character will not be able to attack anything that doesn't have the monster tag.
  6. Hello Modders, here's a quick guide on how to make your character punch things really quickly. We'll be using AddStategraphPostInit here, so you'll want to throw these into your modmain.lua. Make sure to read the comments in the code, to adjust the things you'll need to adjust! I used Wilba from Hamlet to test here, but unless you're ripping off hamlet, you'll need to change it. AddStategraphPostInit("wilson", function(sg) -- This will add some code to the server side stategraph local _attack = sg.states["attack"] local _onenter = _attack.onenter _attack.onenter = function(inst,...) _onenter(inst,...) if inst.prefab == "wilba" then -- You'll want to change wilba to your own character's prefab local speed = 2 -- Change this to whatever yoy want your speed multiplier to go to, careful when going over 5 though, it gets buggy. inst.sg:SetTimeout(inst.sg.timeout/speed) inst.components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD / speed) -- Attack period is essentially like an attack cooldown, so we divide it by the speed. inst.AnimState:SetDeltaTimeMultiplier(speed) -- This is the time multiplier for animations, we multiply it by our speed to make the character punch fast and not have animation desyncs. for k, v in pairs(_attack.timeline) do v.time = v.time/speed end end return end local _onexit = _attack.onexit _attack.onexit = function(inst,...) if inst.prefab == "wilba" then -- Make sure to change your prefab here too! inst.AnimState:SetDeltaTimeMultiplier(1) -- Here we'll only return out animation speed back to normal, since Attack Period being increased doesn't matter otherwise, and it might break things if we did return it after every attack. end return _onexit(inst,...) end end) AddStategraphPostInit("wilson_client", function(sg) -- This adds code to the client side stategraph, but it's only used if the client has Movement Prediction enabled. local _attack = sg.states["attack"] local _onenter = _attack.onenter _attack.onenter = function(inst,...) _onenter(inst,...) if inst.prefab == "wilba" then --Change it here again! local speed = 2 -- Make sure to set your speed here as well, so the client knows. inst.sg:SetTimeout(inst.sg.timeout/speed) inst.AnimState:SetDeltaTimeMultiplier(speed) for k, v in pairs(_attack.timeline) do v.time = v.time/speed end end return end local _onexit = _attack.onexit _attack.onexit = function(inst,...) if inst.prefab == "wilba" then -- Final change here, to your characters prefab again. inst.AnimState:SetDeltaTimeMultiplier(1) end return _onexit(inst,...) end end) Thing to keep in mind If you want your character to ALWAYS punch fast, you should probably comment out or remove the lines that mess with AttackPeriod, and instead put that in your characters master_postinit.
  7. Okay, I tried adapting some code from my own mod, you'll need to change hatkid to your character's prefab, and add some extra stuff yourself. It will also only work if you have movement prediction disabled on your client. I'll help you later with how to get it working with it, just figured you can test this from now. Put this in your modmain AddStategraphPostInit("wilson", function(sg) local _attack = sg.states["attack"] local _onenter = _attack.onenter _attack.onenter = function(inst,...) _onenter(inst,...) if inst.prefab == "hatkid" and inst.components.combat.target:HasTag("hostile") then -- code if hostile else --code if not hostile end return end end) do not do this
  8. You should be able to do this via a stegraph, where you just cancel the attack if not target:HasTag("hostile")... Or something like that. Sorry I can't help more, I'm at work lol.
  9. Generally, unless an error is shown on screen, you're gonna have a server crash. You can find your server log located with each of your world files, your world files are near where your client log was, in folders called something like "cluster_1" or "cluster_4". You'll have to figure out which one is your test world.
  10. Can you send your crash logs, both server and client?
  11. I don't think the normal talker component is capable of that, You'll Have to create your own component to make a separate line of text from the normal talker component.
  12. I believe you'll want to add inst:AddTag("bookbuilder") In the common postinit.
  13. That sounds like a nice example, though I ended up scrapping this feature in the end, I would still like to know how. Thank you.
  14. Is AddRecipeValue what you're looking for? Take a look at this post and look into it, it may be what you need.