Jump to content

[Tutorial] Creating a "handslot-equippable-item" from scratch


Malacath
 Share

Recommended Posts

Nevermind, my WinRAR is foreign but here you go xD. Thanks in advance

Ah, the Sandman. Possible my favourite weapon in TF2.

 The problem is the image in swap_sandman folder was supposed to be called just 'sandman' not 'swap_sandman'. The easiest way to fix this is to remake the mod, (im pretty sure just i can't get it to work any other way) just download this template and change the images and names around.

Also, in game the sandman is called MISSING NAME. You can add a name and examine quote by adding this code into your sandman.lua:

STRINGS.NAMES.SANDMAN = "The Sandman"STRINGS.CHARACTERS.GENERIC.DESCRIBE.SANDMAN = "Your quote here."

If it doesn't wrk please tell me.

Link to comment
Share on other sites

Ah, the Sandman. Possible my favourite weapon in TF2.

 The problem is the image in swap_sandman folder was supposed to be called just 'sandman' not 'swap_sandman'. The easiest way to fix this is to remake the mod, (im pretty sure just i can't get it to work any other way) just download this template and change the images and names around.

Also, in game the sandman is called MISSING NAME. You can add a name and examine quote by adding this code into your sandman.lua:

STRINGS.NAMES.SANDMAN = "The Sandman"STRINGS.CHARACTERS.GENERIC.DESCRIBE.SANDMAN = "Your quote here."

If it doesn't wrk please tell me.

 

Ah, I see. However, I knew about the name and description stuff because I just took the files appropriate to the tutorial and uploaded them. See I'm currently working on a whole scout mod. Do you know if I will have to redo the scout mod files too? (The scout files and the sandman files were in the same mod file.)

Edited by SergeantDoof
Link to comment
Share on other sites

Ah, I see. However, I knew about the name and description stuff because I just took the files appropriate to the tutorial and uploaded them. See I'm currently working on a whole scout mod. Do you know if I will have to redo the scout mod files too? (The scout files and the sandman files were in the same mod file.)

No, unless the same thing is happening with the scoot himself. did you take the sandman files out of the scout files? If you did, you can replace the whole scout but it will probs be easier just to take out the sandman files of the scout (on your computer) then replace them and then *put them back

if the same thing keeps happening after that then yeah, you will have to redo the whole mod. (ok not really redo it just get a template and change the names and paste all the scripts into the new ones.)  :livid:

Edited by NeddoFreddo
Link to comment
Share on other sites

No, unless the same thing is happening with the scoot himself. did you take the sandman files out of the scout files? If you did, you can replace the whole scout but it will probs be easier just to take out the sandman files of the scout (on your computer) then replace them and then *put them back

if the same thing keeps happening after that then yeah, you will have to redo the whole mod. (ok not really redo it just get a template and change the names and paste all the scripts into the new ones.)  :livid:

 

No luck. Here is the file but it just keeps crashing on me when I uncomment the 4th line in the sandman.lua. Its along with the scout files too so hopefully you can make something work. (I deleted all of the description and inventory start because I thought it might interfere).

 

Last time when I had the swap_sandman.zip files already there, I just added them in thinking that they won't automatically make themselves, like how the ground_sandman did. That might be the issue, but now when I try to do the same for the swap_sandman.zip, it just crashes and doesn't create new .zip files...

ScootyBooty man.zip

Link to comment
Share on other sites

No luck. Here is the file but it just keeps crashing on me when I uncomment the 4th line in the sandman.lua. Its along with the scout files too so hopefully you can make something work. (I deleted all of the description and inventory start because I thought it might interfere).

 

Last time when I had the swap_sandman.zip files already there, I just added them in thinking that they won't automatically make themselves, like how the ground_sandman did. That might be the issue, but now when I try to do the same for the swap_sandman.zip, it just crashes and doesn't create new .zip files...

Well I can't seem to find the problem but I found something that might interest you.post-655693-0-51894700-1441090957_thumb.

This is an image of my autocompiler acting up, as you can see it says that there is a missing image that should be called 'sandman.png' not 'swap_sandman.png' as you have called it. I checked the spriter file and there was nothing there, which would explain the crashing and not compiling.

Link to comment
Share on other sites

Oh, right. that's becasue this:

inst.components.instrument:SetOnHeardFn(HearViolin)

^is still set to call the "HearViolin" function when it's played. And all your animation stuff happens in the "onheard" function that you made. You could just change it to   SetOnHeardFn(onheard)   but then all the stuff in the "HearViolin" function wouldn't happen and nothing would fall asleep.

So you can take all the code in your onheard function and just paste it into the HearViolin function. (just replace all the "inst" with "musician", because musician is what refers to the player in that function.)

Also this is just a minor thing but i wanted the violin to not put players to sleep (In DST when i port this mod over to ditto). DO you know how?

Link to comment
Share on other sites

Well I can't seem to find the problem but I found something that might interest you.attachicon.gifScreenshot (18).png

This is an image of my autocompiler acting up, as you can see it says that there is a missing image that should be called 'sandman.png' not 'swap_sandman.png' as you have called it. I checked the spriter file and there was nothing there, which would explain the crashing and not compiling.

 

Peculiar. I switched the files around a bit and edited them in sprinter but it seems like the game doesn't know where the sandman file is despite not moving it at all in order to make sure that's not the issue. Do you have any suggestions to help diagnose the problem or something you could refer me to that could help?

 

It's fine if you're sick of my rambling. There's just so many beginners traps that I could fall into, and on top of that, I don't even know where to start :/ .

 

Appreciate every bit of input so far though!

Link to comment
Share on other sites

Can anyone help me out?

I think I skipped a step with the "swap_myitem" to .scml. Or with the uncommenting in the "myitem.lua"

Because my item, when spawned, does not have any texture and remains invisible, but it does have the inventory icon and ground texture.

 

Here's the lua code:

local assets=
{
    Asset("ANIM", "anim/barbaxe.zip"),
    Asset("ANIM", "anim/swap_barbaxe.zip"),
 
    Asset("ATLAS", "images/inventoryimages/barbaxe.xml"),
    Asset("IMAGE", "images/inventoryimages/barbaxe.tex"),
}
prefabs = {
}
local function fn()
 
    local function OnEquip(inst, owner)
        owner.AnimState:OverrideSymbol("swap_object", "swap_barbaxe", "swap_barbaxe")
        owner.AnimState:Show("ARM_carry")
        owner.AnimState:Hide("ARM_normal")
    end
 
    local function OnUnequip(inst, owner)
        owner.AnimState:Hide("ARM_carry")
        owner.AnimState:Show("ARM_normal")
    end
 
    local inst = CreateEntity()
    local trans = inst.entity:AddTransform()
    local anim = inst.entity:AddAnimState()
    local sound = inst.entity:AddSoundEmitter()
    MakeInventoryPhysics(inst)
     
    anim:SetBank("barbaxe")
    anim:SetBuild("barbaxe")
    anim:PlayAnimation("idle")
 
    inst:AddComponent("inspectable")
     
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.imagename = "barbaxe"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/barbaxe.xml"
     
    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip( OnEquip )
    inst.components.equippable:SetOnUnequip( OnUnequip )
 
    return inst
end

return  Prefab("common/inventory/barbaxe", fn, assets, prefabs)

 

If there are any other files, someone would need to look at to help me, I'll post those as well.

Thanks for any help. ^_^

Link to comment
Share on other sites

Three more tries, and still to no avail.

*Ack!*

 

Here's the .scml's current code:

<?xml version="1.0" encoding="UTF-8"?>
<spriter_data scml_version="1.0" generator="BrashMonkey Spriter" generator_version="b5">
    <folder id="0">
        <file id="0" name="swap_barbaxe.png" width="100" height="100" pivot_x="0.5" pivot_y="-0.0049505"/>
    </folder>
    <entity id="0" name="swap_barbaxe">
        <animation id="0" name="BUILD" length="1000">
            <mainline>
                <key id="0">
                    <object_ref id="0" name="swap_barbaxe" folder="0" file="0" abs_x="0" abs_y="0.50495" abs_pivot_x="0.5" abs_pivot_y="-0.00495" abs_angle="360" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="0" z_index="0"/>
                </key>
            </mainline>
            <timeline id="0" name="swap_barbaxe">
                <key id="0" spin="0">
                    <object folder="0" file="0" y="0.50495"/>
                </key>
            </timeline>
        </animation>
    </entity>
</spriter_data>
 
Also, I didn't change the modmain.lua's game version to match with the current version of DST.
Could that be a possible affect?
Either way, I'll test that out too.
Link to comment
Share on other sites

 

Three more tries, and still to no avail.

*Ack!*

 

Here's the .scml's current code:

<?xml version="1.0" encoding="UTF-8"?>
<spriter_data scml_version="1.0" generator="BrashMonkey Spriter" generator_version="b5">
    <folder id="0">
        <file id="0" name="swap_barbaxe.png" width="100" height="100" pivot_x="0.5" pivot_y="-0.0049505"/>
    </folder>
    <entity id="0" name="swap_barbaxe">
        <animation id="0" name="BUILD" length="1000">
            <mainline>
                <key id="0">
                    <object_ref id="0" name="swap_barbaxe" folder="0" file="0" abs_x="0" abs_y="0.50495" abs_pivot_x="0.5" abs_pivot_y="-0.00495" abs_angle="360" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="0" z_index="0"/>
                </key>
            </mainline>
            <timeline id="0" name="swap_barbaxe">
                <key id="0" spin="0">
                    <object folder="0" file="0" y="0.50495"/>
                </key>
            </timeline>
        </animation>
    </entity>
</spriter_data>
 
Also, I didn't change the modmain.lua's game version to match with the current version of DST.
Could that be a possible affect?
Either way, I'll test that out too.

 

Excuse me, I meant modinfo.lua, which I don't have included with the mod, would I actually need it?

Link to comment
Share on other sites

Excuse me, I meant modinfo.lua, which I don't have included with the mod, would I actually need it?

modinfo has nothing to do with the mods files, it is just, well, info. The version in modinfo means the version of your mod. The only thing the game checks in the api version. The current api version for DS singleplayer is 6, and for DST is 10. if you have the wrong one, the game will most likely crash.

Link to comment
Share on other sites

modinfo has nothing to do with the mods files, it is just, well, info. The version in modinfo means the version of your mod. The only thing the game checks in the api version. The current api version for DS singleplayer is 6, and for DST is 10. if you have the wrong one, the game will most likely crash.

Since I'm not even using the modinfo with this mod, I doubt it's the problem.

 

Thank you for the heads up.

Nice to know ahead of time with the api_version thing and possible crashes.

Link to comment
Share on other sites

Ok so as I suspected you did not respect EXACTLY the tutorial. In swap_barbaxe, you are supposed to put the png inside a subfolder called as well swap_barbaxe while the scml project stays where it is currently.

 

exported

               |-> barbaxe

                                  |-> swap_barbaxe

                                                               |-> swap_barbaxe.scml

                                                               |-> swap_barbaxe

                                                                                          |-> swap_barbaxe.png

 

It's a common mistake a lot of people are doing :-)

Edited by ZupaleX
Link to comment
Share on other sites

Ok so as I suspected you did not respect EXACTLY the tutorial. In swap_barbaxe, you are supposed to put the png inside a subfolder called as well swap_barbaxe while the scml project is where it is currently.

So, [exported/barbaxe/swap_barbaxe/swap_barbaxe/swap_barbaxe.png]?

and not what I did before, with just [exported/barbaxe/swap_barbaxe/swap_barbxae.png]?

 

Thank you for all the help.

Sorry if I'm being such a newbie/pain in the behind.

Link to comment
Share on other sites

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
 Share

×
  • Create New...