TheNastyCapivara Posted December 11, 2015 Share Posted December 11, 2015 Sorry for the double thread... but I posted this in the wrong section initially. So, I'm rather new to modding so I'm probably making a very stupid mistake here aside from double posting :S I'm working on a mod of a huntress with a custom bow. My problem is that I can't seem to make the arrow projectile appear onscreen. I'm not sure how I should make the sprite for the arrow, does it need a BUILD animation? Here are the codes to the bow and projectile prefabs huntressbow.lua? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 local assets= { Asset("ANIM", "anim/huntressbow.zip"), Asset("ANIM", "anim/swap_huntressbow.zip"), Asset("ATLAS", "images/inventoryimages/huntressbow.xml"), Asset("IMAGE", "images/inventoryimages/huntressbow.tex"), } local prefabs = { } local function onattack_huntressbow(inst, attacker, target) if attacker and attacker.components.health and attacker.components.hunger then attacker.components.health:DoDelta(-1) attacker.components.hunger:DoDelta(-4) end end local function fn(colour) local function OnEquip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_huntressbow", "swap_huntressbow") 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() MakeInventoryPhysics(inst) anim:SetBank("huntressbow") anim:SetBuild("huntressbow") anim:PlayAnimation("idle") inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "huntressbow" inst.components.inventoryitem.atlasname = "images/inventoryimages/huntressbow.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) inst.components.inventoryitem.keepondeath = true inst:AddComponent("inspectable") inst:AddTag("shadow") inst:AddComponent("weapon") inst.components.weapon:SetOnAttack(onattack_huntressbow) inst.components.weapon:SetDamage(55) inst.components.weapon:SetRange(8, 10) inst.components.weapon:SetProjectile("callista_projectile") return inst end return Prefab("common/inventory/huntressbow", fn, assets, prefabs) callista_projectile.lua? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 local assets = { Asset("ANIM", "anim/callista_projectile.zip"), } local function common(anim, bloom) local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) RemovePhysicsColliders(inst) inst.AnimState:SetBank("callista_projectile") inst.AnimState:SetBuild("callista_projectile") inst.AnimState:PlayAnimation(anim) --anim:PlayAnimation("shot") if bloom ~= nil then inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") end inst:AddTag("projectile") if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() inst:AddComponent("projectile") inst.components.projectile:SetSpeed(50) inst.components.projectile:SetOnHitFn(inst.Remove) inst.components.projectile:SetOnMissFn(inst.Remove) return inst end --local function ice() -- return common("callista_spin_loop") --end --local function fire() -- return common("callista_spin_loop", "shaders/anim.ksh") --end return Prefab("common/inventory/ice_projectile", ice, assets), Prefab("common/inventory/callista_projectile", fire, assets) And the zipped folder with the scml file for the projectile: callista_projectile.zip What am I doing wrong? Thanks in advance ^^ PS: I took Madoka's mod as a reference, so the code is pratically the same in this part, I plan on making changes (such as damage and hunger drain) as soon as I get the bow and arrow to fire properly and the animations to play out. Link to comment Share on other sites More sharing options...
Fancy_Fox_Pers Posted December 11, 2015 Share Posted December 11, 2015 inst.AnimState:SetBank("callista_projectile") inst.AnimState:SetBuild("callista_projectile") inst.AnimState:PlayAnimation(anim) --anim:PlayAnimation("shot") Shouldn't the "play animation" be commented out? My problem is that I can't seem to make the arrow projectile appear onscreen. I'm not sure how I should make the sprite for the arrow, does it need a BUILD animation? So I'm assuming that you did make an arrow, right? Well, it certainly needs a spriter project. Maybe it's a good idea to use other mods as reference like the "throwable spears" mod. Then use ktools to turn anim folders into spriter projects. Then you'll have basicly everything set up for you, you'll just need to use the png files (that you'll also get with ktools) to draw your arrow in and apply that to your code. I hope this helps. I gave it a shot because I saw you didn't get any reply, but I really don't know much about this. That's why I'm referencing you to other mods to look at ^^'. And ktools. Ktools is awesome. Link to comment Share on other sites More sharing options...
ZupaleX Posted December 11, 2015 Share Posted December 11, 2015 Actually you have that in the base game already. You can look at the blowdart. But basically yeah you need a png and a spriter file for your arrow, it's like any other entity in the game. It can be put wothin the same spriter project than your bow though. Link to comment Share on other sites More sharing options...
Fancy_Fox_Pers Posted December 11, 2015 Share Posted December 11, 2015 Actually you have that in the base game already. You can look at the blowdart. Oh yeah, forgot about that. It would be a lot easier to use ktools with a blowdart then I guess. (even if it's just to get an idea of how it works) Link to comment Share on other sites More sharing options...
ZupaleX Posted December 12, 2015 Share Posted December 12, 2015 If you need more help on that i should be able to help since i made a mod revolving around range weapon, so just ask Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now