dragonacool Posted July 22, 2015 Share Posted July 22, 2015 ok so i have the weapon almost complete. one part of the weapon shoots a projectile towards a target, i got that working. besides the fact that i cant get the overcharge sound to play when that happens. other than that its ok now the second part is spawning lighting around. now the weapon makes the sky go dark and i hear the lightning sound but i dont see any lightning nor does it do any effects to the surround areas. is it because the weapon is set to projectile or could it be do to the world position. also i dont know what to write for getting the players hunger to decrease when the weapon is used. here is my code for the projectilelocal assets ={ Asset("ANIM", "anim/tm24_projectile.zip"), Asset("ANIM", "anim/bishop_attack.zip"), Asset("SOUND", "sound/wx78.fsb"), Asset("SOUNDPACKAGE", "sound/dontstarve.fev"), }local function fn(inst) local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) RemovePhysicsColliders(inst) inst.AnimState:SetBank("bishop_attack") inst.AnimState:SetBuild("bishop_attack") inst.AnimState:PlayAnimation("idle", true) if not TheWorld.ismastersim then return inst end -- inst.AnimState:SetBank("projectile") -- inst.AnimState:SetBuild("staff_projectile") inst:AddTag("projectile") inst.entity:SetPristine() inst:AddComponent("projectile") inst.components.projectile:SetSpeed(30) inst.components.projectile:SetOnHitFn(inst.Remove) inst.components.projectile:SetOnMissFn(inst.Remove) ---------------------------------------------------------------------- --Lighting effect ------------------------------------------------------------------------ local pt = Vector3(inst.Transform:GetWorldPosition()) local num_lightnings = 16 inst:StartThread(function() for k = 0, num_lightnings do local rad = math.random(3, 15) local angle = k * 4 * PI / num_lightnings local pos = pt + Vector3(rad * math.cos(angle), 0, rad * math.sin(angle)) TheWorld:PushEvent("ms_sendlightningstrike", pos) Sleep(math.random( .3, .5)) end end) return instendreturn Prefab("common/inventory/tm24_projectile", fn, assets) Link to comment https://forums.kleientertainment.com/forums/topic/56393-trying-to-get-my-weapon-to-work-please-help/ 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