maliblues

  • Content count

    38
  • Joined

  • Last visited

Community Reputation

25 Excellent

About maliblues

  • Rank
    Junior Member

Recent Profile Visitors

430 profile views
  1. oh just noticed, since this state is actually added in, it is created in the commonstates.lua file so this is the full code for it: I'm not sure if the the character already has these jump animations but I suspect they might because of wormhole/boat jumping but the "hop" ones I'm unsure about.
  2. Perhaps the stategraph/animatons needed are part of the issue. I see this code regarding swimming on the hound stategraph: CommonStates.AddAmphibiousCreatureHopStates(states, { -- config swimming_clear_collision_frame = 9 * FRAMES, }, { -- anims }, { -- timeline hop_pre = { TimeEvent(0, function(inst) if inst:HasTag("swimming") then SpawnPrefab("splash_green").Transform:SetPosition(inst.Transform:GetWorldPosition()) end end), }, hop_pst = { TimeEvent(4 * FRAMES, function(inst) if inst:HasTag("swimming") then inst.components.locomotor:Stop() SpawnPrefab("splash_green").Transform:SetPosition(inst.Transform:GetWorldPosition()) end end), TimeEvent(6 * FRAMES, function(inst) if not inst:HasTag("swimming") then inst.components.locomotor:StopMoving() end end), } })
  3. I believe this mod uses a custom animation for it's weapon, maybe looking into it could help.
  4. I've been trying to figure it out and this is what I have that works (so far). inst:AddComponent("inventoryitem") inst.components.inventoryitem:SetOnPutInInventoryFn(OnPutInInventory) local function OnPutInInventory(inst) print("flask put inventory fn ran") local owner = inst.components.inventoryitem:GetGrandOwner() -------------- if owner then print("flask picked by", owner.name, owner.prefab) --just for testing end ------------- if owner.components.inventory and owner.prefab ~= "wyrd" then inst:DoTaskInTime(0.1, function() owner.components.inventory:DropItem(inst) owner.components.talker:Say("That flask is cursed...") end) end if owner.components.container then --for chests --test when in backpack with diff owner inst:DoTaskInTime(0.1, function() owner.components.container:DropItem(inst) end) end end In the quick tests I did when it is picked up by someone and if it isn't the character prefab given then it is dropped back down. Also when put in a chest it will get dropped (I think that's what you wanted). Now it does go in the backpack of the character that can carry it but I haven't tested what happens with a different player taking the backpack. I found this post helpful, before I was getting some weird issues where the item would drop but also another copy remain in the inventory. I think it needs more testing still but just posting what I had and can look more into it later if needed. It isn't perfect but maybe it can be of some use. Also I'll just attach the copy I worked on, I didn't have the art files so just added random DST ones. wyrdflask_health.lua
  5. I don't have expereince with characters but understand some of the code. You could listen to the moisture delta event on your character and then run a function whenever changes in wetness detected. inst:ListenForEvent("moisturedelta", OnMoistureDelta) and then on the OnMoistureDelta function have something like function OnMoistureDelta(inst, data) if inst.components.moisture:IsWet() then --add perks here end end I think the character is considered wet when wetness 35 or above. You may also want to add a sanity buff since wetness from inventory items decreases sanity I believe. You can also add perks depending on the moisture % instead (so a bigger perk the more wetness character has) by using the line below instead of just "IsWet()" used above. inst.components.moisture:GetMoisturePercent()
  6. The creature.lua file is for the pet prefab right? I didnt see a container component added so I would have added these things from the chester code.. So in the MakeMinion function where the commponents are added: inst:AddComponent("container") inst.components.container:WidgetSetup("chester") inst.components.container.onopenfn = OnOpen inst.components.container.onclosefn = OnClose I believe adding this line in local assets is needed too: Asset("ANIM", "anim/ui_chest_3x3.zip"), and then just need to put in these functions it looks for: local function OnOpen(inst) if not inst.components.health:IsDead() then inst.sg:GoToState("open") end end local function OnClose(inst) if not inst.components.health:IsDead() and inst.sg.currentstate.name ~= "transition" then inst.sg:GoToState("close") end end however I'm not sure what you're basing the pets off of, if it isn't chester for example then it may not have those open and close states/animations. You can always just remove that line and add something like a sound being played, like so: local function OnOpen(inst) if not inst.components.health:IsDead() then inst.SoundEmitter:PlaySound("dontstarve/wilson/chest_open") end end local function OnClose(inst) if not inst.components.health:IsDead() then inst.SoundEmitter:PlaySound("dontstarve/wilson/chest_close") end end Hope it helps.
  7. Yes this method of keeping portablecookware component just to pass those checks for the action to work is much simpler. Glad it's working as intended now
  8. That's useful to know! I wanted to try testing it for myself and try to figure it out. It would help to have the custom portablelick component and your modmain file (and if there's any other relevant one) Edit: by deconstruct do you mean the dismantle function? If your custom component that sets your OnDismantle function is a copy of the portablecookware component then that wouldn't be enough. I haven't seen your mod fille so I don't know if you're aware of this but by searching through the files I see that ACTIONS.DISMANTLE is the component action portablecookware uses (actions.lua) it runs further checks so seems like this action only works for that component. Also further checks in componentactions.lua. So I would have thought a custom component action is needed unless you've done this and something else is the cause. I can only really guess without seeing the files.
  9. Using the original saltlick code I would have removed the OnBuilt functions and the MakePlacer and then added the inventory item component with a function for when its dropped. inst.components.inventoryitem:SetOnDroppedFn(OnDropped) So for that OnDropped function I would add back some of the things the OnBuilt function had like play idle and alert critters. Also I don't think a seperate prefab is used for the inventory, just a different image is set. Keeping the same prefab would help in this case because it saves the information about how much it was used. Which then displays the correct saltlick animation too. Having to remove prefab and spawn a new one each time like your code seems to be doing doesn't save that data. I'm sure it can be possible to save that information but in this case it isn't needed to use a new prefab entirely. So I would set the inventory images you have on the same prefab.
  10. Help with event listeners

    Thank you for the explanation! I can work with that and do what I needed
  11. For a creature mod I wanted to add some functions when it is mounted and then dismounted. The rider component pushes the events "mounted" and "dismounted" but I don't know how to properly listen for these. I can see that the code for wolfgang is able to use these same events but that isn't working for me. I've tried looking through the forums but can't understand what I need to do for my case. I'm not sure if I need to be adding something in modmain or the prefab and what exactly to put to make it work. Any help is appreciated.
  12. Adding Idle Anim [SOLVED]

    I used your files and decompiled it to get an scml. I've attached that spriter project, hope this helps arcana.zip
  13. Swap_Weapon not working

    Hi, I've managed to get it showing in-game like so: After some digging/testing here's what I found. For this line of code it is important to understand what they are referring to. owner.AnimState:OverrideSymbol("swap_object", "swap_rejuvenator", "swap_rejuvenator") This post explains that the middle is referring to a build but the other two are "symbols". The symbol means a texture folder located inside exported > inside your "rejuvenator" folder > inside either "ground_rejuvenator" or "swap_rejuvenator". However you did not have any folder here. It is correct for the spriter file to be here but the texture should have been placed in another folder named what the code looks for, so "swap_rejuvenator". However providing the correct folder structure was not enough here because those spriter files were already set up to look for a texture outside your new folder still. This was causing the game to not compile the weapon anymore since it wasn't finding the texture in the new folder. So I found this equip item example helpful in providing me with a spriter project set up that I needed. I have attached what I did so you can take a look. I wouldn't change any folder or texture names. To explain in more detail what I did: I used the spriter file from the example and changed the name of the spriter file (so the build name) and then also the entity name (the bank) inside spriter. I kept the texture folders named wand as this spriter file looks for them, same with the name of the texture inside the wand folder. The code also needed to be changed to look for the correct symbol now. owner.AnimState:OverrideSymbol("swap_object", "swap_rejuvenator", "wand") Also, as you can see the weapon in-game isn't placed correctly, perhaps it would be better to use the original pngs for the wand as your template to draw over to hopefully get it placed right. Spinel.zip