TheNastyCapivara Posted December 11, 2015 Share Posted December 11, 2015 So, I'm rather new to modding so I'm probably making a very stupid mistake here. But 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.lualocal 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) endendlocal 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 = trueinst: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 instendreturn Prefab("common/inventory/huntressbow", fn, assets, prefabs)callista_projectile.lualocal 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 instend--local function ice() -- return common("callista_spin_loop")--end--local function fire() -- return common("callista_spin_loop", "shaders/anim.ksh")--endreturn Prefab("common/inventory/ice_projectile", ice, assets), Prefab("common/inventory/callista_projectile", fire, assets)What am I doing wrong? Link to comment Share on other sites More sharing options...
TheNastyCapivara Posted December 11, 2015 Author Share Posted December 11, 2015 Posted this thread in the wrong section, I meant to post in the DST section, I'm sorry Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.