Jump to content

Recommended Posts

Uh hey...

so my friend was trying to make a character on her own, using tutorials and i tried my best to help her along the way, but now we've came across a problem neither of us can fix. Everything works fine, able to hop on a world, and see the weapon down on the ground AND our inventory. But the problem is the character holds nothing when its equipped.

modinfo.luamodmain.luaareadbhar.lua

Link to comment
https://forums.kleientertainment.com/forums/topic/118772-not-holding-weapon/
Share on other sites

This is a really simple mistake of overriding the wrong symbol.
AnimState:OverrideSymbol takes 3 parameters:
target symbol, build containing new symbol, symbol in the build you want to override the target with.

In this case this is a handslot item so you need to override the symbol "swap_object"
 

inst.AnimState:OverrideSymbol("swap_object", "swap_areadbhar", "areadbhar")

 

Edited by IronHunter
grammar
  • Like 1

Oh! Ok so it's not just us... Cool, good to know for next time thanks!

EDIT: It didnt work... unless i put it in the wrong spot...

Quote

local function fn()
  
    local inst = CreateEntity()
 
    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()
     
    MakeInventoryPhysics(inst)   
      
    inst.AnimState:SetBank("areadbhar")
    inst.AnimState:SetBuild("areadbhar")
    inst.AnimState:PlayAnimation("idle")
    inst.AnimState:OverrideSymbol("swap_object", "swap_areadbhar", "areadbhar")

Thats where i put it in the areadbhar.lua, right at the bottom there and it seemed it didnt work..

Edited by PixaL SKulLKid
59 minutes ago, PixaL SKulLKid said:

Oh! Ok so it's not just us... Cool, good to know for next time thanks!

EDIT: It didnt work... unless i put it in the wrong spot...

Thats where i put it in the areadbhar.lua, right at the bottom there and it seemed it didnt work..

If you look at your item you have the inst.AnimState:OverrideSymbol in your onequip function, you needed to change that, without your spriter file or folder structure its impossible for me to know what you named your symbol internally for further troubleshooting.

  • Like 1

 

um... this might sound stupid and i know im taking a while and i thank you for trying your best, but i'm not sure what the spriter file is, i have an animation, bigportraits, exported, images and scripts folder. So is the thing your looking for in the exported folder?

(Again thank you for pretty much dragging me through this, but once were done here i should know for next time)

2 hours ago, PixaL SKulLKid said:

 

um... this might sound stupid and i know im taking a while and i thank you for trying your best, but i'm not sure what the spriter file is, i have an animation, bigportraits, exported, images and scripts folder. So is the thing your looking for in the exported folder?

(Again thank you for pretty much dragging me through this, but once were done here i should know for next time)

Your spriter file or .scml file is in your exported folder and contains information for your anim and build when it gets compiled. The textures are converted into a .tex file.

If you want you can either attach your exported folder or your .scml file as I really just want to know what you named your swap items symbol so I can tell you which one is the overridesymbol.

  • Like 1
3 hours ago, PixaL SKulLKid said:

ah, so the scml files are the spriter, thanks! here's both for the weapon, since its going to be a weapon with a character.

swap_areadbhar.scml 1.2 kB · 0 downloads areadbhar.scml 1.03 kB · 0 downloads

Ok I think the problem is a small hindsight on my part but its owner.AnimState:OverrideSymbol("swap_object", "swap_areadbhar", "swap_areadbhar") or owner.AnimState:OverrideSymbol("swap_object", "swap_areadbhar", "areadbhar") in your onequip function.
If you change your original areadbhar.lua file so it just uses swap_object it should work. And you can try one of those two symbols.
Edit
The reason why we want to override owner is because the owner is the player character in most cases, inst in this case will be the equipment itself which only shows its animation when dropped on the ground, it also doesn't have a "swap_object" symbol.

Edited by IronHunter
  • Like 1
11 hours ago, IronHunter said:

Ok I think the problem is a small hindsight on my part but its owner.AnimState:OverrideSymbol("swap_object", "swap_areadbhar", "swap_areadbhar") or owner.AnimState:OverrideSymbol("swap_object", "swap_areadbhar", "areadbhar") in your onequip function.
If you change your original areadbhar.lua file so it just uses swap_object it should work. And you can try one of those two symbols.
Edit
The reason why we want to override owner is because the owner is the player character in most cases, inst in this case will be the equipment itself which only shows its animation when dropped on the ground, it also doesn't have a "swap_object" symbol.

Tried all three options and it still isn't working.

owner.AnimState:OverrideSymbol("swap_object", "swap_areadbhar", "swap_areadbhar")
owner.AnimState:OverrideSymbol("swap_object", "swap_areadbhar", "areadbhar")
owner.AnimState:OverrideSymbol("swap_object")

I've tried putting each of these in the areadbhar.lua separately, and the last one gave the "string expected, no value" error (kinda makes sense).  but the others still showed up invisible.

perhaps im putting it in the wrong spot? Ive always been putting it right under the: local function OnEquip(inst, owner)

 

1 hour ago, PixaL SKulLKid said:

Tried all three options and it still isn't working.


owner.AnimState:OverrideSymbol("swap_object", "swap_areadbhar", "swap_areadbhar")

owner.AnimState:OverrideSymbol("swap_object", "swap_areadbhar", "areadbhar")

owner.AnimState:OverrideSymbol("swap_object")

I've tried putting each of these in the areadbhar.lua separately, and the last one gave the "string expected, no value" error (kinda makes sense).  but the others still showed up invisible.

perhaps im putting it in the wrong spot? Ive always been putting it right under the: local function OnEquip(inst, owner)

 

This is very odd, "swap_object" is the correct symbol we are trying to override

Your swap's .zip file is called "swap_areadbhar" and the symbol in the spriter file is the folder name containing sharing its name "swap_areadbar"
 

local function OnEquip(inst, owner)
	owner.AnimState:OverrideSymbol("swap_object", "swap_areadbhar", "swap_areadbhar")
	owner.AnimState:Show("ARM_carry")
	owner.AnimState:Hide("ARM_normal")
end

Is what it should look like, is your swap file compiling? I noticed it had 2 symbol folders in there one with a texture dimensions of 0 and 0.
If you check your anim folder does it exist? Because at this point the only thing I can think of is the assets are missing or their is a typo somewhere.
I could look deeper with the mod folder attached as a .zip but first just double check those things.

  • Like 1

Yeah its compiling, i'm able to get into a game, and in the anim folder i do see the files. If it's that 0x0 texture than i have a feeling its that... but i'll let you take it and see for yourself (just don't upload it and stuff alright?)

(and sorry it took awhile i actually forgot about this because i was busy)

dimitriew (2).zip

Edited by PixaL SKulLKid
20 hours ago, PixaL SKulLKid said:

Yeah its compiling, i'm able to get into a game, and in the anim folder i do see the files. If it's that 0x0 texture than i have a feeling its that... but i'll let you take it and see for yourself (just don't upload it and stuff alright?)

(and sorry it took awhile i actually forgot about this because i was busy)

dimitriew (2).zip 4.45 MB · 1 download

capture.PNG.6755b82deaef879fe4e11479b1f33f58.PNG
So after a quick autocompiler test it seems like you were missing a image or something in your most recent version, I simply fixed your spriter file. It compiled and now it works in game for both on the ground and in hand.

Dimitri.rar

Edited by IronHunter
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...